From 7da79f5ec4918d525e4e43ca8d88265dfd94e22d Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Fri, 21 Oct 2022 21:44:57 +0200 Subject: [PATCH] autotests/integration: make inputmethodtest more realstic When text input gets enabled, the sequence should be 1. enable 2. request to show the panel 3. panel gets added and shown And showing the panel again after hiding is an important case to cover as well. --- autotests/integration/inputmethod_test.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/autotests/integration/inputmethod_test.cpp b/autotests/integration/inputmethod_test.cpp index 504d1a3484..acd390cb58 100644 --- a/autotests/integration/inputmethod_test.cpp +++ b/autotests/integration/inputmethod_test.cpp @@ -129,19 +129,18 @@ void InputMethodTest::testOpenClose() QSignalSpy frameGeometryChangedSpy(window, &Window::frameGeometryChanged); QSignalSpy toplevelConfigureRequestedSpy(shellSurface.get(), &Test::XdgToplevel::configureRequested); QSignalSpy surfaceConfigureRequestedSpy(shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested); + QVERIFY(surfaceConfigureRequestedSpy.wait()); std::unique_ptr textInput(Test::waylandTextInputManager()->createTextInput(Test::waylandSeat())); - QVERIFY(textInput != nullptr); - textInput->enable(surface.get()); - QVERIFY(surfaceConfigureRequestedSpy.wait()); // Show the keyboard touchNow(); - QSignalSpy paneladded(kwinApp()->inputMethod(), &KWin::InputMethod::panelChanged); - QVERIFY(paneladded.wait()); + textInput->enable(surface.get()); textInput->showInputPanel(); + QSignalSpy paneladded(kwinApp()->inputMethod(), &KWin::InputMethod::panelChanged); QVERIFY(windowAddedSpy.wait()); + QCOMPARE(paneladded.count(), 1); Window *keyboardClient = windowAddedSpy.last().first().value(); QVERIFY(keyboardClient); @@ -164,6 +163,14 @@ void InputMethodTest::testOpenClose() QCOMPARE(window->frameGeometry().height(), 1024); + // show the keyboard again + touchNow(); + textInput->enable(surface.get()); + textInput->showInputPanel(); + + QVERIFY(surfaceConfigureRequestedSpy.wait()); + QVERIFY(keyboardClient->isShown()); + // Destroy the test window. shellSurface.reset(); QVERIFY(Test::waitForWindowDestroyed(window));