aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2022-10-18 22:49:11 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-10-19 06:21:50 +0000
commit31b248d39965ee618ff389adcace7bd839afc915 (patch)
tree5f9342a2ad56ec0c610ff05ee8af603c9d84a654
parent0c1349ec33ada6f193bd2d2893ca66b592072f98 (diff)
Attempt to stabilize tst_HoverHandler::deviceCursor
If the test can't send QTabletEvents, we can't use AA_SynthesizeMouseForUnhandledTabletEvents to test device-specific cursor conflicts. There is so little left to test that we might as well skip it. Since QTest::mouseMove() takes a delay argument, we don't need to use qWait(). It should not have resulted in any flakiness, but we might as well remove it to save a little time. Amends 79893e1773be9d04208243cb88c1daf793d830a4 Task-number: QTBUG-107763 Change-Id: Ic83a80f83fe51ad9413e21c5ca48c338d9ca3728 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit e3343eb83f212ea8dea2f2b31859ac39c775f4ba) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp b/tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp
index a32ee13961..9d9faffb2e 100644
--- a/tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp
+++ b/tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp
@@ -481,6 +481,9 @@ void tst_HoverHandler::deviceCursor_data()
void tst_HoverHandler::deviceCursor()
{
+#if !QT_CONFIG(tabletevent)
+ QSKIP("This test depends on QTabletEvent delivery.");
+#endif
QFETCH(bool, synthMouseForTabletEvents);
QFETCH(bool, earlierTabletBeforeMouse);
qApp->setAttribute(Qt::AA_SynthesizeMouseForUnhandledTabletEvents, synthMouseForTabletEvents);
@@ -504,7 +507,6 @@ void tst_HoverHandler::deviceCursor()
QPoint point(100, 100);
-#if QT_CONFIG(tabletevent)
const qint64 stylusId = 1234567890;
QElapsedTimer timer;
timer.start();
@@ -539,13 +541,11 @@ void tst_HoverHandler::deviceCursor()
testStylusDevice(QInputDevice::DeviceType::Airbrush, QPointingDevice::PointerType::Eraser,
Qt::OpenHandCursor, airbrushEraserHandler);
- QTest::qWait(200);
qCDebug(lcPointerTests) << "---- no more tablet events, now we send a mouse move";
-#endif
// move the mouse: the mouse-specific HoverHandler gets to set the cursor only if
- // more than kCursorOverrideTimeout ms have elapsed
- QTest::mouseMove(&window, point);
+ // more than kCursorOverrideTimeout ms have elapsed (100ms)
+ QTest::mouseMove(&window, point, 100);
QTRY_COMPARE(mouseHandler->isHovered(), true);
const bool afterTimeout =
QQuickPointerHandlerPrivate::get(airbrushEraserHandler)->lastEventTime + 100 <
@@ -559,9 +559,7 @@ void tst_HoverHandler::deviceCursor()
QCOMPARE(stylusHandler->isHovered(), false);
QCOMPARE(eraserHandler->isHovered(), false);
QCOMPARE(aibrushHandler->isHovered(), false);
-#if QT_CONFIG(tabletevent)
QCOMPARE(airbrushEraserHandler->isHovered(), true); // there was no fresh QTabletEvent to tell it not to be hovered
-#endif
}
QTEST_MAIN(tst_HoverHandler)