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>
This commit is contained in:
parent
420755edb7
commit
fe54c879cc
@ -11,5 +11,6 @@ qt_internal_add_test(tst_qshortcut
|
||||
..
|
||||
PUBLIC_LIBRARIES
|
||||
Qt::Gui
|
||||
Qt::GuiPrivate
|
||||
Qt::Widgets
|
||||
)
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user