kmk_firmware/tests/test_sticky_mod.py

104 lines
2.6 KiB
Python
Raw Normal View History

2022-04-22 20:35:49 +02:00
import unittest
from kmk.keys import KC
from kmk.modules.layers import Layers
from kmk.modules.sticky_mod import StickyMod
2022-04-22 20:35:49 +02:00
from tests.keyboard_test import KeyboardTest
class TestStickyMod(unittest.TestCase):
2022-04-22 20:35:49 +02:00
def test_basic_kmk_keyboard(self):
keyboard = KeyboardTest(
[Layers(), StickyMod()],
2022-04-22 20:35:49 +02:00
[
[
KC.A,
KC.B,
KC.MO(1),
KC.LT(1, KC.C),
KC.SM(kc=KC.TAB, mod=KC.LCTL(KC.LSFT)),
2022-04-22 20:35:49 +02:00
KC.F,
],
[
KC.SM(kc=KC.TAB, mod=KC.LGUI),
KC.SM(kc=KC.TAB, mod=KC.LSFT(KC.LGUI)),
2022-04-22 20:35:49 +02:00
KC.TRNS,
KC.B,
KC.N5,
],
[KC.A, KC.B, KC.N3, KC.N4, KC.N5],
],
debug_enabled=False,
)
keyboard.test(
'basic test',
[
(4, True),
(4, False),
(4, True),
(4, False),
(1, True),
(1, False),
],
[
2022-04-25 15:51:26 +02:00
{KC.LSFT, KC.LCTL, KC.TAB},
{KC.LSFT, KC.LCTL},
{KC.LSFT, KC.LCTL, KC.TAB},
{KC.LSFT, KC.LCTL},
2022-04-22 20:35:49 +02:00
{KC.B},
{},
],
)
keyboard.test(
'basic test with MO',
[
(1, True),
(1, False),
(2, True),
(0, True),
(0, False),
(0, True),
(0, False),
(1, True),
(1, False),
(1, True),
(1, False),
(0, True),
(0, False),
(3, True),
(3, False),
(2, False),
(4, True),
(4, False),
(1, True),
(1, False),
],
[
{KC.B},
{},
{KC.LGUI, KC.TAB},
{KC.LGUI},
{KC.LGUI, KC.TAB},
{KC.LGUI},
{KC.LSFT, KC.LGUI, KC.TAB},
{KC.LSFT, KC.LGUI},
{KC.LSFT, KC.LGUI, KC.TAB},
{KC.LSFT, KC.LGUI},
{KC.LGUI, KC.TAB},
{KC.LGUI},
{KC.B},
{},
2022-04-25 15:51:26 +02:00
{KC.LSFT, KC.LCTL, KC.TAB},
{KC.LSFT, KC.LCTL},
2022-04-22 20:35:49 +02:00
{KC.B},
{},
],
)
if __name__ == '__main__':
unittest.main()