summaryrefslogtreecommitdiffstats
path: root/tests/auto/qlineedit
diff options
context:
space:
mode:
authorRohan McGovern <rohan.mcgovern@nokia.com>2009-09-08 15:15:12 +1000
committerRohan McGovern <rohan.mcgovern@nokia.com>2009-09-08 15:18:36 +1000
commit22e8dd8653281ebf79fc7fc0061b225c8daf2977 (patch)
tree0eb26b80a664d7b1ff71b8cf6bba9d5b4c45cb3d /tests/auto/qlineedit
parentb74d10c45c3ff21c2d87871aebf0869d45b0f555 (diff)
Fixed some focus-related tst_qlineedit failures.
There are many places where the test assumes that a widget gets focus after some fixed timeout. Change it to block until the widget really gets focus.
Diffstat (limited to 'tests/auto/qlineedit')
-rw-r--r--tests/auto/qlineedit/tst_qlineedit.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp
index 6bbdf5d3df..47f0730959 100644
--- a/tests/auto/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/qlineedit/tst_qlineedit.cpp
@@ -343,6 +343,7 @@ void tst_QLineEdit::initTestCase()
// to be safe and avoid failing setFocus with window managers
qt_x11_wait_for_window_manager(testWidget);
#endif
+ QTRY_VERIFY(testWidget->hasFocus());
changed_count = 0;
edited_count = 0;
@@ -1601,8 +1602,7 @@ void tst_QLineEdit::passwordEchoOnEdit()
testWidget->setEchoMode(QLineEdit::PasswordEchoOnEdit);
testWidget->setFocus();
testWidget->raise();
- QTest::qWait(250);
- QVERIFY(testWidget->hasFocus());
+ QTRY_VERIFY(testWidget->hasFocus());
QTest::keyPress(testWidget, '0');
QTest::keyPress(testWidget, '1');
@@ -1614,6 +1614,7 @@ void tst_QLineEdit::passwordEchoOnEdit()
QVERIFY(!testWidget->hasFocus());
QCOMPARE(testWidget->displayText(), QString(5, fillChar));
testWidget->setFocus();
+ QTRY_VERIFY(testWidget->hasFocus());
QCOMPARE(testWidget->displayText(), QString(5, fillChar));
QTest::keyPress(testWidget, '0');
@@ -3397,7 +3398,7 @@ void tst_QLineEdit::task210502_caseInsensitiveInlineCompletion()
qt_x11_wait_for_window_manager(&lineEdit);
#endif
lineEdit.setFocus();
- QTest::qWait(200);
+ QTRY_VERIFY(lineEdit.hasFocus());
QTest::keyPress(&lineEdit, 'a');
QTest::keyPress(&lineEdit, Qt::Key_Return);
QCOMPARE(lineEdit.text(), completion);
@@ -3491,7 +3492,7 @@ void tst_QLineEdit::task241436_passwordEchoOnEditRestoreEchoMode()
testWidget->setEchoMode(QLineEdit::PasswordEchoOnEdit);
testWidget->setFocus();
- QTest::qWait(250);
+ QTRY_VERIFY(testWidget->hasFocus());
QTest::keyPress(testWidget, '0');
QCOMPARE(testWidget->displayText(), QString("0"));