From 8d84fe4b6ae26c501e416a5bc5eee8f5cf4a02bd Mon Sep 17 00:00:00 2001 From: Andrey Butirsky Date: Thu, 17 Dec 2020 19:06:18 +0300 Subject: [PATCH] fix: KeyboardLayoutTest fails ********* Start testing of KeyboardLayoutTest ********* Config: Using QtTest library 5.15.2, Qt 5.15.2 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 10.2.1 20201016 (Red Hat 10.2.1-6)), fedora 33 PASS : KeyboardLayoutTest::initTestCase() PASS : KeyboardLayoutTest::testReconfigure() FAIL! : KeyboardLayoutTest::testChangeLayoutThroughDBus() 'layoutChangedSpy.wait()' returned FALSE. () Loc: [/home/bam/kde/src/kwin/autotests/integration/keyboard_layout_test.cpp(218)] FAIL! : KeyboardLayoutTest::testPerLayoutShortcut() 'layoutChangedSpy.wait()' returned FALSE. () Loc: [/home/bam/kde/src/kwin/autotests/integration/keyboard_layout_test.cpp(286)] PASS : KeyboardLayoutTest::testDBusServiceExport() PASS : KeyboardLayoutTest::testVirtualDesktopPolicy() PASS : KeyboardLayoutTest::testWindowPolicy() FAIL! : KeyboardLayoutTest::testApplicationPolicy() 'layoutChangedSpy.wait()' returned FALSE. () Loc: [/home/bam/kde/src/kwin/autotests/integration/keyboard_layout_test.cpp(465)] PASS : KeyboardLayoutTest::testNumLock() PASS : KeyboardLayoutTest::cleanupTestCase() Totals: 7 passed, 3 failed, 0 skipped, 0 blacklisted, 16447ms ********* Finished testing of KeyboardLayoutTest ********* - currentLayoutChanged signal has changed to layoutChanged - per cfcf2baae789fe1665fabd8fa5701811b2f8668f, the signal is now emitted on every layout change --- autotests/integration/keyboard_layout_test.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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