| 362 | } |
| 363 | |
| 364 | void 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 | |
| 404 | void InputMethodTest::testSwitchFocusedSurfaces() |
| 405 | { |
nothing calls this directly
no test coverage detected