| 318 | } |
| 319 | |
| 320 | void 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 | |
| 364 | void InputMethodTest::testReactivateFocus() |
| 365 | { |
nothing calls this directly
no test coverage detected