summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lulua/test_layout.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/lulua/test_layout.py b/lulua/test_layout.py
index 909b717..45141ae 100644
--- a/lulua/test_layout.py
+++ b/lulua/test_layout.py
@@ -24,7 +24,7 @@ from itertools import product
import pytest
from .layout import defaultLayouts, GenericLayout, ButtonCombination
-from .keyboard import defaultKeyboards
+from .keyboard import defaultKeyboards, LetterButton
@pytest.mark.parametrize("layout", defaultLayouts, ids=[l.name for l in defaultLayouts])
def test_atomic (layout):
@@ -54,6 +54,21 @@ def test_layout_equality (a, b):
else:
assert a != b
+@pytest.mark.parametrize("layout", defaultLayouts, ids=[l.name for l in defaultLayouts])
+def test_layout_text_identity (layout):
+ """ Make sure __call__ and getText work for every layout """
+ keyboard = defaultKeyboards['ibmpc105']
+ layout = layout.specialize (keyboard)
+
+ for match, combinations in layout:
+ # all combinations produce this match
+ for comb in combinations:
+ assert layout.getText (comb) == match
+ # this match produces all combinations
+ newmatch, newcombinations = layout (match)
+ assert newmatch == match
+ assert set (newcombinations) == set (combinations)
+
def test_layout_isModifier ():
keyboard = defaultKeyboards['ibmpc105']
layout = defaultLayouts['ar-linux'].specialize (keyboard)