summaryrefslogtreecommitdiffstats
path: root/tests/auto/qwidget
diff options
context:
space:
mode:
authorSamuel Nevala <samuel.nevala@digia.com>2010-02-05 07:51:00 (GMT)
committerJani Hautakangas <ext-jani.hautakangas@nokia.com>2010-02-05 10:48:37 (GMT)
commit79fb890a4f2a13cc0f21e92f5b2a6e10af1430b4 (patch)
tree33fde1ea405828b9462f3735c375913eecd7a158 /tests/auto/qwidget
parentbd36d753337090a2878fc0ca4117e2250c5ae1b7 (diff)
downloadQt-79fb890a4f2a13cc0f21e92f5b2a6e10af1430b4.zip
Qt-79fb890a4f2a13cc0f21e92f5b2a6e10af1430b4.tar.gz
Qt-79fb890a4f2a13cc0f21e92f5b2a6e10af1430b4.tar.bz2
s60 application loses normalGeometry when returning from fullscreen
Problem description: normalGeomerty lost during showFullScreen 1. Reported problen was due on void QSymbianControl::PositionChanged() over write top->normaGeometry on every position change. As fix top->normalGeometry is moved to new rect:s top left only when widget windowState == 0. 2. Also made some new qwidget auto tests. Refactored s60 side setWindowState to be more readable. Minimized window state now hides window decoration. QApplication & QWidget autotest run on emulator and tested on s60 5.0 hw using attached application. http://bugreports.qt.nokia.com/browse/QTBUG-6231 Task-number:QTBUG-6231 Merge-request: 2256 Reviewed-by: Jani Hautakangas <ext-jani.hautakangas@nokia.com>
Diffstat (limited to 'tests/auto/qwidget')
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp224
1 files changed, 224 insertions, 0 deletions
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index ea90ae3..88bdc72 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -391,6 +391,10 @@ private slots:
#ifdef Q_OS_SYMBIAN
void cbaVisibility();
+ void fullScreenWindowModeTransitions();
+ void maximizedWindowModeTransitions();
+ void minimizedWindowModeTransitions();
+ void normalWindowModeTransitions();
#endif
void focusProxyAndInputMethods();
@@ -9687,6 +9691,226 @@ void tst_QWidget::cbaVisibility()
CEikButtonGroupContainer* buttonGroup = CEikonEnv::Static()->AppUiFactory()->Cba();
QVERIFY(buttonGroup->IsVisible());
}
+
+void tst_QWidget::fullScreenWindowModeTransitions()
+{
+ QWidget widget;
+ QVBoxLayout *layout = new QVBoxLayout;
+ QPushButton *button = new QPushButton("test Button");
+ layout->addWidget(button);
+ widget.setLayout(layout);
+ widget.show();
+
+ const QRect normalGeometry = widget.normalGeometry();
+ const QRect fullScreenGeometry = qApp->desktop()->screenGeometry(&widget);
+ const QRect maximumScreenGeometry = qApp->desktop()->availableGeometry(&widget);
+ CEikStatusPane *statusPane = CEikonEnv::Static()->AppUiFactory()->StatusPane();
+ CEikButtonGroupContainer *buttonGroup = CEikonEnv::Static()->AppUiFactory()->Cba();
+
+ //Enter
+ widget.showNormal();
+ widget.showFullScreen();
+ QCOMPARE(widget.geometry(), fullScreenGeometry);
+ QVERIFY(!buttonGroup->IsVisible());
+ QVERIFY(!statusPane->IsVisible());
+
+ widget.showMaximized();
+ widget.showFullScreen();
+ QCOMPARE(widget.geometry(), fullScreenGeometry);
+ QVERIFY(!buttonGroup->IsVisible());
+ QVERIFY(!statusPane->IsVisible());
+
+ widget.showMinimized();
+ widget.showFullScreen();
+ QCOMPARE(widget.geometry(), fullScreenGeometry);
+ QVERIFY(!buttonGroup->IsVisible());
+ QVERIFY(!statusPane->IsVisible());
+
+ //Exit
+ widget.showFullScreen();
+ widget.showNormal();
+ QCOMPARE(widget.geometry(), normalGeometry);
+ QVERIFY(buttonGroup->IsVisible());
+ QVERIFY(statusPane->IsVisible());
+
+ widget.showFullScreen();
+ widget.showMaximized();
+ QCOMPARE(widget.geometry(), maximumScreenGeometry);
+ QVERIFY(buttonGroup->IsVisible());
+ QVERIFY(statusPane->IsVisible());
+
+ widget.showFullScreen();
+ widget.showMinimized();
+ QCOMPARE(widget.geometry(), fullScreenGeometry);
+ QVERIFY(!buttonGroup->IsVisible());
+ QVERIFY(!statusPane->IsVisible());
+}
+
+void tst_QWidget::maximizedWindowModeTransitions()
+{
+ QWidget widget;
+ QVBoxLayout *layout = new QVBoxLayout;
+ QPushButton *button = new QPushButton("test Button");
+ layout->addWidget(button);
+ widget.setLayout(layout);
+ widget.show();
+
+ const QRect normalGeometry = widget.normalGeometry();
+ const QRect fullScreenGeometry = qApp->desktop()->screenGeometry(&widget);
+ const QRect maximumScreenGeometry = qApp->desktop()->availableGeometry(&widget);
+ CEikStatusPane *statusPane = CEikonEnv::Static()->AppUiFactory()->StatusPane();
+ CEikButtonGroupContainer *buttonGroup = CEikonEnv::Static()->AppUiFactory()->Cba();
+
+ //Enter
+ widget.showNormal();
+ widget.showMaximized();
+ QCOMPARE(widget.geometry(), maximumScreenGeometry);
+ QVERIFY(buttonGroup->IsVisible());
+ QVERIFY(statusPane->IsVisible());
+
+ widget.showFullScreen();
+ widget.showMaximized();
+ QCOMPARE(widget.geometry(), maximumScreenGeometry);
+ QVERIFY(buttonGroup->IsVisible());
+ QVERIFY(statusPane->IsVisible());
+
+ widget.showMinimized();
+ widget.showMaximized();
+ QCOMPARE(widget.geometry(), maximumScreenGeometry);
+ QVERIFY(buttonGroup->IsVisible());
+ QVERIFY(statusPane->IsVisible());
+
+ //Exit
+ widget.showMaximized();
+ widget.showNormal();
+ QCOMPARE(widget.geometry(), normalGeometry);
+ QVERIFY(buttonGroup->IsVisible());
+ QVERIFY(statusPane->IsVisible());
+
+ widget.showMaximized();
+ widget.showFullScreen();
+ QCOMPARE(widget.geometry(), fullScreenGeometry);
+ QVERIFY(!buttonGroup->IsVisible());
+ QVERIFY(!statusPane->IsVisible());
+
+ widget.showMaximized();
+ widget.showMinimized();
+ // Since showMinimized hides window decoration availableGeometry gives different value
+ // than with decoration visible. Altual size does not really matter since widget is invisible.
+ QCOMPARE(widget.geometry(), qApp->desktop()->availableGeometry(&widget));
+ QVERIFY(!buttonGroup->IsVisible());
+ QVERIFY(!statusPane->IsVisible());
+}
+
+void tst_QWidget::minimizedWindowModeTransitions()
+{
+ QWidget widget;
+ QVBoxLayout *layout = new QVBoxLayout;
+ QPushButton *button = new QPushButton("test Button");
+ layout->addWidget(button);
+ widget.setLayout(layout);
+ widget.show();
+
+ const QRect normalGeometry = widget.normalGeometry();
+ const QRect fullScreenGeometry = qApp->desktop()->screenGeometry(&widget);
+ const QRect maximumScreenGeometry = qApp->desktop()->availableGeometry(&widget);
+ CEikStatusPane *statusPane = CEikonEnv::Static()->AppUiFactory()->StatusPane();
+ CEikButtonGroupContainer *buttonGroup = CEikonEnv::Static()->AppUiFactory()->Cba();
+
+ //Enter
+ widget.showNormal();
+ widget.showMinimized();
+ QCOMPARE(widget.geometry(), normalGeometry);
+ QVERIFY(!buttonGroup->IsVisible());
+ QVERIFY(!statusPane->IsVisible());
+
+ widget.showFullScreen();
+ widget.showMinimized();
+ QCOMPARE(widget.geometry(), fullScreenGeometry);
+ QVERIFY(!buttonGroup->IsVisible());
+ QVERIFY(!statusPane->IsVisible());
+
+ widget.showMaximized();
+ widget.showMinimized();
+ // Since showMinimized hides window decoration availableGeometry gives different value
+ // than with decoration visible. Altual size does not really matter since widget is invisible.
+ QCOMPARE(widget.geometry(), qApp->desktop()->availableGeometry(&widget));
+ QVERIFY(!buttonGroup->IsVisible());
+ QVERIFY(!statusPane->IsVisible());
+
+ //Exit
+ widget.showMinimized();
+ widget.showNormal();
+ QCOMPARE(widget.geometry(), normalGeometry);
+ QVERIFY(buttonGroup->IsVisible());
+ QVERIFY(statusPane->IsVisible());
+
+ widget.showMinimized();
+ widget.showFullScreen();
+ QCOMPARE(widget.geometry(), fullScreenGeometry);
+ QVERIFY(!buttonGroup->IsVisible());
+ QVERIFY(!statusPane->IsVisible());
+
+ widget.showMinimized();
+ widget.showMaximized();
+ QCOMPARE(widget.geometry(), maximumScreenGeometry);
+ QVERIFY(buttonGroup->IsVisible());
+ QVERIFY(statusPane->IsVisible());
+}
+
+void tst_QWidget::normalWindowModeTransitions()
+{
+ QWidget widget;
+ QVBoxLayout *layout = new QVBoxLayout;
+ QPushButton *button = new QPushButton("test Button");
+ layout->addWidget(button);
+ widget.setLayout(layout);
+ widget.show();
+
+ const QRect normalGeometry = widget.normalGeometry();
+ const QRect fullScreenGeometry = qApp->desktop()->screenGeometry(&widget);
+ const QRect maximumScreenGeometry = qApp->desktop()->availableGeometry(&widget);
+ CEikStatusPane *statusPane = CEikonEnv::Static()->AppUiFactory()->StatusPane();
+ CEikButtonGroupContainer *buttonGroup = CEikonEnv::Static()->AppUiFactory()->Cba();
+
+ //Enter
+ widget.showMaximized();
+ widget.showNormal();
+ QCOMPARE(widget.geometry(), normalGeometry);
+ QVERIFY(buttonGroup->IsVisible());
+ QVERIFY(statusPane->IsVisible());
+
+ widget.showFullScreen();
+ widget.showNormal();
+ QCOMPARE(widget.geometry(), normalGeometry);
+ QVERIFY(buttonGroup->IsVisible());
+ QVERIFY(statusPane->IsVisible());
+
+ widget.showMinimized();
+ widget.showNormal();
+ QCOMPARE(widget.geometry(), normalGeometry);
+ QVERIFY(buttonGroup->IsVisible());
+ QVERIFY(statusPane->IsVisible());
+
+ //Exit
+ widget.showNormal();
+ widget.showMaximized();
+ QCOMPARE(widget.geometry(), maximumScreenGeometry);
+ QVERIFY(buttonGroup->IsVisible());
+ QVERIFY(statusPane->IsVisible());
+
+ widget.showNormal();
+ widget.showFullScreen();
+ QCOMPARE(widget.geometry(), fullScreenGeometry);
+ QVERIFY(!buttonGroup->IsVisible());
+ QVERIFY(!statusPane->IsVisible());
+
+ widget.showNormal();
+ widget.showMinimized();
+ QCOMPARE(widget.geometry(), normalGeometry);
+ QVERIFY(!buttonGroup->IsVisible());
+ QVERIFY(!statusPane->IsVisible());
+}
#endif
class InputContextTester : public QInputContext