From a26a2fb65378ec68360fab7097abfff92ac8c45d Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Mon, 7 Mar 2022 17:26:10 +0100 Subject: Move cursor out of the way before running test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without this change, the test fails when run twice in a row. Also, skip the test if we can't move the cursor. Change-Id: Ic45c073007d114fbd7825cedef6761c1e410b4af Reviewed-by: Tor Arne Vestbø (cherry picked from commit 3f5a4242646def56538470f3259b5b4bc36f24f2) Reviewed-by: Qt Cherry-pick Bot --- tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tests') 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); -- cgit v1.2.3