summaryrefslogtreecommitdiffstats
path: root/tests/auto/qgraphicsitem
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qgraphicsitem')
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp31
1 files changed, 30 insertions, 1 deletions
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index 956faa1..d08e74b 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -62,7 +62,6 @@
#include "../../shared/util.h"
-
//TESTED_CLASS=
//TESTED_FILES=
@@ -307,6 +306,7 @@ private slots:
void task240400_clickOnTextItem();
void task243707_addChildBeforeParent();
void task197802_childrenVisibility();
+ void QTBUG_4233_updateCachedWithSceneRect();
private:
QList<QGraphicsItem *> paintedItems;
@@ -8463,5 +8463,34 @@ void tst_QGraphicsItem::stackBefore()
QCOMPARE(scene.items(QPointF(2, 2), Qt::IntersectsItemBoundingRect, Qt::AscendingOrder), (QList<QGraphicsItem *>() << child2 << child4 << child3 << child1));
}
+void tst_QGraphicsItem::QTBUG_4233_updateCachedWithSceneRect()
+{
+ EventTester *tester = new EventTester;
+ tester->setCacheMode(QGraphicsItem::ItemCoordinateCache);
+
+ QGraphicsScene scene;
+ scene.addItem(tester);
+ scene.setSceneRect(-100, -100, 200, 200); // contains the tester item
+
+ QGraphicsView view(&scene);
+ view.show();
+ QTRY_COMPARE(QApplication::activeWindow(), (QWidget *)&view);
+
+ QCOMPARE(tester->repaints, 1);
+
+ scene.update(); // triggers "updateAll" optimization
+ qApp->processEvents();
+ qApp->processEvents(); // in 4.6 only one processEvents is necessary
+
+ QCOMPARE(tester->repaints, 1);
+
+ scene.update(); // triggers "updateAll" optimization
+ tester->update();
+ qApp->processEvents();
+ qApp->processEvents(); // in 4.6 only one processEvents is necessary
+
+ QCOMPARE(tester->repaints, 2);
+}
+
QTEST_MAIN(tst_QGraphicsItem)
#include "tst_qgraphicsitem.moc"