summaryrefslogtreecommitdiffstats
path: root/tests/auto/gestures/tst_gestures.cpp
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-06-08 16:09:48 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-06-08 16:09:48 (GMT)
commitbaf60d049cc11a54f156b69960706d7304fc4640 (patch)
tree617f63b98d841fea6126c30a026fcfb3d8ee4b02 /tests/auto/gestures/tst_gestures.cpp
parent2ae808a23ce05bf9768ad9df107c16bb0c555ee7 (diff)
parentdcb9b85376718d768f538e19ae231f5e061b7b31 (diff)
downloadQt-baf60d049cc11a54f156b69960706d7304fc4640.zip
Qt-baf60d049cc11a54f156b69960706d7304fc4640.tar.gz
Qt-baf60d049cc11a54f156b69960706d7304fc4640.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1: (29 commits) I10n: Update German translations for 4.7.0 Fix a freetype link failure. Fix configure test for DirectFB Split Symbian bearer plugin into three platform specfic plugins Doc: Fixed whitespace in the other configuration file for zh_CN. Doc: Fixed whitespace in the Simplified Chinese doc configuration. Unbreak Linux build when qendian.h is included before qglobal.h Revert accidental commit of irrelevant stuff. Silly mondays.. Unbreak Linux build when qendian.h is included before qglobal.h Fix QApplication/QWidget to really take ownership of input contexts Added setting a hotspot on standard gestures Fixed GestureOverride event delivery in GraphicsView. add check-ts target to auto-asses translation completeness qt_ja_JP.ts => qt_ja.ts Fix incorrect \since tag XQuery test suite (and others): remove p4 dependency add docu about pixmaps being invalidated on qapp destruction remove somewhat misleading warning about x11 pixmap leak Disabled item view items use incorrect background color Update the mkspec for linux-icc: don't use jump tables in shlibs ...
Diffstat (limited to 'tests/auto/gestures/tst_gestures.cpp')
-rw-r--r--tests/auto/gestures/tst_gestures.cpp66
1 files changed, 66 insertions, 0 deletions
diff --git a/tests/auto/gestures/tst_gestures.cpp b/tests/auto/gestures/tst_gestures.cpp
index 7c1170c..a968520 100644
--- a/tests/auto/gestures/tst_gestures.cpp
+++ b/tests/auto/gestures/tst_gestures.cpp
@@ -334,6 +334,7 @@ private slots:
void gestureOverChild();
void multipleWidgetOnlyGestureInTree();
void conflictingGestures();
+ void conflictingGesturesInGraphicsView();
void finishedWithoutStarted();
void unknownGesture();
void graphicsItemGesture();
@@ -2235,5 +2236,70 @@ void tst_Gestures::testReuseCanceledGestures()
QCOMPARE(target->canceled(), 1);
}
+void tst_Gestures::conflictingGesturesInGraphicsView()
+{
+ QGraphicsScene scene;
+ GraphicsView view(&scene);
+ view.setWindowFlags(Qt::X11BypassWindowManagerHint);
+
+ GestureItem *item1 = new GestureItem("item1");
+ item1->grabGesture(CustomGesture::GestureType);
+ item1->size = QRectF(0, 0, 100, 100);
+ item1->setZValue(2);
+ scene.addItem(item1);
+
+ GestureItem *item2 = new GestureItem("item2");
+ item2->grabGesture(CustomGesture::GestureType);
+ item2->size = QRectF(0, 0, 100, 100);
+ item2->setZValue(5);
+ scene.addItem(item2);
+
+ view.show();
+ QTest::qWaitForWindowShown(&view);
+ view.ensureVisible(scene.sceneRect());
+
+ static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1;
+
+ CustomEvent event;
+
+ // nobody accepts override
+ item1->acceptGestureOverride = false;
+ item2->acceptGestureOverride = false;
+ event.hotSpot = mapToGlobal(item2->boundingRect().center(), item2, &view);
+ event.hasHotSpot = true;
+ sendCustomGesture(&event, item2, &scene);
+ QCOMPARE(item2->gestureOverrideEventsReceived, 1);
+ QCOMPARE(item2->gestureEventsReceived, TotalGestureEventsCount);
+ QCOMPARE(item1->gestureOverrideEventsReceived, 1);
+ QCOMPARE(item1->gestureEventsReceived, 0);
+
+ item1->reset(); item2->reset();
+
+ // the original target accepts override
+ item1->acceptGestureOverride = false;
+ item2->acceptGestureOverride = true;
+ event.hotSpot = mapToGlobal(item2->boundingRect().center(), item2, &view);
+ event.hasHotSpot = true;
+ sendCustomGesture(&event, item2, &scene);
+ QCOMPARE(item2->gestureOverrideEventsReceived, 1);
+ QCOMPARE(item2->gestureEventsReceived, TotalGestureEventsCount);
+ QCOMPARE(item1->gestureOverrideEventsReceived, 0);
+ QCOMPARE(item1->gestureEventsReceived, 0);
+
+ item1->reset(); item2->reset();
+
+ // the item behind accepts override
+ item1->acceptGestureOverride = true;
+ item2->acceptGestureOverride = false;
+ event.hotSpot = mapToGlobal(item2->boundingRect().center(), item2, &view);
+ event.hasHotSpot = true;
+ sendCustomGesture(&event, item2, &scene);
+
+ QCOMPARE(item2->gestureOverrideEventsReceived, 1);
+ QCOMPARE(item2->gestureEventsReceived, 0);
+ QCOMPARE(item1->gestureOverrideEventsReceived, 1);
+ QCOMPARE(item1->gestureEventsReceived, TotalGestureEventsCount);
+}
+
QTEST_MAIN(tst_Gestures)
#include "tst_gestures.moc"