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 cfcf2baae7, the signal is now emitted
  on every layout change
This commit is contained in:
Andrey Butirsky 2020-12-17 19:06:18 +03:00
parent 68a7daff58
commit 8d84fe4b6a

View file

@ -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