tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp
changeset 22 79de32ba3296
parent 19 fcece45ef507
child 23 89e065397ea6
--- a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp	Mon May 03 13:17:34 2010 +0300
+++ b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp	Fri May 14 16:40:13 2010 +0300
@@ -277,9 +277,8 @@
     // Make sure installing the effect triggers a repaint.
     CustomEffect *effect = new CustomEffect;
     item->setGraphicsEffect(effect);
-    QTest::qWait(50);
-    QCOMPARE(effect->numRepaints, 1);
-    QCOMPARE(item->numRepaints, 1);
+    QTRY_COMPARE(effect->numRepaints, 1);
+    QTRY_COMPARE(item->numRepaints, 1);
 
     // Make sure QPainter* and QStyleOptionGraphicsItem* stays persistent
     // during QGraphicsEffect::draw/QGraphicsItem::paint.
@@ -293,26 +292,23 @@
 
     // Make sure updating the source triggers a repaint.
     item->update();
-    QTest::qWait(50);
-    QCOMPARE(effect->numRepaints, 1);
-    QCOMPARE(item->numRepaints, 1);
+    QTRY_COMPARE(effect->numRepaints, 1);
+    QTRY_COMPARE(item->numRepaints, 1);
     QVERIFY(effect->m_sourceChangedFlags & QGraphicsEffect::SourceInvalidated);
     effect->reset();
     item->reset();
 
     // Make sure changing the effect's bounding rect triggers a repaint.
     effect->setMargin(20);
-    QTest::qWait(50);
-    QCOMPARE(effect->numRepaints, 1);
-    QCOMPARE(item->numRepaints, 1);
+    QTRY_COMPARE(effect->numRepaints, 1);
+    QTRY_COMPARE(item->numRepaints, 1);
     effect->reset();
     item->reset();
 
     // Make sure change the item's bounding rect triggers a repaint.
     item->setRect(0, 0, 50, 50);
-    QTest::qWait(50);
-    QCOMPARE(effect->numRepaints, 1);
-    QCOMPARE(item->numRepaints, 1);
+    QTRY_COMPARE(effect->numRepaints, 1);
+    QTRY_COMPARE(item->numRepaints, 1);
     QVERIFY(effect->m_sourceChangedFlags & QGraphicsEffect::SourceBoundingRectChanged);
     effect->reset();
     item->reset();
@@ -320,8 +316,7 @@
     // Make sure the effect is the one to issue a repaint of the item.
     effect->doNothingInDraw = true;
     item->update();
-    QTest::qWait(50);
-    QCOMPARE(effect->numRepaints, 1);
+    QTRY_COMPARE(effect->numRepaints, 1);
     QCOMPARE(item->numRepaints, 0);
     effect->doNothingInDraw = false;
     effect->reset();
@@ -336,9 +331,8 @@
     item->reset();
 
     effect->setEnabled(true);
-    QTest::qWait(50);
-    QCOMPARE(effect->numRepaints, 1);
-    QCOMPARE(item->numRepaints, 1);
+    QTRY_COMPARE(effect->numRepaints, 1);
+    QTRY_COMPARE(item->numRepaints, 1);
     effect->reset();
     item->reset();
 
@@ -352,8 +346,7 @@
     QPointer<CustomEffect> ptr = effect;
     item->setGraphicsEffect(0);
     QVERIFY(!ptr);
-    QTest::qWait(50);
-    QCOMPARE(item->numRepaints, 1);
+    QTRY_COMPARE(item->numRepaints, 1);
 }
 
 void tst_QGraphicsEffect::opacity()
@@ -515,7 +508,6 @@
     QTRY_VERIFY(effect->repaints >= 1);
 
     item->rotate(180);
-    QTest::qWait(50);
 
     QTRY_VERIFY(effect->repaints >= 2);
 }
@@ -560,9 +552,8 @@
     int numRepaints = item->numRepaints;
 
     item->translate(10, 0);
-    QTest::qWait(50);
 
-    QVERIFY(item->numRepaints == numRepaints);
+    QTRY_VERIFY(item->numRepaints == numRepaints);
 }
 
 void tst_QGraphicsEffect::inheritOpacity()
@@ -588,7 +579,6 @@
     int numRepaints = item->numRepaints;
 
     rectItem->setOpacity(1);
-    QTest::qWait(50);
 
     // item should have been rerendered due to opacity changing
     QTRY_VERIFY(item->numRepaints > numRepaints);