From d16b171f1b10deaaa11ae19d4f719344965e9c95 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 26 Feb 2021 13:06:33 +0100 Subject: Make tst_shortcut pass on Wayland There was a race condition in the test, since the window might be exposed before the event to activate the application has been received. And the short cut is not triggered before the application is active, which means it could just be discarded and the window would never be closed. This happened consistently when testing on Wayland. Task-number: QTBUG-91418 Change-Id: I40cb143985175f5f2b5405e9502a48475c93074a Reviewed-by: Paul Olav Tvete --- tests/auto/gui/kernel/qshortcut/tst_qshortcut.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'tests/auto/gui/kernel/qshortcut/tst_qshortcut.cpp') diff --git a/tests/auto/gui/kernel/qshortcut/tst_qshortcut.cpp b/tests/auto/gui/kernel/qshortcut/tst_qshortcut.cpp index fc230f98e2..777f486263 100644 --- a/tests/auto/gui/kernel/qshortcut/tst_qshortcut.cpp +++ b/tests/auto/gui/kernel/qshortcut/tst_qshortcut.cpp @@ -74,6 +74,7 @@ void tst_QShortcut::trigger() new QShortcut(Qt::CTRL | Qt::Key_Q, &w, SLOT(close())); w.show(); QVERIFY(QTest::qWaitForWindowExposed(&w)); + QTRY_VERIFY(QGuiApplication::applicationState() == Qt::ApplicationActive); sendKey(&w, Qt::Key_Q, 'q', Qt::ControlModifier); QTRY_VERIFY(!w.isVisible()); } -- cgit v1.2.3