From 2c6821fdcac8b087bced28d38f16bdd9bca92bcc Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Wed, 19 Jan 2022 02:52:44 +0100 Subject: [PATCH] autotests: Fix InputMethodTest We now will only be getting the input method panel when there's an enabled surface. --- autotests/integration/inputmethod_test.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/autotests/integration/inputmethod_test.cpp b/autotests/integration/inputmethod_test.cpp index b367cfb9c1..649e3b1a38 100644 --- a/autotests/integration/inputmethod_test.cpp +++ b/autotests/integration/inputmethod_test.cpp @@ -256,14 +256,13 @@ void InputMethodTest::testHidePanel() { QVERIFY(!InputMethod::self()->isActive()); + touchNow(); QSignalSpy clientAddedSpy(workspace(), &Workspace::clientAdded); QSignalSpy clientRemovedSpy(workspace(), &Workspace::clientRemoved); QVERIFY(clientAddedSpy.isValid()); QSignalSpy activateSpy(InputMethod::self(), &InputMethod::activeChanged); QScopedPointer textInput(Test::waylandTextInputManager()->createTextInput(Test::waylandSeat())); - textInput->showInputPanel(); - QVERIFY(clientAddedSpy.wait()); // Create an xdg_toplevel surface and wait for the compositor to catch up. QScopedPointer surface(Test::createSurface()); @@ -271,6 +270,10 @@ void InputMethodTest::testHidePanel() AbstractClient *client = Test::renderAndWaitForShown(surface.data(), QSize(1280, 1024), Qt::red); waylandServer()->seat()->setFocusedTextInputSurface(client->surface()); + textInput->enable(surface.get()); + textInput->showInputPanel(); + QVERIFY(clientAddedSpy.wait()); + QCOMPARE(workspace()->activeClient(), client); QCOMPARE(clientAddedSpy.count(), 2); @@ -294,6 +297,7 @@ void InputMethodTest::testHidePanel() void InputMethodTest::testSwitchFocusedSurfaces() { + touchNow(); QVERIFY(!InputMethod::self()->isActive()); QSignalSpy clientAddedSpy(workspace(), &Workspace::clientAdded); @@ -302,8 +306,6 @@ void InputMethodTest::testSwitchFocusedSurfaces() QSignalSpy activateSpy(InputMethod::self(), &InputMethod::activeChanged); QScopedPointer textInput(Test::waylandTextInputManager()->createTextInput(Test::waylandSeat())); - textInput->showInputPanel(); - QVERIFY(clientAddedSpy.wait(10000)); QVector clients; QVector surfaces; @@ -317,10 +319,9 @@ void InputMethodTest::testSwitchFocusedSurfaces() surfaces += surface; toplevels += shellSurface; } + QCOMPARE(clientAddedSpy.count(), 3); waylandServer()->seat()->setFocusedTextInputSurface(clients.constFirst()->surface()); - QCOMPARE(clientAddedSpy.count(), 4); - QVERIFY(activateSpy.count() || activateSpy.wait()); QVERIFY(!InputMethod::self()->isActive()); textInput->enable(surfaces.last()); QVERIFY(!InputMethod::self()->isActive());