summaryrefslogtreecommitdiffstats
path: root/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
diff options
context:
space:
mode:
authorAlexis Menard <alexis.menard@nokia.com>2010-03-25 06:00:55 (GMT)
committerAlexis Menard <alexis.menard@nokia.com>2010-03-25 06:00:55 (GMT)
commit32b5fdfabf3158c7b03d1011f4551a45371b27e3 (patch)
tree0339732e5529917a52eb7ff86e6209c262ab7032 /tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
parentd373f8b8ee0a5841bcdb264b0b01b262c15e7f89 (diff)
parenta4f0b174dd7d6eb837915d9d99b2067b8cb00187 (diff)
downloadQt-32b5fdfabf3158c7b03d1011f4551a45371b27e3.zip
Qt-32b5fdfabf3158c7b03d1011f4551a45371b27e3.tar.gz
Qt-32b5fdfabf3158c7b03d1011f4551a45371b27e3.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt into 4.7
Conflicts: mkspecs/common/symbian/symbian.conf qmake/generators/symbian/symmake.cpp src/3rdparty/webkit/WebCore/WebCore.pro
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 92a7f2e..f4fdacc 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;
@@ -10083,5 +10084,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"