28 lines
821 B
Python
28 lines
821 B
Python
from merlin.actions.mapper import ActionMapper
|
|
from merlin.config import MerlinConfig
|
|
|
|
|
|
def test_maps_known_gesture():
|
|
config = MerlinConfig()
|
|
mapper = ActionMapper(config)
|
|
assert mapper.map("left_blink") == "left_click"
|
|
|
|
|
|
def test_returns_none_for_unknown_gesture():
|
|
config = MerlinConfig()
|
|
mapper = ActionMapper(config)
|
|
assert mapper.map("nonexistent_gesture") is None
|
|
|
|
|
|
def test_custom_mapping_overrides_default():
|
|
config = MerlinConfig(mappings={"left_blink": "key_enter"})
|
|
mapper = ActionMapper(config)
|
|
assert mapper.map("left_blink") == "key_enter"
|
|
|
|
|
|
def test_reload_picks_up_new_config():
|
|
config = MerlinConfig()
|
|
mapper = ActionMapper(config)
|
|
config.mappings["head_nod"] = "double_click"
|
|
mapper.reload(config)
|
|
assert mapper.map("head_nod") == "double_click"
|