summaryrefslogtreecommitdiffstats
path: root/tests/auto/qwidget
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-09-23 13:06:36 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-09-23 15:44:04 (GMT)
commitf494b7a9307675f8d6f4c1a6dd0ac07697705164 (patch)
treeff4b058730e8a5fde6ed6de827e77cb31027fd38 /tests/auto/qwidget
parent74ba43ee9b82f46d07d4055af4e9ac7706701cea (diff)
downloadQt-f494b7a9307675f8d6f4c1a6dd0ac07697705164.zip
Qt-f494b7a9307675f8d6f4c1a6dd0ac07697705164.tar.gz
Qt-f494b7a9307675f8d6f4c1a6dd0ac07697705164.tar.bz2
Stabilize tst_QWidget::saveRestoreGeometry
We need to wait for more condition before saving, otherwise what we save is not accurate (and the test fails)
Diffstat (limited to 'tests/auto/qwidget')
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp58
1 files changed, 37 insertions, 21 deletions
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index b7ffd15..811213a 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -2796,10 +2796,12 @@ void tst_QWidget::raise()
QTest::qWait(50);
UpdateWidget *onTop = new UpdateWidget(&topLevel);
+ onTop->reset();
onTop->resize(topLevel.size());
onTop->setAutoFillBackground(true);
onTop->show();
QTest::qWait(50);
+ QTRY_VERIFY(onTop->numPaintEvents > 0);
onTop->reset();
// Reset all the children.
@@ -3072,7 +3074,7 @@ void tst_QWidget::saveRestoreGeometry()
widget.resize(size);
widget.show();
QTest::qWaitForWindowShown(&widget);
- QTest::qWait(10);
+ QApplication::processEvents();
QTRY_COMPARE(widget.pos(), position);
QCOMPARE(widget.size(), size);
@@ -3099,7 +3101,7 @@ void tst_QWidget::saveRestoreGeometry()
QVERIFY(widget.restoreGeometry(savedGeometry));
widget.show();
QTest::qWaitForWindowShown(&widget);
- QTest::qWait(10);
+ QApplication::processEvents();
QTRY_COMPARE(widget.pos(), position);
QCOMPARE(widget.size(), size);
@@ -3114,7 +3116,8 @@ void tst_QWidget::saveRestoreGeometry()
widget.resize(size);
widget.show();
QTest::qWaitForWindowShown(&widget);
- QTest::qWait(10);
+ QTest::qWait(100);
+ QTRY_COMPARE(widget.geometry().size(), size);
QRect geom;
@@ -3122,56 +3125,67 @@ void tst_QWidget::saveRestoreGeometry()
savedGeometry = widget.saveGeometry();
geom = widget.geometry();
widget.setWindowState(widget.windowState() | Qt::WindowFullScreen);
- QTest::qWait(10);
QTRY_VERIFY((widget.windowState() & Qt::WindowFullScreen));
+ QTest::qWait(100);
QVERIFY(widget.restoreGeometry(savedGeometry));
- QTest::qWait(10);
+ QTest::qWait(20);
+ QTRY_VERIFY(!(widget.windowState() & Qt::WindowFullScreen));
QTRY_COMPARE(widget.geometry(), geom);
- QVERIFY(!(widget.windowState() & Qt::WindowFullScreen));
//Restore to full screen
widget.setWindowState(widget.windowState() | Qt::WindowFullScreen);
- QTest::qWait(10);
+ QTest::qWait(20);
QTRY_VERIFY((widget.windowState() & Qt::WindowFullScreen));
+ QTest::qWait(200);
savedGeometry = widget.saveGeometry();
geom = widget.geometry();
widget.setWindowState(widget.windowState() ^ Qt::WindowFullScreen);
- QTest::qWait(10);
- QTRY_VERIFY(widget.restoreGeometry(savedGeometry));
- QTest::qWait(10);
+ QTest::qWait(20);
+ QTRY_VERIFY(!(widget.windowState() & Qt::WindowFullScreen));
+ QTest::qWait(200);
+ QVERIFY(widget.restoreGeometry(savedGeometry));
+ QTest::qWait(20);
+ QTRY_VERIFY((widget.windowState() & Qt::WindowFullScreen));
QTRY_COMPARE(widget.geometry(), geom);
QVERIFY((widget.windowState() & Qt::WindowFullScreen));
widget.setWindowState(widget.windowState() ^ Qt::WindowFullScreen);
- QTest::qWait(10);
+ QTest::qWait(20);
+ QTRY_VERIFY(!(widget.windowState() & Qt::WindowFullScreen));
+ QTest::qWait(20);
//Restore from Maximised
widget.move(position);
widget.resize(size);
- QTest::qWait(10);
+ QTest::qWait(20);
+ QTRY_COMPARE(widget.size(), size);
+ QTest::qWait(100);
savedGeometry = widget.saveGeometry();
geom = widget.geometry();
widget.setWindowState(widget.windowState() | Qt::WindowMaximized);
- QTest::qWait(10);
+ QTest::qWait(20);
QTRY_VERIFY((widget.windowState() & Qt::WindowMaximized));
- QVERIFY(widget.geometry() != geom);
+ QTRY_VERIFY(widget.geometry() != geom);
QVERIFY(widget.restoreGeometry(savedGeometry));
- QTest::qWait(10);
- QCOMPARE(widget.geometry(), geom);
+ QTest::qWait(20);
+ QTRY_COMPARE(widget.geometry(), geom);
QVERIFY(!(widget.windowState() & Qt::WindowMaximized));
//Restore to maximised
widget.setWindowState(widget.windowState() | Qt::WindowMaximized);
- QTest::qWait(10);
+ QTest::qWait(20);
QTRY_VERIFY((widget.windowState() & Qt::WindowMaximized));
+ QTest::qWait(100);
geom = widget.geometry();
savedGeometry = widget.saveGeometry();
widget.setWindowState(widget.windowState() ^ Qt::WindowMaximized);
- QTest::qWait(10);
- QTRY_VERIFY(widget.restoreGeometry(savedGeometry));
- QTest::qWait(10);
+ QTest::qWait(20);
+ QTRY_VERIFY(!(widget.windowState() & Qt::WindowMaximized));
+ QTest::qWait(20);
+ QVERIFY(widget.restoreGeometry(savedGeometry));
+ QTest::qWait(20);
+ QTRY_VERIFY((widget.windowState() & Qt::WindowMaximized));
QTRY_COMPARE(widget.geometry(), geom);
- QVERIFY((widget.windowState() & Qt::WindowMaximized));
}
}
@@ -7431,8 +7445,10 @@ void tst_QWidget::updateWhileMinimized()
// Filter out activation change and focus events to avoid update() calls in QWidget.
widget.updateOnActivationChangeAndFocusIn = false;
widget.show();
+ widget.reset();
QTest::qWaitForWindowShown(&widget);
QApplication::processEvents();
+ QTRY_VERIFY(widget.numPaintEvents > 0);
// Minimize window.
widget.showMinimized();