Introduce env variable KWIN_XKB_DEFAULT_KEYMAP to force default layout creation

Summary:
The Xkb class loads keyboard layouts from the users configuration. This
makes tests fail locally if the user has a layout which behaves
differently to the one the test expects. E.g. on a German layout the
right alt key is different to the one of US layout.

In order to have a more stable test base the env variable
KWIN_XKB_DEFAULT_KEYMAP forces the loading of the default keymap, thus
tests have a common layout set.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2466
master
Martin Gräßlin 8 years ago
parent c04e764369
commit ea22b8f15d

@ -92,6 +92,7 @@ void ModifierOnlyShortcutTest::initTestCase()
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
kwinApp()->setConfig(KSharedConfig::openConfig(QString(), KConfig::SimpleConfig));
qputenv("KWIN_XKB_DEFAULT_KEYMAP", "1");
kwinApp()->start();
QVERIFY(workspaceCreatedSpy.wait());

@ -118,7 +118,10 @@ void Xkb::reconfigure()
return;
}
xkb_keymap *keymap = loadKeymapFromConfig();
xkb_keymap *keymap = nullptr;
if (!qEnvironmentVariableIsSet("KWIN_XKB_DEFAULT_KEYMAP")) {
keymap = loadKeymapFromConfig();
}
if (!keymap) {
qCDebug(KWIN_XKB) << "Could not create xkb keymap from configuration";
keymap = loadDefaultKeymap();

Loading…
Cancel
Save