summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-10-15 09:44:01 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-10-15 09:44:01 (GMT)
commit2055fe9eb514b79a34a0c216164cd1a11561be4f (patch)
treec178e828cfdc388667097c3d235c7855b217f6f0
parent9ea66fb4d1e1ad36bcd1a0e4b7e7de348273e8ff (diff)
downloadQt-2055fe9eb514b79a34a0c216164cd1a11561be4f.zip
Qt-2055fe9eb514b79a34a0c216164cd1a11561be4f.tar.gz
Qt-2055fe9eb514b79a34a0c216164cd1a11561be4f.tar.bz2
Stabilize QLineEdit test on X11
-rw-r--r--tests/auto/qlineedit/tst_qlineedit.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp
index 8368114..c676959 100644
--- a/tests/auto/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/qlineedit/tst_qlineedit.cpp
@@ -3304,41 +3304,45 @@ void tst_QLineEdit::task174640_editingFinished()
layout->addWidget(le2);
mw.show();
- QTest::qWait(200);
+ QApplication::setActiveWindow(&mw);
mw.activateWindow();
+ QTest::qWaitForWindowShown(&mw);
QSignalSpy editingFinishedSpy(le1, SIGNAL(editingFinished()));
le1->setFocus();
- QTest::qWait(200);
- QVERIFY(le1->hasFocus());
+ QTest::qWait(20);
+ QTRY_VERIFY(le1->hasFocus());
QCOMPARE(editingFinishedSpy.count(), 0);
le2->setFocus();
- QTest::qWait(200);
- QVERIFY(le2->hasFocus());
+ QTest::qWait(20);
+ QTRY_VERIFY(le2->hasFocus());
QCOMPARE(editingFinishedSpy.count(), 1);
editingFinishedSpy.clear();
le1->setFocus();
- QTest::qWait(200);
- QVERIFY(le1->hasFocus());
+ QTest::qWait(20);
+ QTRY_VERIFY(le1->hasFocus());
QMenu *testMenu1 = new QMenu(le1);
testMenu1->addAction("foo");
testMenu1->addAction("bar");
testMenu1->show();
- QTest::qWait(200);
+ QTest::qWaitForWindowShown(testMenu1);
+ QTest::qWait(20);
mw.activateWindow();
+
delete testMenu1;
QCOMPARE(editingFinishedSpy.count(), 0);
- QVERIFY(le1->hasFocus());
+ QTRY_VERIFY(le1->hasFocus());
QMenu *testMenu2 = new QMenu(le2);
testMenu2->addAction("foo2");
testMenu2->addAction("bar2");
testMenu2->show();
- QTest::qWait(200);
+ QTest::qWaitForWindowShown(testMenu2);
+ QTest::qWait(20);
mw.activateWindow();
delete testMenu2;
QCOMPARE(editingFinishedSpy.count(), 1);