From a6cdf413107a278859c7dbd97592552369b55bcd Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 25 Feb 2021 12:04:09 +0100 Subject: Fix testlib/tst_selftests::keyboard on Wayland MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wayland does not support WindowActivation capability, which will trigger a warning in qWaitForWindowActive(). Since the selftests depend on matching the exact output of the tests, it gets confused by this, even though the tests are passing. So we suppress the warning when the capability is not supported. Change-Id: I1e1f530a7b237183ee4ef123618e868b746ba863 Reviewed-by: Edward Welbourne Reviewed-by: Tor Arne Vestbø --- tests/auto/testlib/selftests/keyboard/tst_keyboard.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests/auto/testlib/selftests') diff --git a/tests/auto/testlib/selftests/keyboard/tst_keyboard.cpp b/tests/auto/testlib/selftests/keyboard/tst_keyboard.cpp index 0f0e90e2cb..069306121c 100644 --- a/tests/auto/testlib/selftests/keyboard/tst_keyboard.cpp +++ b/tests/auto/testlib/selftests/keyboard/tst_keyboard.cpp @@ -28,6 +28,8 @@ #include #include +#include +#include class tst_Keyboard : public QObject { @@ -63,6 +65,15 @@ void tst_Keyboard::keyPressAndRelease() window.show(); window.setGeometry(100, 100, 200, 200); QVERIFY(QTest::qWaitForWindowExposed(&window)); + + if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation)) { + QTest::ignoreMessage(QtWarningMsg, + "qWaitForWindowActive was called on a platform that doesn't support window " + "activation. This means there is an error in the test and it should either " + "check for the WindowActivation platform capability before calling " + "qWaitForWindowActivate, use qWaitForWindowExposed instead, or skip the test. " + "Falling back to qWaitForWindowExposed."); + } QVERIFY(QTest::qWaitForWindowActive(&window)); QTest::keyPress(&window, Qt::Key_A); -- cgit v1.2.3