summaryrefslogtreecommitdiffstats
path: root/tests/auto/qstackedlayout/tst_qstackedlayout.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qstackedlayout/tst_qstackedlayout.cpp')
-rw-r--r--tests/auto/qstackedlayout/tst_qstackedlayout.cpp13
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());