diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2021-03-02 09:06:42 +0100 |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2021-03-15 08:21:40 +0100 |
commit | fe54c879cc76f7143d7eca56c111b8b51288be64 (patch) | |
tree | d7c17eb71d47bb89dde6e459d9de4c7e8f506b03 /tests/auto/widgets | |
parent | 420755edb71267f756df4c61955b910099ec9537 (diff) |
Fix tsts_QShortcut::keys on Wayland
Wayland doesn't support explicit window activation, so the
qWaitForWindowActive() function won't actually wait for the
window to be active.
On platforms like this, we just QTRY_VERIFY() for the window
activation instead.
Task-number: QTBUG-91418
Change-Id: I5f728e6a6bcaac283c026b60e6378b9d5aaf1be5
Reviewed-by: Liang Qi <liang.qi@qt.io>
Diffstat (limited to 'tests/auto/widgets')
-rw-r--r-- | tests/auto/widgets/kernel/qshortcut/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp | 8 |
2 files changed, 8 insertions, 1 deletions
diff --git a/tests/auto/widgets/kernel/qshortcut/CMakeLists.txt b/tests/auto/widgets/kernel/qshortcut/CMakeLists.txt index 06bd2d6ba8..fd97a436d0 100644 --- a/tests/auto/widgets/kernel/qshortcut/CMakeLists.txt +++ b/tests/auto/widgets/kernel/qshortcut/CMakeLists.txt @@ -11,5 +11,6 @@ qt_internal_add_test(tst_qshortcut .. PUBLIC_LIBRARIES Qt::Gui + Qt::GuiPrivate Qt::Widgets ) diff --git a/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp b/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp index 6832f7a05a..1266660cea 100644 --- a/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp +++ b/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp @@ -45,6 +45,9 @@ #include <qshortcut.h> #include <qscreen.h> +#include <QtGui/private/qguiapplication_p.h> +#include <QtGui/qpa/qplatformintegration.h> + QT_BEGIN_NAMESPACE class QMainWindow; class QTextEdit; @@ -1359,7 +1362,10 @@ void tst_QShortcut::keys() QSignalSpy spy(sc, &QShortcut::activated); le.setFocus(); le.show(); - QVERIFY(QTest::qWaitForWindowActive(&le)); + if (QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation)) + QVERIFY(QTest::qWaitForWindowActive(&le)); + else + QTRY_VERIFY(le.windowHandle()->isActive()); QCOMPARE(QApplication::focusWidget(), &le); QTest::keyEvent(QTest::Press, QApplication::focusWidget(), Qt::Key_Enter); |