Skip nestedStopAtBounds when stolen focus cannot be re-gained

The test has been blacklisted on openSUSE Leap due to flakiness.
The flakiness results from system tray messages popping up, stealing
focus from test widgets and interfering with mouse emulation.

This patch adds functionality that tries to regain focus in case of an
interference. The test will time out, if that attempt fails.

Fixes: QTBUG-78153
Change-Id: Ifcab3990166bdf6b6fbc8a8cd4554b22130336c2
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
Axel Spoerl 2022-10-18 10:48:22 +02:00
parent bc528a0770
commit b8791806a3
2 changed files with 6 additions and 5 deletions

View File

@ -2,10 +2,6 @@
[pressAndHold]
macos ci
# QTBUG-78153
[nestedStopAtBounds]
opensuse-leap
# QTBUG-82282
[pressOneAndTapAnother]
opensuse-leap

View File

@ -1857,7 +1857,12 @@ void tst_QQuickMouseArea::nestedStopAtBounds()
QTest::mouseMove(&window, position);
axis += invert ? threshold : -threshold;
QTest::mouseMove(&window, position);
QTRY_COMPARE(outer->drag()->active(), true);
// outer drag will not receive mouse event, when the focus has been stolen.
// => try to regain and time out if it fails.
while (!QTest::qWaitFor([&outer]() { return outer->drag()->active(); }))
window.raise();
QCOMPARE(inner->drag()->active(), false);
QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, position);