From f5d6022f4ca4af32de2b683dfb9f41173e7c8934 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 22 Sep 2009 18:56:24 +0200 Subject: Stabilize more test --- tests/auto/q3table/tst_q3table.cpp | 2 ++ tests/auto/q3textbrowser/tst_q3textbrowser.cpp | 4 +--- tests/auto/qcombobox/tst_qcombobox.cpp | 3 +++ tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 6 +++--- .../auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp | 13 ++++--------- tests/auto/qgraphicsview/tst_qgraphicsview.cpp | 13 ++++++++----- 6 files changed, 21 insertions(+), 20 deletions(-) diff --git a/tests/auto/q3table/tst_q3table.cpp b/tests/auto/q3table/tst_q3table.cpp index 44b0edb..1fe4412 100644 --- a/tests/auto/q3table/tst_q3table.cpp +++ b/tests/auto/q3table/tst_q3table.cpp @@ -1201,6 +1201,7 @@ void tst_Q3Table::editCheck() EditCheckQ3Table table(10, 10, 0); table.show(); + QTest::qWaitForWindowShown(&table); table.setCurrentCell(0, 0); #ifdef WAITS QTest::qWait(50); @@ -1378,6 +1379,7 @@ void tst_Q3Table::dateTimeEdit() TimeTableItem *ti = new TimeTableItem(testWidget); testWidget->setItem(0, 0, ti); testWidget->show(); + QTest::qWaitForWindowShown(&testWidget); #ifdef WAITS QTest::qWait(50); #endif diff --git a/tests/auto/q3textbrowser/tst_q3textbrowser.cpp b/tests/auto/q3textbrowser/tst_q3textbrowser.cpp index fd67bb0..9a9f55c 100644 --- a/tests/auto/q3textbrowser/tst_q3textbrowser.cpp +++ b/tests/auto/q3textbrowser/tst_q3textbrowser.cpp @@ -84,9 +84,7 @@ void tst_Q3TextBrowser::initTestCase() testWidget->move(QApplication::desktop()->availableGeometry().topLeft()+QPoint(5, 5)); testWidget->show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(testWidget); -#endif + QTest::qWaitForWindowShown(testWidget); qApp->processEvents(); } diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp index 1b1eb1f..b549af6 100644 --- a/tests/auto/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/qcombobox/tst_qcombobox.cpp @@ -1977,11 +1977,14 @@ void tst_QComboBox::task190351_layout() list->addItem(QLatin1String("list") + QString::number(i)); listCombo.show(); + QTest::qWaitForWindowShown(&listCombo); QTRY_VERIFY(listCombo.isVisible()); listCombo.setCurrentIndex(70); listCombo.showPopup(); QTRY_VERIFY(listCombo.view()); + QTest::qWaitForWindowShown(listCombo.view()); QTRY_VERIFY(listCombo.view()->isVisible()); + QApplication::processEvents(); #ifdef QT_BUILD_INTERNAL QFrame *container = qFindChild(&listCombo); diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 6f37b70..b0e4b9d 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -6736,10 +6736,10 @@ void tst_QGraphicsItem::updateCachedItemAfterMove() scene.addItem(tester); QGraphicsView view(&scene); view.show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&view); -#endif + QTest::qWaitForWindowShown(&view); + QTest::qWait(125); + QTRY_VERIFY(tester->repaints > 0); tester->repaints = 0; // Move the item, should not cause repaints diff --git a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp index 32b4420..a289257 100644 --- a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp +++ b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp @@ -1295,9 +1295,7 @@ void tst_QGraphicsProxyWidget::paintEvent() QGraphicsScene scene; QGraphicsView view(&scene); view.show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&view); -#endif + QTest::qWaitForWindowShown(&view); SubQGraphicsProxyWidget proxy; @@ -1306,9 +1304,8 @@ void tst_QGraphicsProxyWidget::paintEvent() //this bug prevents the widget from being updated w->show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(w); -#endif + QTest::qWaitForWindowShown(w); + QTest::qWait(100); proxy.setWidget(w); @@ -2719,9 +2716,7 @@ void tst_QGraphicsProxyWidget::windowOpacity() QGraphicsProxyWidget *proxy = scene.addWidget(widget); proxy->setCacheMode(QGraphicsItem::ItemCoordinateCache); view.show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&view); -#endif + QTest::qWaitForWindowShown(&view); QApplication::sendPostedEvents(); QTest::qWait(100); diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index 41f9660..ae00e34 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -2250,6 +2250,7 @@ void tst_QGraphicsView::viewportUpdateMode2() view.resize(200 + left + right, 200 + top + bottom); view.show(); QTest::qWaitForWindowShown(&view); + QTest::qWait(50); const QRect viewportRect = view.viewport()->rect(); QCOMPARE(viewportRect, QRect(0, 0, 200, 200)); @@ -2911,6 +2912,7 @@ void tst_QGraphicsView::task239729_noViewUpdate() view->show(); QTest::qWaitForWindowShown(view); + QTest::qWait(150); EventSpy spy(view->viewport(), QEvent::Paint); QCOMPARE(spy.count(), 0); @@ -2919,7 +2921,7 @@ void tst_QGraphicsView::task239729_noViewUpdate() QCOMPARE(spy.count(), 0); scene.update(); QTest::qWait(150); - QCOMPARE(spy.count(), 1); + QTRY_COMPARE(spy.count(), 1); delete view; } @@ -3342,7 +3344,7 @@ void tst_QGraphicsView::render() qApp->processEvents(); - QCOMPARE(r1->paints, 1); + QTRY_COMPARE(r1->paints, 1); QCOMPARE(r2->paints, 1); QCOMPARE(r3->paints, 1); QCOMPARE(r4->paints, 1); @@ -3429,14 +3431,15 @@ void tst_QGraphicsView::update() view.resize(200 + left + right, 200 + top + bottom); view.show(); QTest::qWaitForWindowShown(&view); - const QRect viewportRect = view.viewport()->rect(); - QCOMPARE(viewportRect, QRect(0, 0, 200, 200)); -#if defined QT_BUILD_INTERNAL QApplication::setActiveWindow(&view); QTest::qWait(50); QTRY_COMPARE(QApplication::activeWindow(), &view); + const QRect viewportRect = view.viewport()->rect(); + QCOMPARE(viewportRect, QRect(0, 0, 200, 200)); + +#if defined QT_BUILD_INTERNAL const bool intersects = updateRect.intersects(viewportRect); QGraphicsViewPrivate *viewPrivate = static_cast(qt_widget_private(&view)); QCOMPARE(viewPrivate->updateRect(updateRect), intersects); -- cgit v0.12