Commit 341ec55c authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

InputMethodTest: Use InputMethod::isActive as a way to check if it's activated

Instead of looking for a client, which is a bit more of a hit and miss,
since the client doesn't need to be registered when the test expects it
to.
parent 000ed7b1
......@@ -153,10 +153,6 @@ void InputMethodTest::testOpenClose()
void InputMethodTest::testEnableDisableV3()
{
QSignalSpy clientAddedSpy(workspace(), &Workspace::clientAdded);
QSignalSpy clientRemovedSpy(workspace(), &Workspace::clientRemoved);
QVERIFY(clientAddedSpy.isValid());
// Create an xdg_toplevel surface and wait for the compositor to catch up.
QScopedPointer<Surface> surface(Test::createSurface());
QScopedPointer<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.data()));
......@@ -168,21 +164,21 @@ void InputMethodTest::testEnableDisableV3()
Test::TextInputV3 *textInputV3 = new Test::TextInputV3();
textInputV3->init(Test::waylandTextInputManagerV3()->get_text_input(*(Test::waylandSeat())));
textInputV3->enable();
// just enabling the text-input should not show it but rather on commit
QVERIFY(!clientAddedSpy.wait(100));
QSignalSpy inputMethodActiveSpy(InputMethod::self(), &InputMethod::activeChanged);
// just enabling the text-input should not show it but rather on commit
QVERIFY(!InputMethod::self()->isActive());
textInputV3->commit();
QVERIFY(clientAddedSpy.wait());
AbstractClient *keyboardClient = clientAddedSpy.last().first().value<AbstractClient *>();
QVERIFY(keyboardClient);
QVERIFY(keyboardClient->isInputMethod());
QVERIFY(inputMethodActiveSpy.count() || inputMethodActiveSpy.wait());
QVERIFY(InputMethod::self()->isActive());
// disable text input and ensure that it is not hiding input panel without commit
inputMethodActiveSpy.clear();
QVERIFY(InputMethod::self()->isActive());
textInputV3->disable();
QVERIFY(!clientRemovedSpy.wait(100));
textInputV3->commit();
QVERIFY(clientRemovedSpy.wait());
QVERIFY(inputMethodActiveSpy.count() || inputMethodActiveSpy.wait());
QVERIFY(!InputMethod::self()->isActive());
}
WAYLANDTEST_MAIN(InputMethodTest)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment