MCPcopy Create free account
hub / github.com/KDE/kwin / testEnableActive

Method testEnableActive

autotests/integration/inputmethod_test.cpp:242–275  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

240}
241
242void InputMethodTest::testEnableActive()
243{
244 // This test verifies that enabling text-input twice won't change the active input method status.
245 QVERIFY(!kwinApp()->inputMethod()->isActive());
246
247 // Create an xdg_toplevel surface and wait for the compositor to catch up.
248 std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
249 std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get()));
250 Window *window = Test::renderAndWaitForShown(surface.get(), QSize(1280, 1024), Qt::red);
251 QVERIFY(window);
252 QVERIFY(window->isActive());
253
254 // Show the keyboard
255 QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
256 std::unique_ptr<KWayland::Client::TextInput> textInput(Test::waylandTextInputManager()->createTextInput(Test::waylandSeat()));
257 textInput->enable(surface.get());
258 QSignalSpy paneladded(kwinApp()->inputMethod(), &KWin::InputMethod::panelChanged);
259 QVERIFY(paneladded.wait());
260 textInput->showInputPanel();
261 QVERIFY(windowAddedSpy.wait());
262 QVERIFY(kwinApp()->inputMethod()->isActive());
263
264 // Ask the keyboard to be shown again.
265 QSignalSpy activateSpy(kwinApp()->inputMethod(), &InputMethod::activeChanged);
266 textInput->enable(surface.get());
267 textInput->showInputPanel();
268 activateSpy.wait(200);
269 QVERIFY(activateSpy.isEmpty());
270 QVERIFY(kwinApp()->inputMethod()->isActive());
271
272 // Destroy the test window.
273 shellSurface.reset();
274 QVERIFY(Test::waitForWindowClosed(window));
275}
276
277void InputMethodTest::testHidePanel()
278{

Callers

nothing calls this directly

Calls 15

kwinAppFunction · 0.85
createSurfaceFunction · 0.85
createXdgToplevelSurfaceFunction · 0.85
workspaceFunction · 0.85
waylandTextInputManagerFunction · 0.85
waylandSeatFunction · 0.85
waitForWindowClosedFunction · 0.85
inputMethodMethod · 0.80
createTextInputMethod · 0.80
showInputPanelMethod · 0.80
renderAndWaitForShownFunction · 0.70
QSizeClass · 0.50

Tested by

no test coverage detected