diff --git a/src/compositor/plugins/default.c b/src/compositor/plugins/default.c index 2a622f6f1..4a23d1457 100644 --- a/src/compositor/plugins/default.c +++ b/src/compositor/plugins/default.c @@ -396,8 +396,7 @@ init_keymap (MetaDefaultPlugin *self) &error); if (!proxy) { - g_message ("Failed to acquire org.freedesktop.locale1 proxy: %s, " - "probably running in CI", + g_warning ("Failed to acquire org.freedesktop.locale1 proxy: %s", error->message); return; } diff --git a/src/tests/dbusmock-templates/localed.py b/src/tests/dbusmock-templates/localed.py new file mode 100644 index 000000000..db205d17e --- /dev/null +++ b/src/tests/dbusmock-templates/localed.py @@ -0,0 +1,53 @@ +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by the Free +# Software Foundation; either version 3 of the License, or (at your option) any +# later version. See http://www.gnu.org/copyleft/lgpl.html for the full text +# of the license. + +__author__ = 'Marco Trevisan' +__copyright__ = '(c) 2021 Canonical Ltd.' + +import dbus +import time + +BUS_NAME = 'org.freedesktop.locale1' +MAIN_OBJ = '/org/freedesktop/locale1' +MAIN_IFACE = 'org.freedesktop.locale1' +SYSTEM_BUS = True + + +def load(mock, parameters): + mock.AddProperty(MAIN_IFACE, 'Locale', dbus.Array(['LANG=C'], signature='s')) + mock.AddProperty(MAIN_IFACE, 'X11Layout', dbus.String()) + mock.AddProperty(MAIN_IFACE, 'X11Model', dbus.String()) + mock.AddProperty(MAIN_IFACE, 'X11Variant', dbus.String()) + mock.AddProperty(MAIN_IFACE, 'X11Options', dbus.String()) + mock.AddProperty(MAIN_IFACE, 'VConsoleKeymap', dbus.String()) + mock.AddProperty(MAIN_IFACE, 'VConsoleKeymapToggle', dbus.String()) + +def simulate_interaction(): + time.sleep(1) + +@dbus.service.method(MAIN_IFACE, in_signature='asb') +def SetLocale(self, locale, interactive): + if interactive: + simulate_interaction() + self.Set(MAIN_IFACE, 'Locale', locale) + + +@dbus.service.method(MAIN_IFACE, in_signature='ssbb') +def SetVConsoleKeyboard(self, keymap, keymap_toggle, convert, interactive): + if interactive: + simulate_interaction() + self.Set(MAIN_IFACE, 'VConsoleKeymap', keymap) + self.Set(MAIN_IFACE, 'VConsoleKeymapToggle', keymap_toggle) + + +@dbus.service.method(MAIN_IFACE, in_signature='ssssbb') +def SetVConsoleKeyboard(self, layout, model, variant, options, convert, interactive): + if interactive: + simulate_interaction() + self.Set(MAIN_IFACE, 'X11Layout', layout) + self.Set(MAIN_IFACE, 'X11Model', model) + self.Set(MAIN_IFACE, 'X11Variant', variant) + self.Set(MAIN_IFACE, 'X11Options', options) diff --git a/src/tests/meta-dbus-runner.py b/src/tests/meta-dbus-runner.py index 3b2e57e04..254d4d512 100755 --- a/src/tests/meta-dbus-runner.py +++ b/src/tests/meta-dbus-runner.py @@ -39,6 +39,7 @@ class MutterDBusTestCase(DBusTestCase): 'meta-mocks-manager', {'templates-dir': get_templates_dir()}) klass.start_from_template('logind') + klass.start_from_local_template('localed') klass.system_bus_con = klass.get_dbus(system_bus=True) klass.session_bus_con = klass.get_dbus(system_bus=False)