diff options
author | Rohan McGovern <rohan.mcgovern@nokia.com> | 2009-09-08 05:15:12 (GMT) |
---|---|---|
committer | Rohan McGovern <rohan.mcgovern@nokia.com> | 2009-09-08 05:18:36 (GMT) |
commit | 22e8dd8653281ebf79fc7fc0061b225c8daf2977 (patch) | |
tree | 0eb26b80a664d7b1ff71b8cf6bba9d5b4c45cb3d /tests/auto/qlineedit | |
parent | b74d10c45c3ff21c2d87871aebf0869d45b0f555 (diff) | |
download | Qt-22e8dd8653281ebf79fc7fc0061b225c8daf2977.zip Qt-22e8dd8653281ebf79fc7fc0061b225c8daf2977.tar.gz Qt-22e8dd8653281ebf79fc7fc0061b225c8daf2977.tar.bz2 |
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.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp index 6bbdf5d..47f0730 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")); |