diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2022-04-08 20:22:10 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2022-04-11 13:44:47 +0200 |
commit | fcc3d346c8aaff74b0054974040d3c1250301563 (patch) | |
tree | 431a7139669d7d7042871c62e923c2277f0822d2 /tests | |
parent | 05f60c329e66fd08a37c260e338c38f74e8191b5 (diff) |
Control in pressDelay Flickable: detect touch release near press pos
When a control is on a Flickable with a pressDelay, any press event from
a touch device will be replayed as a mouse event due to the delay; so it
was known already that we cannot depend on the fact that we got the
first press as a touch event when checking whether the id matches before
accepting it. So we keep the previous pos when it is a synthesized mouse
event, so that we can ensure the release is also accepted. That was in
place already; but now we no longer require that the release position is
identical to the press position: staying within a distance less than the
drag threshold is also ok. Some touchscreens are too sensitive, some
users have shaky hands, so a "tap" gesture may come with some gratuitous
TouchMove events in between the press and the release.
Amends 025f938c1b4676782674d54375e1e4e560e4b6cd
Fixes: QTBUG-102036
Fixes: QTBUG-102037
Task-number: QTBUG-77202
Change-Id: Ic48b0cca2b1c05b36429925f219d75b1b0085f69
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qquickcontrol/tst_qquickcontrol.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/auto/qquickcontrol/tst_qquickcontrol.cpp b/tests/auto/qquickcontrol/tst_qquickcontrol.cpp index c8d34756..df3b31c8 100644 --- a/tests/auto/qquickcontrol/tst_qquickcontrol.cpp +++ b/tests/auto/qquickcontrol/tst_qquickcontrol.cpp @@ -98,9 +98,12 @@ void tst_QQuickControl::flickable() QSignalSpy buttonClickedSpy(button, SIGNAL(clicked())); QVERIFY(buttonClickedSpy.isValid()); - QTest::touchEvent(window, touchDevice.data()).press(0, QPoint(button->width() / 2, button->height() / 2)); + QPoint p(button->width() / 2, button->height() / 2); + QTest::touchEvent(window, touchDevice.data()).press(0, p); QTRY_COMPARE(buttonPressedSpy.count(), 1); - QTest::touchEvent(window, touchDevice.data()).release(0, QPoint(button->width() / 2, button->height() / 2)); + p += QPoint(1, 1); // less than the drag threshold + QTest::touchEvent(window, touchDevice.data()).move(0, p); + QTest::touchEvent(window, touchDevice.data()).release(0, p); QTRY_COMPARE(buttonReleasedSpy.count(), 1); QTRY_COMPARE(buttonClickedSpy.count(), 1); } |