summaryrefslogtreecommitdiffstats
path: root/tests/auto/qgraphicseffect
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qgraphicseffect')
-rw-r--r--tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp
index 985d466..07fa630 100644
--- a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp
+++ b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp
@@ -288,6 +288,32 @@ void tst_QGraphicsEffect::boundingRect2()
// Disable ItemClipsChildrenToShape; effect's bounding rect is no longer clipped.
child->setFlag(QGraphicsItem::ItemClipsChildrenToShape, false);
QCOMPARE(effect->boundingRect(), effect->boundingRectFor(childRect | grandChildRect));
+
+ // Add root item to a scene, do the same tests as above. Results should be the same.
+ QGraphicsScene scene;
+ scene.addItem(root);
+
+ child->setFlag(QGraphicsItem::ItemClipsChildrenToShape);
+ QCOMPARE(effect->boundingRect(), effect->boundingRectFor(childRect));
+
+ child->setFlag(QGraphicsItem::ItemClipsChildrenToShape, false);
+ QCOMPARE(effect->boundingRect(), effect->boundingRectFor(childRect | grandChildRect));
+
+ // Now add the scene to a view, results should be the same.
+ QGraphicsView view(&scene);
+
+ child->setFlag(QGraphicsItem::ItemClipsChildrenToShape);
+ QCOMPARE(effect->boundingRect(), effect->boundingRectFor(childRect));
+
+ child->setFlag(QGraphicsItem::ItemClipsChildrenToShape, false);
+ QCOMPARE(effect->boundingRect(), effect->boundingRectFor(childRect | grandChildRect));
+
+ CustomEffect *childEffect = new CustomEffect;
+ child->setGraphicsEffect(childEffect);
+ QCOMPARE(effect->boundingRect(), effect->boundingRectFor(childEffect->boundingRectFor(childRect | grandChildRect)));
+
+ child->setGraphicsEffect(0);
+ QCOMPARE(effect->boundingRect(), effect->boundingRectFor(childRect | grandChildRect));
}
void tst_QGraphicsEffect::draw()