diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-02-18 11:24:05 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-02-18 11:24:05 (GMT) |
commit | c18beac8163634b48bbf1e7280923e96f5ef0a51 (patch) | |
tree | ae6d5d595d1b46bcaa721efc95c98c97e078d214 /tests/auto/gestures | |
parent | fd3f9dd0f31efeea3aa0ec28b54c70d85712c7ba (diff) | |
parent | eeb121d54e345e92ab74d8c43e07d803a0e144ea (diff) | |
download | Qt-c18beac8163634b48bbf1e7280923e96f5ef0a51.zip Qt-c18beac8163634b48bbf1e7280923e96f5ef0a51.tar.gz Qt-c18beac8163634b48bbf1e7280923e96f5ef0a51.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-1: (62 commits)
Compile.
Remove these friend declarations that aren't necessary in 4.7
Added a new flag to fine-tune gesture propagation policy
AIX has a #define for hz, so undef it
Revert "remove -lz from OPENSSL_LIBS so as to respect qt-zlib"
remove -lz from QT_LFLAGS_PSQL so as to respect qt-zlib
remove -lz from OPENSSL_LIBS so as to respect qt-zlib
Fix compilation with IBM xlC 7:
Fix compilation of Qt Assistant when WebKit isn't built.
Mac: QSystemTrayIcon::DoubleClick and midmouse not working
add test for toDateTime() using QLocale::LongFormat
remove debug info
add test case for QTBUG-7898 that QLocale::toDateTime(QString, FormatType) cannot convert value correctly
fix QTBUG-7898
QNAM HTTP: More micro optimization in QHttpNetworkRequest
QNAM HTTP: Some micro optimization in QHttpNetworkRequest
QNAM HTTP: Trivial optimization
Revert "Optimized QLocale to access system locale on demand."
doc: Added "\sa {QML Basic Types} to each QML basic type page.
Incorrect mouse coordinates used when compressing WM_MOUSEMOVE messages.
...
Diffstat (limited to 'tests/auto/gestures')
-rw-r--r-- | tests/auto/gestures/tst_gestures.cpp | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/tests/auto/gestures/tst_gestures.cpp b/tests/auto/gestures/tst_gestures.cpp index 952136b..e6de590 100644 --- a/tests/auto/gestures/tst_gestures.cpp +++ b/tests/auto/gestures/tst_gestures.cpp @@ -333,6 +333,7 @@ private slots: void unregisterRecognizer(); void autoCancelGestures(); void autoCancelGestures2(); + void graphicsViewParentPropagation(); }; tst_Gestures::tst_Gestures() @@ -698,6 +699,9 @@ public: bool acceptGestureOverride; QSet<Qt::GestureType> ignoredGestures; + QSet<Qt::GestureType> ignoredStartedGestures; + QSet<Qt::GestureType> ignoredUpdatedGestures; + QSet<Qt::GestureType> ignoredFinishedGestures; QRectF size; int instanceNumber; @@ -710,6 +714,9 @@ public: events.clear(); overrideEvents.clear(); ignoredGestures.clear(); + ignoredStartedGestures.clear(); + ignoredUpdatedGestures.clear(); + ignoredFinishedGestures.clear(); } protected: @@ -732,6 +739,24 @@ protected: QGestureEvent *e = static_cast<QGestureEvent *>(event); foreach(Qt::GestureType type, ignoredGestures) e->ignore(e->gesture(type)); + foreach(QGesture *g, e->gestures()) { + switch (g->state()) { + case Qt::GestureStarted: + if (ignoredStartedGestures.contains(g->gestureType())) + e->ignore(g); + break; + case Qt::GestureUpdated: + if (ignoredUpdatedGestures.contains(g->gestureType())) + e->ignore(g); + break; + case Qt::GestureFinished: + if (ignoredFinishedGestures.contains(g->gestureType())) + e->ignore(g); + break; + default: + break; + } + } } else if (event->type() == QEvent::GestureOverride) { ++gestureOverrideEventsReceived; eventsPtr = &overrideEvents; @@ -1471,5 +1496,66 @@ void tst_Gestures::autoCancelGestures2() QCOMPARE(parent->events.all.count(), 2); } +void tst_Gestures::graphicsViewParentPropagation() +{ + QGraphicsScene scene; + QGraphicsView view(&scene); + view.setWindowFlags(Qt::X11BypassWindowManagerHint); + + GestureItem *item0 = new GestureItem("item0"); + scene.addItem(item0); + item0->setPos(0, 0); + item0->grabGesture(CustomGesture::GestureType); + item0->setZValue(1); + + GestureItem *item1 = new GestureItem("item1"); + scene.addItem(item1); + item1->setPos(0, 0); + item1->setZValue(5); + + GestureItem *item1_c1 = new GestureItem("item1_child1"); + item1_c1->setParentItem(item1); + item1_c1->setPos(0, 0); + + GestureItem *item1_c1_c1 = new GestureItem("item1_child1_child1"); + item1_c1_c1->setParentItem(item1_c1); + item1_c1_c1->setPos(0, 0); + + view.show(); + QTest::qWaitForWindowShown(&view); + view.ensureVisible(scene.sceneRect()); + + view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); + item0->grabGesture(CustomGesture::GestureType, Qt::ReceivePartialGestures | Qt::IgnoredGesturesPropagateToParent); + item1->grabGesture(CustomGesture::GestureType, Qt::ReceivePartialGestures | Qt::IgnoredGesturesPropagateToParent); + item1_c1->grabGesture(CustomGesture::GestureType, Qt::IgnoredGesturesPropagateToParent); + item1_c1_c1->grabGesture(CustomGesture::GestureType, Qt::ReceivePartialGestures | Qt::IgnoredGesturesPropagateToParent); + + item0->ignoredUpdatedGestures << CustomGesture::GestureType; + item0->ignoredFinishedGestures << CustomGesture::GestureType; + item1->ignoredUpdatedGestures << CustomGesture::GestureType; + item1->ignoredFinishedGestures << CustomGesture::GestureType; + item1_c1->ignoredUpdatedGestures << CustomGesture::GestureType; + item1_c1->ignoredFinishedGestures << CustomGesture::GestureType; + item1_c1_c1->ignoredUpdatedGestures << CustomGesture::GestureType; + item1_c1_c1->ignoredFinishedGestures << CustomGesture::GestureType; + + static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; + + CustomEvent event; + event.hotSpot = mapToGlobal(QPointF(10, 10), item1_c1, &view); + event.hasHotSpot = true; + sendCustomGesture(&event, item0, &scene); + + QCOMPARE(item1_c1_c1->gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(item1_c1_c1->gestureOverrideEventsReceived, 1); + QCOMPARE(item1_c1->gestureEventsReceived, 0); + QCOMPARE(item1_c1->gestureOverrideEventsReceived, 1); + QCOMPARE(item1->gestureEventsReceived, TotalGestureEventsCount-1); + QCOMPARE(item1->gestureOverrideEventsReceived, 1); + QCOMPARE(item0->gestureEventsReceived, 0); + QCOMPARE(item0->gestureOverrideEventsReceived, 1); +} + QTEST_MAIN(tst_Gestures) #include "tst_gestures.moc" |