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

Method testHidePanel

autotests/integration/inputmethod_test.cpp:277–318  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

275}
276
277void InputMethodTest::testHidePanel()
278{
279 QVERIFY(!kwinApp()->inputMethod()->isActive());
280
281 touchNow();
282 QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
283 QSignalSpy windowRemovedSpy(workspace(), &Workspace::windowRemoved);
284
285 QSignalSpy activateSpy(kwinApp()->inputMethod(), &InputMethod::activeChanged);
286 std::unique_ptr<KWayland::Client::TextInput> textInput(Test::waylandTextInputManager()->createTextInput(Test::waylandSeat()));
287
288 // Create an xdg_toplevel surface and wait for the compositor to catch up.
289 std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
290 std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get()));
291 Window *window = Test::renderAndWaitForShown(surface.get(), QSize(1280, 1024), Qt::red);
292 waylandServer()->seat()->setFocusedTextInputSurface(window->surface());
293
294 textInput->enable(surface.get());
295 QSignalSpy paneladded(kwinApp()->inputMethod(), &KWin::InputMethod::panelChanged);
296 QVERIFY(paneladded.wait());
297 textInput->showInputPanel();
298 QVERIFY(windowAddedSpy.wait());
299
300 QCOMPARE(workspace()->activeWindow(), window);
301
302 QCOMPARE(windowAddedSpy.count(), 2);
303 QVERIFY(activateSpy.count() || activateSpy.wait());
304 QVERIFY(kwinApp()->inputMethod()->isActive());
305
306 auto keyboardWindow = kwinApp()->inputMethod()->panel();
307 auto ipsurface = Test::inputPanelSurface();
308 QVERIFY(keyboardWindow);
309 windowRemovedSpy.clear();
310 delete ipsurface;
311 QVERIFY(kwinApp()->inputMethod()->isVisible());
312 QVERIFY(windowRemovedSpy.count() || windowRemovedSpy.wait());
313 QVERIFY(!kwinApp()->inputMethod()->isVisible());
314
315 // Destroy the test window.
316 shellSurface.reset();
317 QVERIFY(Test::waitForWindowClosed(window));
318}
319
320void InputMethodTest::testUnmapPanel()
321{

Callers

nothing calls this directly

Calls 15

kwinAppFunction · 0.85
workspaceFunction · 0.85
waylandTextInputManagerFunction · 0.85
waylandSeatFunction · 0.85
createSurfaceFunction · 0.85
createXdgToplevelSurfaceFunction · 0.85
waylandServerFunction · 0.85
inputPanelSurfaceFunction · 0.85
waitForWindowClosedFunction · 0.85
inputMethodMethod · 0.80
createTextInputMethod · 0.80

Tested by

no test coverage detected