diff options
Diffstat (limited to 'tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp')
-rw-r--r-- | tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp index dbd4a23..5dc0c9d 100644 --- a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp +++ b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp @@ -75,6 +75,7 @@ private slots: void inheritOpacity(); void dropShadowClipping(); void childrenVisibilityShouldInvalidateCache(); + void prepareGeometryChangeInvalidateCache(); }; void tst_QGraphicsEffect::initTestCase() @@ -647,6 +648,33 @@ void tst_QGraphicsEffect::childrenVisibilityShouldInvalidateCache() 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" |