| 240 | } |
| 241 | |
| 242 | void InputMethodTest::testEnableActive() |
| 243 | { |
| 244 | // This test verifies that enabling text-input twice won't change the active input method status. |
| 245 | QVERIFY(!kwinApp()->inputMethod()->isActive()); |
| 246 | |
| 247 | // Create an xdg_toplevel surface and wait for the compositor to catch up. |
| 248 | std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface()); |
| 249 | std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get())); |
| 250 | Window *window = Test::renderAndWaitForShown(surface.get(), QSize(1280, 1024), Qt::red); |
| 251 | QVERIFY(window); |
| 252 | QVERIFY(window->isActive()); |
| 253 | |
| 254 | // Show the keyboard |
| 255 | QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded); |
| 256 | std::unique_ptr<KWayland::Client::TextInput> textInput(Test::waylandTextInputManager()->createTextInput(Test::waylandSeat())); |
| 257 | textInput->enable(surface.get()); |
| 258 | QSignalSpy paneladded(kwinApp()->inputMethod(), &KWin::InputMethod::panelChanged); |
| 259 | QVERIFY(paneladded.wait()); |
| 260 | textInput->showInputPanel(); |
| 261 | QVERIFY(windowAddedSpy.wait()); |
| 262 | QVERIFY(kwinApp()->inputMethod()->isActive()); |
| 263 | |
| 264 | // Ask the keyboard to be shown again. |
| 265 | QSignalSpy activateSpy(kwinApp()->inputMethod(), &InputMethod::activeChanged); |
| 266 | textInput->enable(surface.get()); |
| 267 | textInput->showInputPanel(); |
| 268 | activateSpy.wait(200); |
| 269 | QVERIFY(activateSpy.isEmpty()); |
| 270 | QVERIFY(kwinApp()->inputMethod()->isActive()); |
| 271 | |
| 272 | // Destroy the test window. |
| 273 | shellSurface.reset(); |
| 274 | QVERIFY(Test::waitForWindowClosed(window)); |
| 275 | } |
| 276 | |
| 277 | void InputMethodTest::testHidePanel() |
| 278 | { |
nothing calls this directly
no test coverage detected