tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp
changeset 23 89e065397ea6
parent 22 79de32ba3296
child 37 758a864f9613
--- a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp	Fri May 14 16:40:13 2010 +0300
+++ b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp	Thu May 27 13:40:48 2010 +0300
@@ -75,6 +75,7 @@
     void inheritOpacity();
     void dropShadowClipping();
     void childrenVisibilityShouldInvalidateCache();
+    void prepareGeometryChangeInvalidateCache();
 };
 
 void tst_QGraphicsEffect::initTestCase()
@@ -647,6 +648,33 @@
     QCOMPARE(parent.nbPaint, 3);
 }
 
+void tst_QGraphicsEffect::prepareGeometryChangeInvalidateCache()
+{
+    MyGraphicsItem *item = new MyGraphicsItem;
+    item->resize(200, 200);
+
+    QGraphicsScene scene;
+    scene.addItem(item);
+
+    QGraphicsView view(&scene);
+    view.show();
+    QTest::qWaitForWindowShown(&view);
+    QTRY_COMPARE(item->nbPaint, 1);
+
+    item->nbPaint = 0;
+    item->setGraphicsEffect(new QGraphicsDropShadowEffect);
+    QTRY_COMPARE(item->nbPaint, 1);
+
+    item->nbPaint = 0;
+    item->resize(300, 300);
+    QTRY_COMPARE(item->nbPaint, 1);
+
+    item->nbPaint = 0;
+    item->setPos(item->pos() + QPointF(10, 10));
+    QTest::qWait(50);
+    QCOMPARE(item->nbPaint, 0);
+}
+
 QTEST_MAIN(tst_QGraphicsEffect)
 #include "tst_qgraphicseffect.moc"