summaryrefslogtreecommitdiffstats
path: root/tests/auto/gestures/tst_gestures.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/gestures/tst_gestures.cpp')
-rw-r--r--tests/auto/gestures/tst_gestures.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/gestures/tst_gestures.cpp b/tests/auto/gestures/tst_gestures.cpp
index 0c09265..09da7d6 100644
--- a/tests/auto/gestures/tst_gestures.cpp
+++ b/tests/auto/gestures/tst_gestures.cpp
@@ -320,6 +320,7 @@ private slots:
void twoGesturesOnDifferentLevel();
void multipleGesturesInTree();
void multipleGesturesInComplexTree();
+ void testMapToScene();
};
tst_Gestures::tst_Gestures()
@@ -1046,5 +1047,30 @@ void tst_Gestures::multipleGesturesInComplexTree()
QCOMPARE(A->events.all.count(SeventhGesture), 0);
}
+void tst_Gestures::testMapToScene()
+{
+ QGesture gesture;
+ QList<QGesture*> list;
+ list << &gesture;
+ QGestureEvent event(list);
+ QCOMPARE(event.mapToScene(gesture.hotSpot()), QPointF()); // not set, can't do much
+
+ QGraphicsScene scene;
+ QGraphicsView view(&scene);
+
+ GestureItem *item0 = new GestureItem;
+ scene.addItem(item0);
+ item0->setPos(14, 16);
+
+ view.show(); // need to show to give it a global coordinate
+ QTest::qWaitForWindowShown(&view);
+ view.ensureVisible(scene.sceneRect());
+
+ QPoint origin = view.mapToGlobal(QPoint());
+ event.setWidget(view.viewport());
+
+ QCOMPARE(event.mapToScene(origin + QPoint(100, 200)), view.mapToScene(QPoint(100, 200)));
+}
+
QTEST_MAIN(tst_Gestures)
#include "tst_gestures.moc"