summaryrefslogtreecommitdiffstats
path: root/tests/auto/qgraphicssceneindex
diff options
context:
space:
mode:
authorAriya Hidayat <ariya.hidayat@trolltech.com>2009-03-16 13:57:05 +0100
committerAlexis Menard <alexis.menard@trolltech.com>2009-04-07 20:14:50 +0200
commit7b21055e3966ed8620586decaca4c30f9bf0823a (patch)
tree3826a0bdbace3e15d793879f89522026ab5c2549 /tests/auto/qgraphicssceneindex
parent14785a965fc475d220ca8592c6ee4a44a0be25f6 (diff)
Fixes: Autotest for changing the index method of a scene.
Diffstat (limited to 'tests/auto/qgraphicssceneindex')
-rw-r--r--tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp
index f2a2bf1f4f..9372823224 100644
--- a/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp
+++ b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp
@@ -41,6 +41,7 @@
#include <QtTest/QtTest>
+#include <QtGui/qgraphicsscene.h>
#include <QtGui/qgraphicssceneindex.h>
#include <private/qgraphicsscene_bsp_p.h>
@@ -57,6 +58,8 @@ public slots:
private slots:
void sceneRect_data();
void sceneRect();
+ void customIndex_data();
+ void customIndex();
private:
void common_data();
@@ -96,5 +99,23 @@ void tst_QGraphicsSceneIndex::sceneRect()
QCOMPARE(index->rect(), QRectF(0, 0, 2000, 2000));
}
+void tst_QGraphicsSceneIndex::customIndex_data()
+{
+ common_data();
+}
+
+void tst_QGraphicsSceneIndex::customIndex()
+{
+ QFETCH(QString, indexMethod);
+ QGraphicsSceneIndex *index = createIndex(indexMethod);
+
+ QGraphicsScene scene;
+ scene.setSceneIndex(index);
+
+ scene.addRect(0, 0, 30, 40);
+ QCOMPARE(scene.items(QRectF(0, 0, 10, 10)).count(), 1);
+}
+
+
QTEST_MAIN(tst_QGraphicsSceneIndex)
#include "tst_qgraphicssceneindex.moc"