summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorAlexis Menard <alexis.menard@nokia.com>2009-12-03 09:54:58 (GMT)
committerAlexis Menard <alexis.menard@nokia.com>2009-12-03 09:56:45 (GMT)
commit5cab18e5e3946b0dc14d678c8a317522d25e3003 (patch)
tree61c7c56d5f090cf83c78224824bdb1dbe7ea9818 /tests/auto
parentae2c3a96519ede274bd3a67566f007b1cba24ff8 (diff)
downloadQt-5cab18e5e3946b0dc14d678c8a317522d25e3003.zip
Qt-5cab18e5e3946b0dc14d678c8a317522d25e3003.tar.gz
Qt-5cab18e5e3946b0dc14d678c8a317522d25e3003.tar.bz2
Add extra auto-test for topLevel list corruption.
Adding auto-tests make QA people happy. Reviewed-by:TrustMe
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
index a8017ff..38abc3d 100644
--- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -4211,6 +4211,42 @@ void tst_QGraphicsScene::siblingIndexAlwaysValid()
//If there are in the list that's bad, we crash...
QVERIFY(!QGraphicsScenePrivate::get(&scene)->topLevelItems.contains(static_cast<QGraphicsItem *>(child)));
+ //Other case
+ QGraphicsScene scene2;
+ // works with bsp tree index
+ scene2.setItemIndexMethod(QGraphicsScene::NoIndex);
+
+ QGraphicsView view2(&scene2);
+
+ // first add the blue rect
+ QGraphicsRectItem* const item1 = new QGraphicsRectItem(QRect( 10, 10, 10, 10 ));
+ item1->setPen(QColor(Qt::blue));
+ item1->setBrush(Qt::blue);
+ scene2.addItem(item1);
+
+ // then add the red rect
+ QGraphicsRectItem* const item2 = new QGraphicsRectItem(5, 5, 10, 10);
+ item2->setPen(QColor(Qt::red));
+ item2->setBrush(Qt::red);
+ scene2.addItem(item2);
+
+ // now the blue one is visible on top of the red one -> swap them (important for the bug)
+ item1->setZValue(1.0);
+ item2->setZValue(0.0);
+
+ view2.show();
+
+ // handle events as a real life app would do
+ QApplication::processEvents();
+
+ // now delete the red rect
+ delete item2;
+
+ // handle events as a real life app would do
+ QApplication::processEvents();
+
+ //We should not crash
+
}
void tst_QGraphicsScene::taskQTBUG_5904_crashWithDeviceCoordinateCache()