| 609 | } |
| 610 | |
| 611 | void InputMethodTest::testDisableShowInputPanel() |
| 612 | { |
| 613 | // Create an xdg_toplevel surface and wait for the compositor to catch up. |
| 614 | std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface()); |
| 615 | std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get())); |
| 616 | Window *window = Test::renderAndWaitForShown(surface.get(), QSize(1280, 1024), Qt::red); |
| 617 | QVERIFY(window); |
| 618 | QVERIFY(window->isActive()); |
| 619 | QCOMPARE(window->frameGeometry().size(), QSize(1280, 1024)); |
| 620 | |
| 621 | std::unique_ptr<KWayland::Client::TextInput> textInputV2(Test::waylandTextInputManager()->createTextInput(Test::waylandSeat())); |
| 622 | |
| 623 | QSignalSpy inputMethodActiveSpy(kwinApp()->inputMethod(), &InputMethod::activeChanged); |
| 624 | // just enabling the text-input should not show it but rather on commit |
| 625 | QVERIFY(!kwinApp()->inputMethod()->isActive()); |
| 626 | textInputV2->enable(surface.get()); |
| 627 | QVERIFY(inputMethodActiveSpy.count() || inputMethodActiveSpy.wait()); |
| 628 | QVERIFY(kwinApp()->inputMethod()->isActive()); |
| 629 | |
| 630 | // disable text input and ensure that it is not hiding input panel without commit |
| 631 | inputMethodActiveSpy.clear(); |
| 632 | QVERIFY(kwinApp()->inputMethod()->isActive()); |
| 633 | textInputV2->disable(surface.get()); |
| 634 | QVERIFY(inputMethodActiveSpy.count() || inputMethodActiveSpy.wait()); |
| 635 | QVERIFY(!kwinApp()->inputMethod()->isActive()); |
| 636 | |
| 637 | QSignalSpy requestShowInputPanelSpy(waylandServer()->seat()->textInputV2(), &TextInputV2Interface::requestShowInputPanel); |
| 638 | textInputV2->showInputPanel(); |
| 639 | QVERIFY(requestShowInputPanelSpy.count() || requestShowInputPanelSpy.wait()); |
| 640 | QVERIFY(!kwinApp()->inputMethod()->isActive()); |
| 641 | |
| 642 | shellSurface.reset(); |
| 643 | QVERIFY(Test::waitForWindowClosed(window)); |
| 644 | } |
| 645 | |
| 646 | void InputMethodTest::testModifierForwarding() |
| 647 | { |
nothing calls this directly
no test coverage detected