Merge "Fix tsts_QShortcut::keys on Wayland"

This commit is contained in:
Eskil Abrahamsen Blomfeldt 2021-03-02 09:06:42 +01:00 committed by Qt CI Bot
commit a5573cfbd5
2 changed files with 8 additions and 1 deletions

View File

@ -11,5 +11,6 @@ qt_internal_add_test(tst_qshortcut
..
PUBLIC_LIBRARIES
Qt::Gui
Qt::GuiPrivate
Qt::Widgets
)

View File

@ -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);