diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-12-04 18:33:53 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-12-04 18:33:53 (GMT) |
commit | 1bb5999cdca0a70df3f96d596c83c3cf7c97c5fd (patch) | |
tree | 71c03d33b9c36fb78a6bc11b8994720ca3823f79 /tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp | |
parent | 696099f8e3179787114df40d6ce6fef97bfa33dc (diff) | |
parent | c0b81480b2909b18ac15bdd124a562ae005c2f41 (diff) | |
download | Qt-1bb5999cdca0a70df3f96d596c83c3cf7c97c5fd.zip Qt-1bb5999cdca0a70df3f96d596c83c3cf7c97c5fd.tar.gz Qt-1bb5999cdca0a70df3f96d596c83c3cf7c97c5fd.tar.bz2 |
Merge commit 'c0b81480b2909b18ac15bdd124a562ae005c2f41' into origin-4.6
Diffstat (limited to 'tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp')
-rw-r--r-- | tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp | 36 |
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() |