From d2180e2fc3c56d56cd073a896d8449181ca28136 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 23 Sep 2009 19:48:16 +0200 Subject: Stabilize more test --- tests/auto/qcompleter/tst_qcompleter.cpp | 4 +--- tests/auto/qfiledialog/tst_qfiledialog.cpp | 3 +++ tests/auto/qheaderview/tst_qheaderview.cpp | 3 ++- tests/auto/qmenu/tst_qmenu.cpp | 2 ++ tests/auto/qspinbox/tst_qspinbox.cpp | 2 +- tests/auto/qstyle/tst_qstyle.cpp | 2 +- tests/auto/qtableview/tst_qtableview.cpp | 2 +- tests/auto/qtextbrowser/tst_qtextbrowser.cpp | 4 +--- 8 files changed, 12 insertions(+), 10 deletions(-) diff --git a/tests/auto/qcompleter/tst_qcompleter.cpp b/tests/auto/qcompleter/tst_qcompleter.cpp index 1baae90..f7b9d98 100644 --- a/tests/auto/qcompleter/tst_qcompleter.cpp +++ b/tests/auto/qcompleter/tst_qcompleter.cpp @@ -1011,6 +1011,7 @@ void tst_QCompleter::multipleWidgets() QWidget window; window.show(); QApplication::setActiveWindow(&window); + QApplicaion::qWaitForWindowShown(&window); QTRY_VERIFY(qApp->activeWindow() == &window); QFocusEvent focusIn(QEvent::FocusIn); @@ -1022,9 +1023,6 @@ void tst_QCompleter::multipleWidgets() comboBox->setFocus(); comboBox->show(); window.activateWindow(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&window); -#endif QApplication::setActiveWindow(&window); QTest::qWait(50); QTRY_VERIFY(qApp->focusWidget() == comboBox); diff --git a/tests/auto/qfiledialog/tst_qfiledialog.cpp b/tests/auto/qfiledialog/tst_qfiledialog.cpp index 18875e7..d6225cd 100644 --- a/tests/auto/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/qfiledialog/tst_qfiledialog.cpp @@ -1039,7 +1039,10 @@ void tst_QFiledialog::focus() QNonNativeFileDialog fd; fd.setDirectory(QDir::currentPath()); fd.show(); + QApplication::setActiveWindow(&fd); + QTest::qWaitForWindowShown(&fd); QTRY_COMPARE(fd.isVisible(), true); + QTRY_COMPARE(QApplication::activeWindow(), &fd); qApp->processEvents(); // make sure the tests work with focus follows mouse diff --git a/tests/auto/qheaderview/tst_qheaderview.cpp b/tests/auto/qheaderview/tst_qheaderview.cpp index 0be895b..920231d 100644 --- a/tests/auto/qheaderview/tst_qheaderview.cpp +++ b/tests/auto/qheaderview/tst_qheaderview.cpp @@ -1434,7 +1434,8 @@ void tst_QHeaderView::focusPolicy() widget.show(); widget.setFocus(Qt::OtherFocusReason); - QTest::qWait(100); + QApplication::setActiveWindow(&widget); + QTest::qWaitForWindowShown(&widget); widget.activateWindow(); QTest::qWait(100); diff --git a/tests/auto/qmenu/tst_qmenu.cpp b/tests/auto/qmenu/tst_qmenu.cpp index a5bac37..d7f453e 100644 --- a/tests/auto/qmenu/tst_qmenu.cpp +++ b/tests/auto/qmenu/tst_qmenu.cpp @@ -440,7 +440,9 @@ void tst_QMenu::overrideMenuAction() m->addAction(aQuit); w.show(); + QApplication::setActiveWindow(&w); w.setFocus(); + QTest::qWaitForWindowShown(&w); QTRY_VERIFY(w.hasFocus()); //test of the action inside the menu diff --git a/tests/auto/qspinbox/tst_qspinbox.cpp b/tests/auto/qspinbox/tst_qspinbox.cpp index 80f185a..69347c4 100644 --- a/tests/auto/qspinbox/tst_qspinbox.cpp +++ b/tests/auto/qspinbox/tst_qspinbox.cpp @@ -752,8 +752,8 @@ void tst_QSpinBox::editingFinished() testFocusWidget->show(); QApplication::setActiveWindow(testFocusWidget); + QTest::qWaitForWindowShown(testFocusWidget); box->activateWindow(); - QTest::qWait(100);//qApp->processEvents(); box->setFocus(); QTRY_COMPARE(qApp->focusWidget(), box); diff --git a/tests/auto/qstyle/tst_qstyle.cpp b/tests/auto/qstyle/tst_qstyle.cpp index 8526be1..56776d7 100644 --- a/tests/auto/qstyle/tst_qstyle.cpp +++ b/tests/auto/qstyle/tst_qstyle.cpp @@ -219,7 +219,7 @@ void tst_QStyle::testStyleFactory() foreach (QString styleName , keys) { QStyle *style = QStyleFactory::create(styleName); - QVERIFY(style != 0); + QVERIFY2(style != 0, qPrintable(QString::fromLatin1("Fail to load style '%1'").arg(styleName))); delete style; } } diff --git a/tests/auto/qtableview/tst_qtableview.cpp b/tests/auto/qtableview/tst_qtableview.cpp index ce13d31..f5d5040 100644 --- a/tests/auto/qtableview/tst_qtableview.cpp +++ b/tests/auto/qtableview/tst_qtableview.cpp @@ -2908,11 +2908,11 @@ void tst_QTableView::tabFocus() QLineEdit *edit = new QLineEdit(&window); window.show(); + QApplication::setActiveWindow(&window); QTest::qWaitForWindowShown(&window); window.setFocus(); QTest::qWait(100); window.activateWindow(); - QApplication::setActiveWindow(&window); QTest::qWait(100); qApp->processEvents(); diff --git a/tests/auto/qtextbrowser/tst_qtextbrowser.cpp b/tests/auto/qtextbrowser/tst_qtextbrowser.cpp index 1f06dcf..829d580 100644 --- a/tests/auto/qtextbrowser/tst_qtextbrowser.cpp +++ b/tests/auto/qtextbrowser/tst_qtextbrowser.cpp @@ -63,10 +63,8 @@ class TestBrowser : public QTextBrowser public: inline TestBrowser() : htmlLoadAttempts(0) { show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(this); -#endif QApplication::setActiveWindow(this); + QTest::qWaitForWindowShown(this); activateWindow(); setFocus(); QTest::qWait(50); -- cgit v0.12