autotests: fix InputMethodTest

This commit is contained in:
Xaver Hugl 2022-09-22 21:49:53 +02:00
parent b4e9443820
commit a056ef3f56
3 changed files with 8 additions and 13 deletions

View file

@ -137,6 +137,8 @@ void InputMethodTest::testOpenClose()
// Show the keyboard
touchNow();
QSignalSpy paneladded(kwinApp()->inputMethod(), &KWin::InputMethod::panelChanged);
QVERIFY(paneladded.wait());
textInput->showInputPanel();
QVERIFY(windowAddedSpy.wait());
@ -212,6 +214,8 @@ void InputMethodTest::testEnableActive()
QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
std::unique_ptr<TextInput> textInput(Test::waylandTextInputManager()->createTextInput(Test::waylandSeat()));
textInput->enable(surface.get());
QSignalSpy paneladded(kwinApp()->inputMethod(), &KWin::InputMethod::panelChanged);
QVERIFY(paneladded.wait());
textInput->showInputPanel();
QVERIFY(windowAddedSpy.wait());
QVERIFY(kwinApp()->inputMethod()->isActive());
@ -247,6 +251,8 @@ void InputMethodTest::testHidePanel()
waylandServer()->seat()->setFocusedTextInputSurface(window->surface());
textInput->enable(surface.get());
QSignalSpy paneladded(kwinApp()->inputMethod(), &KWin::InputMethod::panelChanged);
QVERIFY(paneladded.wait());
textInput->showInputPanel();
QVERIFY(windowAddedSpy.wait());
@ -256,7 +262,7 @@ void InputMethodTest::testHidePanel()
QVERIFY(activateSpy.count() || activateSpy.wait());
QVERIFY(kwinApp()->inputMethod()->isActive());
auto keyboardWindow = Test::inputPanelWindow();
auto keyboardWindow = kwinApp()->inputMethod()->panel();
auto ipsurface = Test::inputPanelSurface();
QVERIFY(keyboardWindow);
windowRemovedSpy.clear();

View file

@ -438,10 +438,6 @@ public:
MockInputMethod(struct wl_registry *registry, int id, int version);
~MockInputMethod();
Window *window() const
{
return m_window;
}
KWayland::Client::Surface *inputPanelSurface() const
{
return m_inputSurface.get();
@ -461,7 +457,6 @@ protected:
private:
std::unique_ptr<KWayland::Client::Surface> m_inputSurface;
QtWayland::zwp_input_panel_surface_v1 *m_inputMethodSurface = nullptr;
QPointer<Window> m_window;
struct ::zwp_input_method_context_v1 *m_context = nullptr;
};
@ -654,7 +649,6 @@ bool lockScreen();
*/
bool unlockScreen();
Window *inputPanelWindow();
MockInputMethod *inputMethod();
KWayland::Client::Surface *inputPanelSurface();

View file

@ -255,11 +255,6 @@ static struct
TextInputManagerV3 *textInputManagerV3 = nullptr;
} s_waylandConnection;
Window *inputPanelWindow()
{
return s_waylandConnection.inputMethodV1->window();
}
MockInputMethod *inputMethod()
{
return s_waylandConnection.inputMethodV1;
@ -286,7 +281,7 @@ void MockInputMethod::zwp_input_method_v1_activate(struct ::zwp_input_method_con
m_inputMethodSurface = Test::createInputPanelSurfaceV1(m_inputSurface.get(), s_waylandConnection.outputs.first());
}
m_context = context;
m_window = Test::renderAndWaitForShown(m_inputSurface.get(), QSize(1280, 400), Qt::blue);
Test::render(m_inputSurface.get(), QSize(1280, 400), Qt::blue);
Q_EMIT activate();
}