From 23e3e59c22579095ffc55d89aaaa822e77652773 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Fri, 11 Nov 2022 08:56:31 +0100 Subject: Stabilize tst_TouchMouse::strayTouchDoesntAutograb Apparently GrabMonitor sees all grab transitions in prior autotests up until strayTouchDoesntAutograb() runs; so it's surprising that it ever passed. Now we reset its state to initial conditions at the beginning. Amends 5ced8ec177fd730676eb854aea559a5f324a39b6 Fixes: QTBUG-108352 Change-Id: I31c398f9cd08b2281ea82054b667437f1151f0bd Reviewed-by: Fabian Kosmale Reviewed-by: Qt CI Bot (cherry picked from commit 195dcc11c7fbb69e78264398fcfa09c63089b606) Reviewed-by: Qt Cherry-pick Bot --- tests/auto/quick/touchmouse/tst_touchmouse.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests') diff --git a/tests/auto/quick/touchmouse/tst_touchmouse.cpp b/tests/auto/quick/touchmouse/tst_touchmouse.cpp index 99b1e0b14f..66dde3e26c 100644 --- a/tests/auto/quick/touchmouse/tst_touchmouse.cpp +++ b/tests/auto/quick/touchmouse/tst_touchmouse.cpp @@ -195,6 +195,14 @@ public: bool fromMouseEvent = false; bool canceled = false; + void reset() + { + exclusiveGrabber = nullptr; + transitionCount = 0; + fromMouseEvent = false; + canceled = false; + } + void onGrabChanged(QObject *grabber, QPointingDevice::GrabTransition transition, const QPointerEvent *event, const QEventPoint &point) { qCDebug(lcTests) << grabber << transition << event << point << point.device(); @@ -1641,6 +1649,7 @@ void tst_TouchMouse::strayTouchDoesntAutograb() // QTBUG-107867 eventItem->acceptMouse = true; QCOMPARE(eventItem->acceptTouchEvents(), false); // the default in Qt 6 QPoint p1(6, 6); + grabMonitor.reset(); // Begin a new touch, that gets converted to a mouse press QTest::touchEvent(&window, device).press(0, p1); -- cgit v1.2.3