Fix KeyboardLayoutTest::testNumLock

Summary:
The layout from previous test leaked into this test if all tests are run
together. This change ensures that a proper layout for this test is set.

Test Plan: Test passes alone and when run together

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16903
This commit is contained in:
Martin Flöser 2018-11-15 17:56:07 +01:00
parent fb68e162b0
commit 841750438b

View file

@ -462,7 +462,15 @@ void KeyboardLayoutTest::testApplicationPolicy()
void KeyboardLayoutTest::testNumLock() void KeyboardLayoutTest::testNumLock()
{ {
qputenv("KWIN_FORCE_NUM_LOCK_EVALUATION", "1"); qputenv("KWIN_FORCE_NUM_LOCK_EVALUATION", "1");
KConfigGroup layoutGroup = kwinApp()->kxkbConfig()->group("Layout");
layoutGroup.writeEntry("LayoutList", QStringLiteral("us"));
layoutGroup.sync();
reconfigureLayouts();
auto xkb = input()->keyboard()->xkb(); auto xkb = input()->keyboard()->xkb();
QTRY_COMPARE(xkb->numberOfLayouts(), 1u);
QTRY_COMPARE(xkb->layoutName(), QStringLiteral("English (US)"));
// by default not set // by default not set
QVERIFY(!xkb->modifiers().testFlag(Qt::KeypadModifier)); QVERIFY(!xkb->modifiers().testFlag(Qt::KeypadModifier));
quint32 timestamp = 0; quint32 timestamp = 0;