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

Method testUnmapPanel

autotests/integration/inputmethod_test.cpp:320–362  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

318}
319
320void InputMethodTest::testUnmapPanel()
321{
322 QVERIFY(!kwinApp()->inputMethod()->isActive());
323
324 touchNow();
325 QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
326
327 QSignalSpy activateSpy(kwinApp()->inputMethod(), &InputMethod::activeChanged);
328 std::unique_ptr<KWayland::Client::TextInput> textInput(Test::waylandTextInputManager()->createTextInput(Test::waylandSeat()));
329
330 // Create an xdg_toplevel surface and wait for the compositor to catch up.
331 std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
332 std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get()));
333 Window *window = Test::renderAndWaitForShown(surface.get(), QSize(1280, 1024), Qt::red);
334 waylandServer()->seat()->setFocusedTextInputSurface(window->surface());
335
336 textInput->enable(surface.get());
337 QSignalSpy paneladded(kwinApp()->inputMethod(), &KWin::InputMethod::panelChanged);
338 QVERIFY(paneladded.wait());
339 textInput->showInputPanel();
340 QVERIFY(windowAddedSpy.wait());
341
342 QCOMPARE(workspace()->activeWindow(), window);
343
344 QCOMPARE(windowAddedSpy.count(), 2);
345 QVERIFY(activateSpy.count() || activateSpy.wait());
346 QVERIFY(kwinApp()->inputMethod()->isActive());
347
348 auto keyboardWindow = kwinApp()->inputMethod()->panel();
349 auto ipsurface = Test::inputPanelSurface();
350 QVERIFY(keyboardWindow);
351 QVERIFY(kwinApp()->inputMethod()->isVisible());
352
353 QSignalSpy panelHiddenSpy(kwinApp()->inputMethod(), &InputMethod::visibleChanged);
354 ipsurface->attachBuffer((wl_buffer *)nullptr);
355 ipsurface->commit();
356 QVERIFY(panelHiddenSpy.count() || panelHiddenSpy.wait());
357 QVERIFY(!kwinApp()->inputMethod()->isVisible());
358
359 // Destroy the test window.
360 shellSurface.reset();
361 QVERIFY(Test::waitForWindowClosed(window));
362}
363
364void InputMethodTest::testReactivateFocus()
365{

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