test for reverse mapping split

xkb
sezanzeb 4 years ago committed by sezanzeb
parent 327ab9ca90
commit b56af82caa

@ -33,8 +33,8 @@ from keymapper.paths import get_config_path
def update_reverse_mapping(func):
"""Generate a reverse mapping to optimize reverse lookups.
If _mapping contains `20: "a, A"`,
reverse mapping will contain `"a": 20, "A": 20`
If _mapping contains `20: "a, A"` (the xkb syntax for modified keys),
reverse mapping will contain `"a": 20, "A": 20`.
"""
def wrapper(self, *args, **kwargs):
func(self, *args, **kwargs)

@ -45,6 +45,12 @@ class TestMapping(unittest.TestCase):
self.assertEqual(loaded.get_keycode('2'), 11)
self.assertEqual(loaded.get_keycode('3'), 12)
def test_split(self):
# mapping supports the xmodmap/xkb syntax for modified buttons
self.mapping.change(10, 'a, A')
self.assertEqual(self.mapping.get_keycode('a'), 10)
self.assertEqual(self.mapping.get_keycode('A'), 10)
def test_change(self):
# 1 is not assigned yet, ignore it
self.mapping.change(2, 'a', 1)

Loading…
Cancel
Save