kmk_firmware/tests/test_capsword.py

66 lines
1.5 KiB
Python
Raw Permalink Normal View History

2022-11-21 07:10:17 +01:00
import unittest
from kmk.keys import KC
from kmk.modules.capsword import CapsWord
from tests.keyboard_test import KeyboardTest
2022-11-21 21:53:35 +01:00
# TODO: Add tests for custom and default ignored keys, custom and default timeouts
2022-11-21 07:10:17 +01:00
class TestCapsWord(unittest.TestCase):
def setUp(self):
self.kb = KeyboardTest(
2023-03-08 21:14:24 +01:00
[CapsWord(timeout=2 * KeyboardTest.loop_delay_ms)],
2022-11-21 07:10:17 +01:00
[
[KC.CW, KC.A, KC.Z, KC.N1, KC.N0, KC.SPC],
],
debug_enabled=False,
)
def test_capsword(self):
self.kb.test(
'CapsWord',
2022-11-21 21:53:35 +01:00
[
(1, True),
(1, False),
(0, True),
(0, False),
(1, True),
(1, False),
(2, True),
(2, False),
(3, True),
(3, False),
(4, True),
(4, False),
(1, True),
(1, False),
(5, True),
(5, False),
(1, True),
(1, False),
],
[
{KC.A},
{},
{KC.LSFT, KC.A},
{},
{KC.LSFT, KC.Z},
{},
{KC.N1},
{},
{KC.N0},
{},
{KC.LSFT, KC.A},
{},
{KC.SPC},
{},
{KC.A},
{},
],
2022-11-21 07:10:17 +01:00
)
if __name__ == '__main__':
unittest.main()