From c7b091351d6fdf5fda5f38a94af24a395252249f Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 5 Oct 2009 21:44:05 +0200 Subject: Stabilize tests on X11 --- tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 8 +++----- tests/auto/qgraphicsview/tst_qgraphicsview.cpp | 12 +++++------- tests/auto/qlistview/tst_qlistview.cpp | 2 +- tests/auto/qwidget/tst_qwidget.cpp | 10 +++++----- tests/auto/qwindowsurface/tst_qwindowsurface.cpp | 9 ++++++--- 5 files changed, 20 insertions(+), 21 deletions(-) diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index e2e8c5f..edea6b8 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -6444,14 +6444,12 @@ void tst_QGraphicsItem::nestedClipping() QGraphicsView view(&scene); view.setOptimizationFlag(QGraphicsView::IndirectPainting); view.show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&view); -#endif - QTest::qWait(250); + QTest::qWaitForWindowShown(&view); + QTest::qWait(25); QList expected; expected << root << l1 << l2 << l3; - QCOMPARE(scene.drawnItems, expected); + QTRY_COMPARE(scene.drawnItems, expected); QImage image(200, 200, QImage::Format_ARGB32_Premultiplied); image.fill(0); diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index 78fb4f3..921f7f8 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -2932,18 +2932,16 @@ void tst_QGraphicsView::task239729_noViewUpdate() view = new QGraphicsView(&scene); } - view->show(); - QTest::qWaitForWindowShown(view); - QTest::qWait(150); - EventSpy spy(view->viewport(), QEvent::Paint); QCOMPARE(spy.count(), 0); - QTest::qWait(100); - QCOMPARE(spy.count(), 0); + view->show(); + QTest::qWaitForWindowShown(view); + + QTRY_COMPARE(spy.count(), 1); scene.update(); QApplication::processEvents(); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE(spy.count(), 2); delete view; } diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp index cba1776..7599ce6a06 100644 --- a/tests/auto/qlistview/tst_qlistview.cpp +++ b/tests/auto/qlistview/tst_qlistview.cpp @@ -1632,8 +1632,8 @@ void tst_QListView::task254449_draggingItemToNegativeCoordinates() mutable int numPaints; } delegate; - list.setItemDelegate(&delegate); delegate.numPaints = 0; + list.setItemDelegate(&delegate); QApplication::processEvents(); QTRY_VERIFY(delegate.numPaints > 0); //makes sure the layout is done diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index a4e5d88..92658a6 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -8176,7 +8176,7 @@ public: static bool firstTime = true; if (firstTime) - QTimer::singleShot(70, this, SLOT(resizeMe())); + QTimer::singleShot(150, this, SLOT(resizeMe())); firstTime = false; } @@ -8193,7 +8193,7 @@ void tst_QWidget::moveInResizeEvent() testWidget.setGeometry(50, 50, 200, 200); testWidget.show(); QTest::qWaitForWindowShown(&testWidget); - QTest::qWait(120); + QTest::qWait(160); QRect expectedGeometry(100,100, 100, 100); QTRY_COMPARE(testWidget.geometry(), expectedGeometry); @@ -8674,7 +8674,7 @@ void tst_QWidget::setClearAndResizeMask() // Mask child widget with a mask that is bigger than the rect child.setMask(QRegion(0, 0, 1000, 1000)); - QTest::qWait(10); + QTest::qWait(100); #ifdef Q_WS_MAC // Mac always issues a full update when calling setMask, and we cannot force it to not do so. QTRY_COMPARE(child.numPaintEvents, 1); @@ -8686,7 +8686,7 @@ void tst_QWidget::setClearAndResizeMask() // ...and the same applies when clearing the mask. child.clearMask(); - QTest::qWait(10); + QTest::qWait(100); #ifdef Q_WS_MAC // Mac always issues a full update when calling setMask, and we cannot force it to not do so. QTRY_VERIFY(child.numPaintEvents > 0); @@ -8711,7 +8711,7 @@ void tst_QWidget::setClearAndResizeMask() // Disable the size grip on the Mac; otherwise it'll be included when grabbing the window. resizeParent.setFixedSize(resizeParent.size()); resizeChild.show(); - QTest::qWait(30); + QTest::qWait(100); resizeChild.paintedRegion = QRegion(); QTimer::singleShot(100, &resizeChild, SLOT(shrinkMask())); diff --git a/tests/auto/qwindowsurface/tst_qwindowsurface.cpp b/tests/auto/qwindowsurface/tst_qwindowsurface.cpp index 2490a65..25f0f07 100644 --- a/tests/auto/qwindowsurface/tst_qwindowsurface.cpp +++ b/tests/auto/qwindowsurface/tst_qwindowsurface.cpp @@ -51,6 +51,9 @@ #include #include + +#include "../../shared/util.h" + class tst_QWindowSurface : public QObject { Q_OBJECT @@ -238,9 +241,9 @@ void tst_QWindowSurface::grabWidget() parentWidget.show(); QTest::qWaitForWindowShown(&parentWidget); - QTest::qWait(220); - - QPixmap parentPixmap = parentWidget.windowSurface()->grabWidget(&parentWidget); + QPixmap parentPixmap; + QTRY_COMPARE((parentPixmap = parentWidget.windowSurface()->grabWidget(&parentWidget)).size(), + QSize(300,300)); QPixmap childPixmap = childWidget.windowSurface()->grabWidget(&childWidget); QPixmap babyPixmap = babyWidget.windowSurface()->grabWidget(&babyWidget); QPixmap parentSubPixmap = parentWidget.windowSurface()->grabWidget(&parentWidget, QRect(25, 25, 100, 100)); -- cgit v0.12