summaryrefslogtreecommitdiffstats
path: root/tests/auto/qgraphicssceneindex
diff options
context:
space:
mode:
authorBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2009-07-01 15:30:46 (GMT)
committerBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2009-07-01 15:42:44 (GMT)
commit2b9294a2b47c4a193ef83be60a07a3e61b8531b4 (patch)
treed7f81c4ec5abc221462ee8bdafa09c24ce8e7359 /tests/auto/qgraphicssceneindex
parentf4a95e6d6e4c046ac4857cbd54f9488d3b67ce5a (diff)
downloadQt-2b9294a2b47c4a193ef83be60a07a3e61b8531b4.zip
Qt-2b9294a2b47c4a193ef83be60a07a3e61b8531b4.tar.gz
Qt-2b9294a2b47c4a193ef83be60a07a3e61b8531b4.tar.bz2
Fixes broken BSP lookup in QGraphicsSceneBspTreeIndex.
The chip demo was unbelievable slow, so I investigated and found out the bsp always returned almost all items in the tree (40 000 in this particular case). It did so because the tree was initialized with an empty sceneRect. The sceneRect was empty due to a lacking signal-slot connection, resulting in QGraphicsSceneBspTreeIndex::updateSceneRect never being invoked. Auto-test included.
Diffstat (limited to 'tests/auto/qgraphicssceneindex')
-rw-r--r--tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp
index ac21e20..9d0675d 100644
--- a/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp
+++ b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp
@@ -64,6 +64,7 @@ private slots:
void overlappedItems();
void movingItems_data();
void movingItems();
+ void connectedToSceneRectChanged();
private:
void common_data();
@@ -214,6 +215,18 @@ void tst_QGraphicsSceneIndex::movingItems()
QCOMPARE(scene.items(QRectF(0, 0, 1000, 1000)).count(), 11);
}
+void tst_QGraphicsSceneIndex::connectedToSceneRectChanged()
+{
+
+ class MyScene : public QGraphicsScene
+ { public: using QGraphicsScene::receivers; };
+
+ MyScene scene; // Uses QGraphicsSceneBspTreeIndex by default.
+ QCOMPARE(scene.receivers(SIGNAL(sceneRectChanged(const QRectF&))), 1);
+
+ scene.setItemIndexMethod(QGraphicsScene::NoIndex); // QGraphicsSceneLinearIndex
+ QCOMPARE(scene.receivers(SIGNAL(sceneRectChanged(const QRectF&))), 1);
+}
QTEST_MAIN(tst_QGraphicsSceneIndex)
#include "tst_qgraphicssceneindex.moc"