aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2022-10-18 23:15:53 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2022-10-19 18:16:34 +0200
commitd475b74d66cd2199e4c9ddf067c15569370b1afa (patch)
treeb0f33552385c073a48dd46b21d35630d31d233c2 /tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp
parent9077368045ab0656ca4a3c58e5a5eabe9f3ef4d6 (diff)
Attempt to stabilize tst_HoverHandler::deviceCursor (part 2)
CI logs tell us that QTRY_COMPARE(mouseHandler->isHovered(), true) has been failing sometimes. It's not supposed to fail, because we are sending a mouse move event that should result in HoverHandler detecting hovering (as opposed to using QCursor::setPos(), which is known for being a more thorough test on window systems that support it, but also not working on some systems). On the hypothesis that this has something to do with timing, avoid checking isHovered() until after we have verified that the mouse-handling HoverHandler has received an event with a timestamp at least 100 ms after the one that went to the last tablet-handling HoverHandler, and only in that case continue with checking hover states and the cursor. And anyway, if it keeps failing, we might at least get the qCDebug line in the logs to be able to check the timestamps. Amends 79893e1773be9d04208243cb88c1daf793d830a4 Pick-to: 6.4 Task-number: QTBUG-107763 Change-Id: Id7c657bfadf7b49ba3440e28d13121c041d38816 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp')
-rw-r--r--tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp b/tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp
index 7cc96f1dad..be1930b6ba 100644
--- a/tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp
+++ b/tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp
@@ -546,13 +546,18 @@ void tst_HoverHandler::deviceCursor()
// move the mouse: the mouse-specific HoverHandler gets to set the cursor only if
// more than kCursorOverrideTimeout ms have elapsed (100ms)
QTest::mouseMove(&window, point, 100);
- QTRY_COMPARE(mouseHandler->isHovered(), true);
+ QTRY_IMPL(mouseHandler->isHovered() == true, 500);
const bool afterTimeout =
QQuickPointerHandlerPrivate::get(airbrushEraserHandler)->lastEventTime + 100 <
QQuickPointerHandlerPrivate::get(mouseHandler)->lastEventTime;
qCDebug(lcPointerTests) << "airbrush handler reacted last time:" << QQuickPointerHandlerPrivate::get(airbrushEraserHandler)->lastEventTime
<< "and the mouse handler reacted at time:" << QQuickPointerHandlerPrivate::get(mouseHandler)->lastEventTime
<< "so > 100 ms have elapsed?" << afterTimeout;
+ if (afterTimeout)
+ QCOMPARE(mouseHandler->isHovered(), true);
+ else
+ QSKIP("Failed to delay mouse move 100ms after the previous tablet event");
+
#if QT_CONFIG(cursor)
QCOMPARE(window.cursor().shape(), afterTimeout ? Qt::IBeamCursor : Qt::OpenHandCursor);
#endif