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

Method testReactivateFocus

autotests/integration/inputmethod_test.cpp:364–402  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

362}
363
364void InputMethodTest::testReactivateFocus()
365{
366 touchNow();
367 QVERIFY(!kwinApp()->inputMethod()->isActive());
368
369 std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
370 std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get()));
371 Window *window = Test::renderAndWaitForShown(surface.get(), QSize(1280, 1024), Qt::red);
372 QVERIFY(window);
373 QVERIFY(window->isActive());
374 QCOMPARE(window->frameGeometry().size(), QSize(1280, 1024));
375
376 // Show the keyboard
377 QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
378 std::unique_ptr<KWayland::Client::TextInput> textInput(Test::waylandTextInputManager()->createTextInput(Test::waylandSeat()));
379 textInput->enable(surface.get());
380 QSignalSpy paneladded(kwinApp()->inputMethod(), &KWin::InputMethod::panelChanged);
381 QVERIFY(paneladded.wait());
382 textInput->showInputPanel();
383 QVERIFY(windowAddedSpy.wait());
384 QVERIFY(kwinApp()->inputMethod()->isActive());
385
386 QSignalSpy activeSpy(kwinApp()->inputMethod(), &InputMethod::activeChanged);
387
388 // Hide keyboard like keyboardToggle button on navigation panel
389 kwinApp()->inputMethod()->setActive(false);
390 activeSpy.wait(200);
391 QVERIFY(!kwinApp()->inputMethod()->isActive());
392
393 // Reactivate
394 textInput->enable(surface.get());
395 textInput->showInputPanel();
396 activeSpy.wait(200);
397 QVERIFY(kwinApp()->inputMethod()->isActive());
398
399 // Destroy the test window
400 shellSurface.reset();
401 QVERIFY(Test::waitForWindowClosed(window));
402}
403
404void InputMethodTest::testSwitchFocusedSurfaces()
405{

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
frameGeometryMethod · 0.80
createTextInputMethod · 0.80
showInputPanelMethod · 0.80
renderAndWaitForShownFunction · 0.70

Tested by

no test coverage detected