From 5f2489ef78956223d7f52ed02c1e580921883803 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 16 Nov 2009 21:14:19 +0100 Subject: Stabilize tests on X11 --- .../tst_qgraphicsproxywidget.cpp | 23 +++++++++++++--------- tests/auto/qtreeview/tst_qtreeview.cpp | 2 ++ 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp index 9269164..36ee22c 100644 --- a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp +++ b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp @@ -1286,8 +1286,9 @@ void tst_QGraphicsProxyWidget::paintEvent() QGraphicsScene scene; QGraphicsView view(&scene); view.show(); + QApplication::setActiveWindow(&view); QTest::qWaitForWindowShown(&view); - QTest::qWait(70); + QTRY_VERIFY(view.isActiveWindow()); SubQGraphicsProxyWidget proxy; @@ -1298,14 +1299,14 @@ void tst_QGraphicsProxyWidget::paintEvent() w->show(); QTest::qWaitForWindowShown(w); QApplication::processEvents(); - QTest::qWait(100); + QTest::qWait(30); proxy.setWidget(w); scene.addItem(&proxy); //make sure we flush all the paint events - QTest::qWait(70); + QTest::qWait(30); QTRY_VERIFY(proxy.paintCount > 1); - QTest::qWait(110); + QTest::qWait(30); proxy.paintCount = 0; w->update(); @@ -2573,20 +2574,22 @@ void tst_QGraphicsProxyWidget::changingCursor_basic() proxy->setWidget(widget); proxy->show(); scene.addItem(proxy); + QApplication::setActiveWindow(&view); QTest::qWaitForWindowShown(&view); QApplication::processEvents(); + QTRY_VERIFY(view.isActiveWindow()); // in QTest::mouseMove(view.viewport(), view.mapFromScene(proxy->mapToScene(proxy->boundingRect().center()))); sendMouseMove(view.viewport(), view.mapFromScene(proxy->mapToScene(proxy->boundingRect().center()))); - QTest::qWait(125); - QCOMPARE(view.viewport()->cursor().shape(), Qt::IBeamCursor); + QTest::qWait(12); + QTRY_COMPARE(view.viewport()->cursor().shape(), Qt::IBeamCursor); // out QTest::mouseMove(view.viewport(), QPoint(1, 1)); sendMouseMove(view.viewport(), QPoint(1, 1)); - QTest::qWait(125); - QCOMPARE(view.viewport()->cursor().shape(), Qt::ArrowCursor); + QTest::qWait(12); + QTRY_COMPARE(view.viewport()->cursor().shape(), Qt::ArrowCursor); #endif } @@ -2746,10 +2749,12 @@ void tst_QGraphicsProxyWidget::windowOpacity() widget->resize(100, 100); QGraphicsProxyWidget *proxy = scene.addWidget(widget); proxy->setCacheMode(QGraphicsItem::ItemCoordinateCache); + + QApplication::setActiveWindow(&view); view.show(); QTest::qWaitForWindowShown(&view); QApplication::sendPostedEvents(); - QTest::qWait(150); + QTRY_VERIFY(view.isActiveWindow()); qRegisterMetaType >("QList"); QSignalSpy signalSpy(&scene, SIGNAL(changed(const QList &))); diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp index 58f059b..4fc6dd3 100644 --- a/tests/auto/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/qtreeview/tst_qtreeview.cpp @@ -3653,7 +3653,9 @@ void tst_QTreeView::doubleClickedWithSpans() view.setModel(&model); view.setFirstColumnSpanned(0, QModelIndex(), true); view.show(); + QApplication::setActiveWindow(&view); QTest::qWaitForWindowShown(&view); + QTRY_VERIFY(view.isActiveWindow()); QPoint p(10, 10); QCOMPARE(view.indexAt(p), model.index(0, 0)); -- cgit v0.12