From 76bc2dd3905435fbe72edcc8adce0435cddffca2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Lefebvre?= Date: Mon, 24 Mar 2025 14:26:38 +0100 Subject: [PATCH] Fix tst_QGuiShortcutwithQApplication::windowShortcut flakiness tst_QGuiShortcutWithQApplication::windowShortcut() is flaky on Linux. When it fails, the key event is not properly received properly by the window w as it is not active. Verify that the window w is active before sending the keyEvent, to fix the flakiness on Linux. Change-Id: I98961cdfa9a4f46e83f0725ef1cabc91c0f8b055 Reviewed-by: Axel Spoerl --- tests/auto/gui/kernel/qshortcut/tst_qshortcut.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/gui/kernel/qshortcut/tst_qshortcut.cpp b/tests/auto/gui/kernel/qshortcut/tst_qshortcut.cpp index cb6ebab8003..9e416a279a7 100644 --- a/tests/auto/gui/kernel/qshortcut/tst_qshortcut.cpp +++ b/tests/auto/gui/kernel/qshortcut/tst_qshortcut.cpp @@ -53,6 +53,7 @@ void tst_QShortcut::windowShortcut() QEXPECT_FAIL("", "It failed on Wayland, QTBUG-120334", Abort); QTRY_VERIFY(QGuiApplication::applicationState() == Qt::ApplicationActive); + QTRY_VERIFY(w.isActive()); QTest::sendKeyEvent(QTest::Click, &w, Qt::Key_Q, 'q', Qt::ControlModifier); QTRY_VERIFY(!w.isVisible()); }