summaryrefslogtreecommitdiffstats
path: root/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
diff options
context:
space:
mode:
authorToby Tomkins <toby.tomkins@nokia.com>2010-04-01 00:52:15 (GMT)
committerToby Tomkins <toby.tomkins@nokia.com>2010-04-01 00:52:15 (GMT)
commit49c16ca689d09120587acd235df9085622645d62 (patch)
tree1447b9a9c1bd5d3b0baf9d3663a1233d00874b7d /tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
parent741b75b8e595a26944ba8fca8835463787b02676 (diff)
parenta4f0b174dd7d6eb837915d9d99b2067b8cb00187 (diff)
downloadQt-49c16ca689d09120587acd235df9085622645d62.zip
Qt-49c16ca689d09120587acd235df9085622645d62.tar.gz
Qt-49c16ca689d09120587acd235df9085622645d62.tar.bz2
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt-multimedia-staging into 4.6-multimedia
Diffstat (limited to 'tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp')
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index 9f7db95..9c44b87 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -439,6 +439,7 @@ private slots:
void QTBUG_7714_fullUpdateDiscardingOpacityUpdate2();
void QT_2653_fullUpdateDiscardingOpacityUpdate();
void QT_2649_focusScope();
+ void sortItemsWhileAdding();
private:
QList<QGraphicsItem *> paintedItems;
@@ -9925,5 +9926,38 @@ void tst_QGraphicsItem::QT_2649_focusScope()
delete scene;
}
+class MyGraphicsItemWithItemChange : public QGraphicsWidget
+{
+public:
+ MyGraphicsItemWithItemChange(QGraphicsItem *parent = 0) : QGraphicsWidget(parent)
+ {}
+
+ QVariant itemChange(GraphicsItemChange change, const QVariant &value)
+ {
+ if (change == QGraphicsItem::ItemSceneHasChanged) {
+ foreach (QGraphicsView *view, scene()->views()) {
+ //We trigger a sort of unindexed items in the BSP
+ view->sceneRect();
+ }
+ }
+ return QGraphicsWidget::itemChange(change, value);
+ }
+};
+
+void tst_QGraphicsItem::sortItemsWhileAdding()
+{
+ QGraphicsScene scene;
+ QGraphicsView view(&scene);
+ QGraphicsWidget grandGrandParent;
+ grandGrandParent.resize(200, 200);
+ scene.addItem(&grandGrandParent);
+ QGraphicsWidget grandParent;
+ grandParent.resize(200, 200);
+ QGraphicsWidget parent(&grandParent);
+ parent.resize(200, 200);
+ MyGraphicsItemWithItemChange item(&parent);
+ grandParent.setParentItem(&grandGrandParent);
+}
+
QTEST_MAIN(tst_QGraphicsItem)
#include "tst_qgraphicsitem.moc"