autotests: Fix InputMethodTest
We now will only be getting the input method panel when there's an enabled surface.
This commit is contained in:
parent
f509f34dbd
commit
2c6821fdca
1 changed files with 7 additions and 6 deletions
|
@ -256,14 +256,13 @@ void InputMethodTest::testHidePanel()
|
||||||
{
|
{
|
||||||
QVERIFY(!InputMethod::self()->isActive());
|
QVERIFY(!InputMethod::self()->isActive());
|
||||||
|
|
||||||
|
touchNow();
|
||||||
QSignalSpy clientAddedSpy(workspace(), &Workspace::clientAdded);
|
QSignalSpy clientAddedSpy(workspace(), &Workspace::clientAdded);
|
||||||
QSignalSpy clientRemovedSpy(workspace(), &Workspace::clientRemoved);
|
QSignalSpy clientRemovedSpy(workspace(), &Workspace::clientRemoved);
|
||||||
QVERIFY(clientAddedSpy.isValid());
|
QVERIFY(clientAddedSpy.isValid());
|
||||||
|
|
||||||
QSignalSpy activateSpy(InputMethod::self(), &InputMethod::activeChanged);
|
QSignalSpy activateSpy(InputMethod::self(), &InputMethod::activeChanged);
|
||||||
QScopedPointer<TextInput> textInput(Test::waylandTextInputManager()->createTextInput(Test::waylandSeat()));
|
QScopedPointer<TextInput> textInput(Test::waylandTextInputManager()->createTextInput(Test::waylandSeat()));
|
||||||
textInput->showInputPanel();
|
|
||||||
QVERIFY(clientAddedSpy.wait());
|
|
||||||
|
|
||||||
// Create an xdg_toplevel surface and wait for the compositor to catch up.
|
// Create an xdg_toplevel surface and wait for the compositor to catch up.
|
||||||
QScopedPointer<KWayland::Client::Surface> surface(Test::createSurface());
|
QScopedPointer<KWayland::Client::Surface> surface(Test::createSurface());
|
||||||
|
@ -271,6 +270,10 @@ void InputMethodTest::testHidePanel()
|
||||||
AbstractClient *client = Test::renderAndWaitForShown(surface.data(), QSize(1280, 1024), Qt::red);
|
AbstractClient *client = Test::renderAndWaitForShown(surface.data(), QSize(1280, 1024), Qt::red);
|
||||||
waylandServer()->seat()->setFocusedTextInputSurface(client->surface());
|
waylandServer()->seat()->setFocusedTextInputSurface(client->surface());
|
||||||
|
|
||||||
|
textInput->enable(surface.get());
|
||||||
|
textInput->showInputPanel();
|
||||||
|
QVERIFY(clientAddedSpy.wait());
|
||||||
|
|
||||||
QCOMPARE(workspace()->activeClient(), client);
|
QCOMPARE(workspace()->activeClient(), client);
|
||||||
|
|
||||||
QCOMPARE(clientAddedSpy.count(), 2);
|
QCOMPARE(clientAddedSpy.count(), 2);
|
||||||
|
@ -294,6 +297,7 @@ void InputMethodTest::testHidePanel()
|
||||||
|
|
||||||
void InputMethodTest::testSwitchFocusedSurfaces()
|
void InputMethodTest::testSwitchFocusedSurfaces()
|
||||||
{
|
{
|
||||||
|
touchNow();
|
||||||
QVERIFY(!InputMethod::self()->isActive());
|
QVERIFY(!InputMethod::self()->isActive());
|
||||||
|
|
||||||
QSignalSpy clientAddedSpy(workspace(), &Workspace::clientAdded);
|
QSignalSpy clientAddedSpy(workspace(), &Workspace::clientAdded);
|
||||||
|
@ -302,8 +306,6 @@ void InputMethodTest::testSwitchFocusedSurfaces()
|
||||||
|
|
||||||
QSignalSpy activateSpy(InputMethod::self(), &InputMethod::activeChanged);
|
QSignalSpy activateSpy(InputMethod::self(), &InputMethod::activeChanged);
|
||||||
QScopedPointer<TextInput> textInput(Test::waylandTextInputManager()->createTextInput(Test::waylandSeat()));
|
QScopedPointer<TextInput> textInput(Test::waylandTextInputManager()->createTextInput(Test::waylandSeat()));
|
||||||
textInput->showInputPanel();
|
|
||||||
QVERIFY(clientAddedSpy.wait(10000));
|
|
||||||
|
|
||||||
QVector<AbstractClient *> clients;
|
QVector<AbstractClient *> clients;
|
||||||
QVector<KWayland::Client::Surface *> surfaces;
|
QVector<KWayland::Client::Surface *> surfaces;
|
||||||
|
@ -317,10 +319,9 @@ void InputMethodTest::testSwitchFocusedSurfaces()
|
||||||
surfaces += surface;
|
surfaces += surface;
|
||||||
toplevels += shellSurface;
|
toplevels += shellSurface;
|
||||||
}
|
}
|
||||||
|
QCOMPARE(clientAddedSpy.count(), 3);
|
||||||
waylandServer()->seat()->setFocusedTextInputSurface(clients.constFirst()->surface());
|
waylandServer()->seat()->setFocusedTextInputSurface(clients.constFirst()->surface());
|
||||||
|
|
||||||
QCOMPARE(clientAddedSpy.count(), 4);
|
|
||||||
QVERIFY(activateSpy.count() || activateSpy.wait());
|
|
||||||
QVERIFY(!InputMethod::self()->isActive());
|
QVERIFY(!InputMethod::self()->isActive());
|
||||||
textInput->enable(surfaces.last());
|
textInput->enable(surfaces.last());
|
||||||
QVERIFY(!InputMethod::self()->isActive());
|
QVERIFY(!InputMethod::self()->isActive());
|
||||||
|
|
Loading…
Reference in a new issue