summaryrefslogtreecommitdiff
path: root/lulua/test_writer.py
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2020-03-08 08:34:13 +0100
committerLars-Dominik Braun <lars@6xq.net>2020-03-08 08:42:26 +0100
commit59ca079dba6c95948ebbf6442066e9313d330302 (patch)
treec2c608100202c4e7df750331f6382b00fe6bce50 /lulua/test_writer.py
parentbe5f8fd5ee5ef8d6ece3345ae1c2bbee134be59a (diff)
downloadlulua-59ca079dba6c95948ebbf6442066e9313d330302.tar.gz
lulua-59ca079dba6c95948ebbf6442066e9313d330302.tar.bz2
lulua-59ca079dba6c95948ebbf6442066e9313d330302.zip
writer: Fix bug in chooseCombination
Some combinations had the same score and the “wrong” one was chosen as a result. This affects how key combinations are chosen and thus it significantly affects results (lowering ar-lulua’s asymmetry and increasing it for almost every other layout) and probably optimization of levels > 1.
Diffstat (limited to 'lulua/test_writer.py')
-rw-r--r--lulua/test_writer.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/lulua/test_writer.py b/lulua/test_writer.py
index bc02a7e..c8840d9 100644
--- a/lulua/test_writer.py
+++ b/lulua/test_writer.py
@@ -91,7 +91,7 @@ testCombs = [
), ([
(tuple (), ('Fl_space', )),
(tuple (), ('Fr_space', )),
- ], 0, (('El_shift', ), ('Dr7', ))
+ ], 1, (('El_shift', ), ('Dr7', ))
), ([
(tuple (), ('Fl_space', )),
(tuple (), ('Fr_space', )),
@@ -102,6 +102,10 @@ testCombs = [
(('Er_shift', ), ('CD_ret', )),
(('El_shift', ), ('CD_ret', )),
], 0, None),
+ ([
+ (('El_shift', ), ('Cl4', )),
+ (('Er_shift', ), ('Cl4', )),
+ ], 1, (tuple (), ('Fr_space', ))),
]
@pytest.mark.parametrize("combs, expect, prev", testCombs)
@@ -114,5 +118,8 @@ def test_writer_chooseComb (combs, expect, prev):
prev = toButtonComb (keyboard, prev)
w.press (prev)
combs = [toButtonComb (keyboard, x) for x in combs]
- assert w.chooseCombination (combs) == combs[expect]
+ result = w.chooseCombination (combs)
+ assert result == combs[expect]
+ if len (result) == 2:
+ assert w.getHandFinger (first (result.modifier))[0] != w.getHandFinger (first (result.buttons))[0]