diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-09-08 08:45:57 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-09-08 08:49:39 (GMT) |
commit | fa889cf4b80868249c70715275069eb150b597cc (patch) | |
tree | ab98dc0979d7c2874902e7f2a9812843104e1c49 /tests/auto/qstackedlayout | |
parent | deff8fcf0ed060b949c3ec0fa0ec4bd81c253825 (diff) | |
download | Qt-fa889cf4b80868249c70715275069eb150b597cc.zip Qt-fa889cf4b80868249c70715275069eb150b597cc.tar.gz Qt-fa889cf4b80868249c70715275069eb150b597cc.tar.bz2 |
Try to make test more robust.
By using QTRY_{COMPARE,VERIFY} instead of waiting an arbitrary amount of
time waiting for the window manager to do his job.
Also use QApplication::setActiveWindow which seems to be more robust
then QWidget::activateWindow
Diffstat (limited to 'tests/auto/qstackedlayout')
-rw-r--r-- | tests/auto/qstackedlayout/tst_qstackedlayout.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/tests/auto/qstackedlayout/tst_qstackedlayout.cpp b/tests/auto/qstackedlayout/tst_qstackedlayout.cpp index c6a30a5..481ee2c 100644 --- a/tests/auto/qstackedlayout/tst_qstackedlayout.cpp +++ b/tests/auto/qstackedlayout/tst_qstackedlayout.cpp @@ -47,6 +47,8 @@ #include <qwidget.h> #include <QPushButton> +#include "../../shared/util.h" + //TESTED_CLASS= //TESTED_FILES=gui/kernel/qlayout.cpp gui/kernel/qlayout.h @@ -149,7 +151,7 @@ void tst_QStackedLayout::testCase() QStackedLayout onStack(testWidget); QStackedLayout *testLayout = &onStack; testWidget->setLayout(testLayout); - + QSignalSpy spy(testLayout,SIGNAL(currentChanged(int))); // Nothing in layout @@ -350,12 +352,15 @@ void tst_QStackedLayout::keepFocusAfterSetCurrent() stackLayout->setCurrentIndex(0); + testWidget->show(); + QTest::qWait(25); + QApplication::setActiveWindow(testWidget); + edit1->setFocus(); - QTest::qWait(250); edit1->activateWindow(); - QTest::qWait(100); + QTest::qWait(25); - QVERIFY(edit1->hasFocus()); + QTRY_VERIFY(edit1->hasFocus()); stackLayout->setCurrentIndex(1); QVERIFY(!edit1->hasFocus()); |