diff options
author | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-10-12 11:43:12 (GMT) |
---|---|---|
committer | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-10-12 11:45:12 (GMT) |
commit | c214bde28cc346967471023a8046fd3866407277 (patch) | |
tree | 271d3f1b4bf186fdd153e5b856c823ce754e8f95 /tests/auto/gestures | |
parent | 4e44097d77a55b88e2664fc0043203278a9a2d20 (diff) | |
download | Qt-c214bde28cc346967471023a8046fd3866407277.zip Qt-c214bde28cc346967471023a8046fd3866407277.tar.gz Qt-c214bde28cc346967471023a8046fd3866407277.tar.bz2 |
Added support for singleshot gestures.
When a gesture recognizer claims to be in Finished state without any
Triggered states before, that probably means that was a singleshot
gesture that has started and ended right away, so we'll send a fake
gesture in the GestureStarted state.
Reviewed-by: trustme
Diffstat (limited to 'tests/auto/gestures')
-rw-r--r-- | tests/auto/gestures/tst_gestures.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/tests/auto/gestures/tst_gestures.cpp b/tests/auto/gestures/tst_gestures.cpp index 0a6caff..46ed45e 100644 --- a/tests/auto/gestures/tst_gestures.cpp +++ b/tests/auto/gestures/tst_gestures.cpp @@ -474,17 +474,20 @@ void tst_Gestures::finishedWithoutStarted() { GestureWidget widget; widget.grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); + // the gesture will claim it finished, but it was never started. CustomEvent ev; - QTest::ignoreMessage(QtWarningMsg, "QGestureManager::filterEvent: some gestures were finished even though they've never started"); - for (int i = CustomGesture::SerialFinishedThreshold; - i < CustomGesture::SerialFinishedThreshold+1; ++i) { - ev.serial = i; - QApplication::sendEvent(&widget, &ev); - } + ev.serial = CustomGesture::SerialFinishedThreshold; + QApplication::sendEvent(&widget, &ev); - QCOMPARE(widget.gestureEventsReceived, 0); + QCOMPARE(widget.customEventsReceived, 1); + QCOMPARE(widget.gestureEventsReceived, 2); QCOMPARE(widget.gestureOverrideEventsReceived, 0); + QCOMPARE(widget.events.all.size(), 2); + QCOMPARE(widget.events.started.size(), 1); + QCOMPARE(widget.events.updated.size(), 0); + QCOMPARE(widget.events.finished.size(), 1); + QCOMPARE(widget.events.canceled.size(), 0); } void tst_Gestures::unknownGesture() |