diff --git a/autotests/integration/keyboard_layout_test.cpp b/autotests/integration/keyboard_layout_test.cpp index 1bdab04e2f..dbac707e27 100644 --- a/autotests/integration/keyboard_layout_test.cpp +++ b/autotests/integration/keyboard_layout_test.cpp @@ -221,8 +221,10 @@ void KeyboardLayoutTest::testChangeLayoutThroughDBus() // layout should persist after reset resetLayouts(); - QCOMPARE(xkb->layoutName(), QStringLiteral("English (US)")); + QVERIFY(layoutChangedSpy.wait()); + QCOMPARE(layoutChangedSpy.count(), 1); + layoutChangedSpy.clear(); // switch to a layout which does not exist reply = changeLayout(QStringLiteral("French")); @@ -230,7 +232,6 @@ void KeyboardLayoutTest::testChangeLayoutThroughDBus() QCOMPARE(reply.reply().arguments().first().toBool(), false); QCOMPARE(xkb->layoutName(), QStringLiteral("English (US)")); QVERIFY(!layoutChangedSpy.wait(1000)); - QVERIFY(layoutChangedSpy.isEmpty()); // switch to another layout should work reply = changeLayout(QStringLiteral("German")); @@ -239,7 +240,6 @@ void KeyboardLayoutTest::testChangeLayoutThroughDBus() QCOMPARE(xkb->layoutName(), QStringLiteral("German")); QVERIFY(layoutChangedSpy.wait(1000)); QCOMPARE(layoutChangedSpy.count(), 1); - layoutChangedSpy.clear(); // switching to same layout should also work reply = changeLayout(QStringLiteral("German")); @@ -247,7 +247,6 @@ void KeyboardLayoutTest::testChangeLayoutThroughDBus() QCOMPARE(reply.reply().arguments().first().toBool(), true); QCOMPARE(xkb->layoutName(), QStringLiteral("German")); QVERIFY(!layoutChangedSpy.wait(1000)); - QVERIFY(layoutChangedSpy.isEmpty()); } void KeyboardLayoutTest::testPerLayoutShortcut() @@ -464,13 +463,15 @@ void KeyboardLayoutTest::testApplicationPolicy() changeLayout(QStringLiteral("German (Neo 2)")); QVERIFY(layoutChangedSpy.wait()); QCOMPARE(layoutChangedSpy.count(), 1); + layoutChangedSpy.clear(); QCOMPARE(xkb->layoutName(), QStringLiteral("German (Neo 2)")); resetLayouts(); - // to trigger layout apply for current client + // to trigger layout application for current client workspace()->activateClient(c1); workspace()->activateClient(c2); - + QVERIFY(layoutChangedSpy.wait()); + QCOMPARE(layoutChangedSpy.count(), 1); QCOMPARE(xkb->layoutName(), QStringLiteral("German (Neo 2)")); // activate other window