diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2022-03-07 17:26:10 +0100 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2022-03-08 01:52:32 +0100 |
commit | 3f5a4242646def56538470f3259b5b4bc36f24f2 (patch) | |
tree | 4fa7e8ae057f99f1a89f9be868bd2679bfb39015 | |
parent | e27e3ad54654d89306a87a4a230a33194d101671 (diff) |
Move cursor out of the way before running test
Without this change, the test fails when run twice in a row. Also, skip
the test if we can't move the cursor.
Pick-to: 6.3
Change-Id: Ic45c073007d114fbd7825cedef6761c1e410b4af
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
-rw-r--r-- | tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp index e6dd508202..f2d38d90ed 100644 --- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp +++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp @@ -1060,12 +1060,16 @@ public: // Mouse move related signals for Windows Mobile unavailable void tst_QMenu::task258920_mouseBorder() { + const QRect screenGeometry = QGuiApplication::primaryScreen()->availableGeometry(); Menu258920 menu; + QCursor::setPos(screenGeometry.topLeft()); + if (!QTest::qWaitFor([screenGeometry]{ return QCursor::pos() == screenGeometry.topLeft(); })) + QSKIP("Can't move cursor out of the way"); // For styles which inherit from QWindowsStyle, styleHint(QStyle::SH_Menu_MouseTracking) is true. menu.setMouseTracking(true); QAction *action = menu.addAction("test"); - const QPoint center = QGuiApplication::primaryScreen()->availableGeometry().center(); + const QPoint center = screenGeometry.center(); menu.popup(center); QVERIFY(QTest::qWaitForWindowExposed(&menu)); QRect actionRect = menu.actionGeometry(action); |