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.
This commit is contained in:
Xaver Hugl 2022-10-21 21:44:57 +02:00
parent 314b5327b6
commit 7da79f5ec4

View file

@ -129,19 +129,18 @@ void InputMethodTest::testOpenClose()
QSignalSpy frameGeometryChangedSpy(window, &Window::frameGeometryChanged); QSignalSpy frameGeometryChangedSpy(window, &Window::frameGeometryChanged);
QSignalSpy toplevelConfigureRequestedSpy(shellSurface.get(), &Test::XdgToplevel::configureRequested); QSignalSpy toplevelConfigureRequestedSpy(shellSurface.get(), &Test::XdgToplevel::configureRequested);
QSignalSpy surfaceConfigureRequestedSpy(shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested); QSignalSpy surfaceConfigureRequestedSpy(shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested);
QVERIFY(surfaceConfigureRequestedSpy.wait());
std::unique_ptr<TextInput> textInput(Test::waylandTextInputManager()->createTextInput(Test::waylandSeat())); std::unique_ptr<TextInput> textInput(Test::waylandTextInputManager()->createTextInput(Test::waylandSeat()));
QVERIFY(textInput != nullptr); QVERIFY(textInput != nullptr);
textInput->enable(surface.get());
QVERIFY(surfaceConfigureRequestedSpy.wait());
// Show the keyboard // Show the keyboard
touchNow(); touchNow();
QSignalSpy paneladded(kwinApp()->inputMethod(), &KWin::InputMethod::panelChanged); textInput->enable(surface.get());
QVERIFY(paneladded.wait());
textInput->showInputPanel(); textInput->showInputPanel();
QSignalSpy paneladded(kwinApp()->inputMethod(), &KWin::InputMethod::panelChanged);
QVERIFY(windowAddedSpy.wait()); QVERIFY(windowAddedSpy.wait());
QCOMPARE(paneladded.count(), 1);
Window *keyboardClient = windowAddedSpy.last().first().value<Window *>(); Window *keyboardClient = windowAddedSpy.last().first().value<Window *>();
QVERIFY(keyboardClient); QVERIFY(keyboardClient);
@ -164,6 +163,14 @@ void InputMethodTest::testOpenClose()
QCOMPARE(window->frameGeometry().height(), 1024); 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. // Destroy the test window.
shellSurface.reset(); shellSurface.reset();
QVERIFY(Test::waitForWindowDestroyed(window)); QVERIFY(Test::waitForWindowDestroyed(window));