From adea8ea0dd70a0a33d07e9ada1d0823b5fc637ac Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 22 Sep 2009 19:19:51 +0200 Subject: Stabilize some tests --- tests/auto/qmenu/tst_qmenu.cpp | 1 + tests/auto/qprogressbar/tst_qprogressbar.cpp | 14 +++++++------- tests/auto/qwindowsurface/tst_qwindowsurface.cpp | 11 ++++------- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/tests/auto/qmenu/tst_qmenu.cpp b/tests/auto/qmenu/tst_qmenu.cpp index eee5854..a5bac37 100644 --- a/tests/auto/qmenu/tst_qmenu.cpp +++ b/tests/auto/qmenu/tst_qmenu.cpp @@ -806,6 +806,7 @@ void tst_QMenu::task258920_mouseBorder() QAction *action = menu.addAction("test"); menu.popup(QApplication::desktop()->availableGeometry().center()); + QTest::qWaitForWindowShown(&menu); QTest::qWait(100); QRect actionRect = menu.actionGeometry(action); QTest::mouseMove(&menu, actionRect.center()); diff --git a/tests/auto/qprogressbar/tst_qprogressbar.cpp b/tests/auto/qprogressbar/tst_qprogressbar.cpp index 274c28e..ea9798b 100644 --- a/tests/auto/qprogressbar/tst_qprogressbar.cpp +++ b/tests/auto/qprogressbar/tst_qprogressbar.cpp @@ -167,11 +167,12 @@ void tst_QProgressBar::format() bar.setRange(0, 10); bar.setValue(1); bar.show(); + QTest::qWaitForWindowShown(&bar); - QTest::qWait(2000); + QTest::qWait(20); bar.repainted = false; bar.setFormat("%v of %m (%p%)"); - QTest::qWait(2000); + QTest::qWait(20); QVERIFY(bar.repainted); bar.repainted = false; bar.setFormat("%v of %m (%p%)"); @@ -197,15 +198,14 @@ void tst_QProgressBar::setValueRepaint() pbar.setMaximum(10); pbar.setFormat("%v"); pbar.show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&pbar); -#endif + QTest::qWaitForWindowShown(&pbar); + QApplication::processEvents(); for (int i = pbar.minimum(); i < pbar.maximum(); ++i) { pbar.repainted = false; pbar.setValue(i); - QTest::qWait(500); - QVERIFY(pbar.repainted); + QTest::qWait(50); + QTRY_VERIFY(pbar.repainted); } } diff --git a/tests/auto/qwindowsurface/tst_qwindowsurface.cpp b/tests/auto/qwindowsurface/tst_qwindowsurface.cpp index df87a42..2c5ba72 100644 --- a/tests/auto/qwindowsurface/tst_qwindowsurface.cpp +++ b/tests/auto/qwindowsurface/tst_qwindowsurface.cpp @@ -155,11 +155,10 @@ void tst_QWindowSurface::flushOutsidePaintEvent() // prevent custom styles from messing up the background w.setStyle(new QWindowsStyle); w.show(); + QTest::qWaitForWindowShown(&w); QApplication::processEvents(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&w); -#elif defined(Q_WS_QWS) +#if defined(Q_WS_QWS) QApplication::sendPostedEvents(); //for the glib event loop #elif defined(Q_WS_S60) QTest::qWait(5000); @@ -189,9 +188,6 @@ void tst_QWindowSurface::flushOutsidePaintEvent() // the paintEvent() should overwrite the painted rectangle QApplication::processEvents(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&w); -#endif #if defined(Q_WS_QWS) QSKIP("task 176755", SkipAll); @@ -232,8 +228,9 @@ void tst_QWindowSurface::grabWidget() babyWidget.show(); childWidget.show(); parentWidget.show(); + QTest::qWaitForWindowShown(&parentWidget); - QTest::qWait(200); + QTest::qWait(20); QPixmap parentPixmap = parentWidget.windowSurface()->grabWidget(&parentWidget); QPixmap childPixmap = childWidget.windowSurface()->grabWidget(&childWidget); -- cgit v0.12