diff options
author | Ariya Hidayat <ariya.hidayat@trolltech.com> | 2009-03-16 12:58:02 (GMT) |
---|---|---|
committer | Alexis Menard <alexis.menard@trolltech.com> | 2009-04-07 18:15:25 (GMT) |
commit | 7185361703e2837e4258b18350da791c84f7ef62 (patch) | |
tree | adda5d722138724f852219e3ffad348abb700b0c /tests/auto/qgraphicssceneindex | |
parent | 7b21055e3966ed8620586decaca4c30f9bf0823a (diff) | |
download | Qt-7185361703e2837e4258b18350da791c84f7ef62.zip Qt-7185361703e2837e4258b18350da791c84f7ef62.tar.gz Qt-7185361703e2837e4258b18350da791c84f7ef62.tar.bz2 |
Fixes: Autotest for inserting non-overlapped items in the scene index.
Diffstat (limited to 'tests/auto/qgraphicssceneindex')
-rw-r--r-- | tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp index 9372823..cfe3ef0 100644 --- a/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp +++ b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp @@ -60,6 +60,8 @@ private slots: void sceneRect(); void customIndex_data(); void customIndex(); + void scatteredItems_data(); + void scatteredItems(); private: void common_data(); @@ -116,6 +118,26 @@ void tst_QGraphicsSceneIndex::customIndex() QCOMPARE(scene.items(QRectF(0, 0, 10, 10)).count(), 1); } +void tst_QGraphicsSceneIndex::scatteredItems_data() +{ + common_data(); +} + +void tst_QGraphicsSceneIndex::scatteredItems() +{ + QFETCH(QString, indexMethod); + QGraphicsSceneIndex *index = createIndex(indexMethod); + + QGraphicsScene scene; + scene.setSceneIndex(index); + + for (int i = 0; i < 10; ++i) + scene.addRect(i*50, i*50, 40, 35); + + QCOMPARE(scene.items(QRectF(0, 0, 10, 10)).count(), 1); + QCOMPARE(scene.items(QRectF(0, 0, 1000, 1000)).count(), 10); + QCOMPARE(scene.items(QRectF(-100, -1000, 0, 0)).count(), 0); +} QTEST_MAIN(tst_QGraphicsSceneIndex) #include "tst_qgraphicssceneindex.moc" |