summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2020-09-29 15:33:11 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2020-10-02 14:17:44 +0200
commitf51e6552e361c0716f6301b4c5b03b12e8bfe0fe (patch)
treecf4f7e242ba4cebb600b91b7e4e8c7773e56ea48 /tests/auto/gui
parentc3b0828e3bc60a621a7caf3c04eb790811a3dd1b (diff)
End touch->mouse synthesis when the chosen touchpoint is released
During delivery of a TouchBegin event, if no widget accepts it, we begin treating the first touchpoint as a synth-mouse, as before. If a second touchpoint is pressed or released in any order, it's irrelevant: the fake mouse button is released as soon as the first touchpoint is released. This fixes the bug that such a scenario caused the mouse release not to be sent, so that a widget could get "stuck" in pressed state. Done-with: Tang Haixiang <tanghaixiang@uniontech.com> Fixes: QTBUG-86253 Pick-to: 5.15 Change-Id: I7fbbe120539d8ded8ef5e7cf712a27bd69391e02 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'tests/auto/gui')
-rw-r--r--tests/auto/gui/kernel/qwindow/tst_qwindow.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
index 655ba3ac33..602e5a0178 100644
--- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
+++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
@@ -1242,6 +1242,30 @@ void tst_QWindow::touchToMouseTranslation()
// mouse event synthesizing disabled
QTRY_COMPARE(window.mousePressButton, 0);
QTRY_COMPARE(window.mouseReleaseButton, 0);
+
+ points.clear();
+ points.append(tp2);
+ points[0].state = QEventPoint::State::Pressed;
+ QWindowSystemInterface::handleTouchEvent(&window, touchDevice, points);
+ QCoreApplication::processEvents();
+ points.clear();
+ points.append(tp1);
+ points[0].state = QEventPoint::State::Pressed;
+ QWindowSystemInterface::handleTouchEvent(&window, touchDevice, points);
+ QCoreApplication::processEvents();
+ QTRY_COMPARE(window.mousePressButton, 1);
+
+ points.clear();
+ points.append(tp2);
+ points[0].state = QEventPoint::State::Released;
+ QWindowSystemInterface::handleTouchEvent(&window, touchDevice, points);
+ QCoreApplication::processEvents();
+ points.clear();
+ points.append(tp1);
+ points[0].state = QEventPoint::State::Released;
+ QWindowSystemInterface::handleTouchEvent(&window, touchDevice, points);
+ QCoreApplication::processEvents();
+ QTRY_COMPARE(window.mouseReleaseButton, 1);
}
void tst_QWindow::touchToMouseTranslationForDevices()