kmk_firmware/tests/test_layers.py

53 lines
1.4 KiB
Python
Raw Normal View History

2022-05-26 13:29:41 +02:00
import unittest
from kmk.keys import KC
from kmk.modules.layers import Layers
from tests.keyboard_test import KeyboardTest
class TestLayers(unittest.TestCase):
def setUp(self):
self.kb = KeyboardTest(
[Layers()],
[
2023-03-13 23:14:49 +01:00
[
KC.N0,
KC.LM(1, KC.LCTL),
KC.LT(1, KC.N2, tap_interrupted=True, prefer_hold=True),
KC.LT(1, KC.N3, tap_interrupted=False, prefer_hold=True),
],
[KC.A, KC.B, KC.C, KC.D],
2022-05-26 13:29:41 +02:00
],
debug_enabled=False,
)
def test_layermod(self):
self.kb.test(
'Layer + Mod',
[(1, True), (0, True), (1, False), (0, False)],
[{KC.LCTL}, {KC.LCTL, KC.A}, {KC.A}, {}],
)
2023-03-13 23:14:49 +01:00
def test_layertap(self):
self.kb.test(
'Layertap roll',
[(2, True), (0, True), (2, False), (0, False)],
[{KC.N2}, {KC.N0, KC.N2}, {KC.N0}, {}],
)
self.kb.test(
'Layertap tap interrupted',
[(2, True), (0, True), 200, (0, False), (2, False)],
[{KC.A}, {}],
)
self.kb.test(
'Layertap tap interrupted by holdtap',
[(3, True), (2, True), (2, False), (3, False)],
[{KC.C}, {}],
)
2022-05-26 13:29:41 +02:00
if __name__ == '__main__':
unittest.main()