mirror of
https://github.com/sezanzeb/input-remapper
synced 2024-11-04 12:00:16 +00:00
test for reverse mapping split
This commit is contained in:
parent
7b89e8a46f
commit
36c2ae1be0
@ -33,8 +33,8 @@ from keymapper.paths import get_config_path
|
|||||||
def update_reverse_mapping(func):
|
def update_reverse_mapping(func):
|
||||||
"""Generate a reverse mapping to optimize reverse lookups.
|
"""Generate a reverse mapping to optimize reverse lookups.
|
||||||
|
|
||||||
If _mapping contains `20: "a, A"`,
|
If _mapping contains `20: "a, A"` (the xkb syntax for modified keys),
|
||||||
reverse mapping will contain `"a": 20, "A": 20`
|
reverse mapping will contain `"a": 20, "A": 20`.
|
||||||
"""
|
"""
|
||||||
def wrapper(self, *args, **kwargs):
|
def wrapper(self, *args, **kwargs):
|
||||||
func(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('2'), 11)
|
||||||
self.assertEqual(loaded.get_keycode('3'), 12)
|
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):
|
def test_change(self):
|
||||||
# 1 is not assigned yet, ignore it
|
# 1 is not assigned yet, ignore it
|
||||||
self.mapping.change(2, 'a', 1)
|
self.mapping.change(2, 'a', 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user