summaryrefslogtreecommitdiffstats
path: root/tests/auto/qgraphicssceneindex
diff options
context:
space:
mode:
authorAriya Hidayat <ariya.hidayat@trolltech.com>2009-03-18 14:36:41 (GMT)
committerAlexis Menard <alexis.menard@trolltech.com>2009-04-07 18:21:44 (GMT)
commit875d5f41b1a796d91a4a8edac6c23a7965395470 (patch)
treebc1a1381d6008e92b4c2eef8fb544078ef05bfcf /tests/auto/qgraphicssceneindex
parent5cf43cf62221e3241e33ea25efc7014c07e4d7ad (diff)
downloadQt-875d5f41b1a796d91a4a8edac6c23a7965395470.zip
Qt-875d5f41b1a796d91a4a8edac6c23a7965395470.tar.gz
Qt-875d5f41b1a796d91a4a8edac6c23a7965395470.tar.bz2
Fixes: Autotest the scene index using the new items(QPointF) function.
Diffstat (limited to 'tests/auto/qgraphicssceneindex')
-rw-r--r--tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp
index 9a01cb8..955f2d3 100644
--- a/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp
+++ b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp
@@ -143,6 +143,10 @@ void tst_QGraphicsSceneIndex::scatteredItems()
for (int i = 0; i < 10; ++i)
scene.addRect(i*50, i*50, 40, 35);
+ QCOMPARE(scene.items(QPointF(5, 5)).count(), 1);
+ QCOMPARE(scene.items(QPointF(55, 55)).count(), 1);
+ QCOMPARE(scene.items(QPointF(-100, -100)).count(), 0);
+
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);
@@ -165,6 +169,11 @@ void tst_QGraphicsSceneIndex::overlappedItems()
for (int j = 0; j < 10; ++j)
scene.addRect(i*50, j*50, 200, 200);
+ QCOMPARE(scene.items(QPointF(5, 5)).count(), 1);
+ QCOMPARE(scene.items(QPointF(55, 55)).count(), 4);
+ QCOMPARE(scene.items(QPointF(105, 105)).count(), 9);
+ QCOMPARE(scene.items(QPointF(-100, -100)).count(), 0);
+
QCOMPARE(scene.items(QRectF(0, 0, 1000, 1000)).count(), 100);
QCOMPARE(scene.items(QRectF(-100, -1000, 0, 0)).count(), 0);
QCOMPARE(scene.items(QRectF(0, 0, 200, 200)).count(), 16);
@@ -190,12 +199,17 @@ void tst_QGraphicsSceneIndex::movingItems()
scene.addRect(i*50, i*50, 40, 35);
QGraphicsRectItem *box = scene.addRect(0, 0, 10, 10);
+ QCOMPARE(scene.items(QPointF(5, 5)).count(), 2);
+ QCOMPARE(scene.items(QPointF(-1, -1)).count(), 0);
QCOMPARE(scene.items(QRectF(0, 0, 5, 5)).count(), 2);
box->setPos(10, 10);
+ QCOMPARE(scene.items(QPointF(9, 9)).count(), 1);
+ QCOMPARE(scene.items(QPointF(15, 15)).count(), 2);
QCOMPARE(scene.items(QRectF(0, 0, 1, 1)).count(), 1);
box->setPos(-5, -5);
+ QCOMPARE(scene.items(QPointF(-1, -1)).count(), 1);
QCOMPARE(scene.items(QRectF(0, 0, 1, 1)).count(), 2);
QCOMPARE(scene.items(QRectF(0, 0, 1000, 1000)).count(), 11);