From 341ec55c9e8608dcee7cae186f55268648919049 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Mon, 10 May 2021 18:01:41 +0200 Subject: [PATCH] InputMethodTest: Use InputMethod::isActive as a way to check if it's activated Instead of looking for a client, which is a bit more of a hit and miss, since the client doesn't need to be registered when the test expects it to. --- autotests/integration/inputmethod_test.cpp | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/autotests/integration/inputmethod_test.cpp b/autotests/integration/inputmethod_test.cpp index 31dcba2f5e..37713d25bb 100644 --- a/autotests/integration/inputmethod_test.cpp +++ b/autotests/integration/inputmethod_test.cpp @@ -153,10 +153,6 @@ void InputMethodTest::testOpenClose() void InputMethodTest::testEnableDisableV3() { - QSignalSpy clientAddedSpy(workspace(), &Workspace::clientAdded); - QSignalSpy clientRemovedSpy(workspace(), &Workspace::clientRemoved); - QVERIFY(clientAddedSpy.isValid()); - // Create an xdg_toplevel surface and wait for the compositor to catch up. QScopedPointer surface(Test::createSurface()); QScopedPointer shellSurface(Test::createXdgToplevelSurface(surface.data())); @@ -168,21 +164,21 @@ void InputMethodTest::testEnableDisableV3() Test::TextInputV3 *textInputV3 = new Test::TextInputV3(); textInputV3->init(Test::waylandTextInputManagerV3()->get_text_input(*(Test::waylandSeat()))); textInputV3->enable(); - // just enabling the text-input should not show it but rather on commit - QVERIFY(!clientAddedSpy.wait(100)); + QSignalSpy inputMethodActiveSpy(InputMethod::self(), &InputMethod::activeChanged); + // just enabling the text-input should not show it but rather on commit + QVERIFY(!InputMethod::self()->isActive()); textInputV3->commit(); - - QVERIFY(clientAddedSpy.wait()); - AbstractClient *keyboardClient = clientAddedSpy.last().first().value(); - QVERIFY(keyboardClient); - QVERIFY(keyboardClient->isInputMethod()); + QVERIFY(inputMethodActiveSpy.count() || inputMethodActiveSpy.wait()); + QVERIFY(InputMethod::self()->isActive()); // disable text input and ensure that it is not hiding input panel without commit + inputMethodActiveSpy.clear(); + QVERIFY(InputMethod::self()->isActive()); textInputV3->disable(); - QVERIFY(!clientRemovedSpy.wait(100)); textInputV3->commit(); - QVERIFY(clientRemovedSpy.wait()); + QVERIFY(inputMethodActiveSpy.count() || inputMethodActiveSpy.wait()); + QVERIFY(!InputMethod::self()->isActive()); } WAYLANDTEST_MAIN(InputMethodTest)