summaryrefslogtreecommitdiffstats
path: root/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp
diff options
context:
space:
mode:
authorBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2010-09-14 12:31:42 (GMT)
committerBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2010-09-14 13:29:36 (GMT)
commitf8cf4296e2f1174610b8e095e9d0a496392fe70a (patch)
tree5d089660652c4e41461def2718ab364db5929f5a /tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp
parent39accdb3bbb86a298665507ca2700b20f56ba64d (diff)
downloadQt-f8cf4296e2f1174610b8e095e9d0a496392fe70a.zip
Qt-f8cf4296e2f1174610b8e095e9d0a496392fe70a.tar.gz
Qt-f8cf4296e2f1174610b8e095e9d0a496392fe70a.tar.bz2
QGraphicsWidget update issues with ItemHasNoContents + effect
Items with the ItemHasNoContents flag set are never drawn so the 'paintedViewBoundingRect' is never cached/updated resulting in updates wrongly being discarded. The solution is to always invalidate the children for such items. Auto test included. Task-number: QT-3803
Diffstat (limited to 'tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp')
-rw-r--r--tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp
index fa6a5ec..e1bfb79 100644
--- a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp
+++ b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp
@@ -76,6 +76,7 @@ private slots:
void dropShadowClipping();
void childrenVisibilityShouldInvalidateCache();
void prepareGeometryChangeInvalidateCache();
+ void itemHasNoContents();
};
void tst_QGraphicsEffect::initTestCase()
@@ -675,6 +676,34 @@ void tst_QGraphicsEffect::prepareGeometryChangeInvalidateCache()
QCOMPARE(item->nbPaint, 0);
}
+void tst_QGraphicsEffect::itemHasNoContents()
+{
+ QGraphicsRectItem *parent = new QGraphicsRectItem;
+ parent->setFlag(QGraphicsItem::ItemHasNoContents);
+
+ MyGraphicsItem *child = new MyGraphicsItem;
+ child->setParentItem(parent);
+ child->resize(200, 200);
+
+ QGraphicsScene scene;
+ scene.addItem(parent);
+
+ QGraphicsView view(&scene);
+ view.show();
+ QTest::qWaitForWindowShown(&view);
+ QTRY_COMPARE(child->nbPaint, 1);
+
+ CustomEffect *effect = new CustomEffect;
+ parent->setGraphicsEffect(effect);
+ QTRY_COMPARE(effect->numRepaints, 1);
+
+ for (int i = 0; i < 3; ++i) {
+ effect->reset();
+ effect->update();
+ QTRY_COMPARE(effect->numRepaints, 1);
+ }
+}
+
QTEST_MAIN(tst_QGraphicsEffect)
#include "tst_qgraphicseffect.moc"