aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/pointerhandlers/qquicktaphandler/tst_qquicktaphandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/quick/pointerhandlers/qquicktaphandler/tst_qquicktaphandler.cpp')
-rw-r--r--tests/auto/quick/pointerhandlers/qquicktaphandler/tst_qquicktaphandler.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/auto/quick/pointerhandlers/qquicktaphandler/tst_qquicktaphandler.cpp b/tests/auto/quick/pointerhandlers/qquicktaphandler/tst_qquicktaphandler.cpp
index 187ade58d5..33cea69147 100644
--- a/tests/auto/quick/pointerhandlers/qquicktaphandler/tst_qquicktaphandler.cpp
+++ b/tests/auto/quick/pointerhandlers/qquicktaphandler/tst_qquicktaphandler.cpp
@@ -70,6 +70,7 @@ private slots:
void mouseLongPress();
void buttonsMultiTouch();
void componentUserBehavioralOverride();
+ void rightLongPressIgnoreWheel();
private:
void createView(QScopedPointer<QQuickView> &window, const char *fileName);
@@ -676,6 +677,44 @@ void tst_TapHandler::componentUserBehavioralOverride()
QCOMPARE(userGrabChangedSpy.count(), 2);
}
+void tst_TapHandler::rightLongPressIgnoreWheel()
+{
+ QScopedPointer<QQuickView> windowPtr;
+ createView(windowPtr, "rightTapHandler.qml");
+ QQuickView * window = windowPtr.data();
+
+ QQuickTapHandler *tap = window->rootObject()->findChild<QQuickTapHandler*>();
+ QVERIFY(tap);
+ QSignalSpy tappedSpy(tap, SIGNAL(tapped(QQuickEventPoint *)));
+ QSignalSpy longPressedSpy(tap, SIGNAL(longPressed()));
+ QPoint p1(100, 100);
+
+ // Mouse wheel with ScrollBegin phase (because as soon as two fingers are touching
+ // the trackpad, it will send such an event: QTBUG-71955)
+ {
+ QWheelEvent wheelEvent(p1, p1, QPoint(0, 0), QPoint(0, 0),
+ Qt::NoButton, Qt::NoModifier, Qt::ScrollBegin, false, Qt::MouseEventNotSynthesized);
+ QGuiApplication::sendEvent(window, &wheelEvent);
+ }
+
+ // Press
+ QTest::mousePress(window, Qt::RightButton, Qt::NoModifier, p1);
+ QTRY_COMPARE(tap->isPressed(), true);
+
+ // Mouse wheel ScrollEnd phase
+ QWheelEvent wheelEvent(p1, p1, QPoint(0, 0), QPoint(0, 0),
+ Qt::NoButton, Qt::NoModifier, Qt::ScrollEnd, false, Qt::MouseEventNotSynthesized);
+ QGuiApplication::sendEvent(window, &wheelEvent);
+ QTRY_COMPARE(longPressedSpy.count(), 1);
+ QCOMPARE(tap->isPressed(), true);
+ QCOMPARE(tappedSpy.count(), 0);
+
+ // Release
+ QTest::mouseRelease(window, Qt::RightButton, Qt::NoModifier, p1, 500);
+ QTRY_COMPARE(tap->isPressed(), false);
+ QCOMPARE(tappedSpy.count(), 0);
+}
+
QTEST_MAIN(tst_TapHandler)
#include "tst_qquicktaphandler.moc"