Skip to content

Commit

Permalink
New unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
regicidalplutophage authored Dec 14, 2024
1 parent 392d61c commit c02f0b3
Showing 1 changed file with 92 additions and 0 deletions.
92 changes: 92 additions & 0 deletions tests/test_sticky_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,50 @@ def test_sticky_key(self):
[{KC.N0}, {KC.N0, KC.N2}, {KC.N0}, {KC.N0, KC.N3}, {KC.N0}, {}],
)

keyboard.test(
'stick and roll',
[
(0, True),
(0, False),
(2, True),
(3, True),
(2, False),
(3, False),
],
[
{KC.N0},
{KC.N0, KC.N2},
{KC.N2},
{KC.N2, KC.N3},
{KC.N3},
{},
],
)

keyboard.test(
'hold multiple, tap interrupt, release one held, tap interrupt',
[
(0, True),
(1, True),
(2, True),
(2, False),
(1, False),
(3, True),
(3, False),
(0, False),
],
[
{KC.N0},
{KC.N0, KC.N1},
{KC.N0, KC.N1, KC.N2},
{KC.N0, KC.N1},
{KC.N0},
{KC.N0, KC.N3},
{KC.N0},
{},
],
)

def test_sticky_key_stack(self):
self.keyboard.keyboard.active_layers = [0]
keyboard = self.keyboard
Expand Down Expand Up @@ -230,6 +274,30 @@ def test_sticky_key_stack(self):
[{KC.N0}, {KC.N0, KC.N1}, {KC.N0}, {}, {KC.N2}, {}],
)

keyboard.test(
'stack and roll',
[
(0, True),
(0, False),
(1, True),
(1, False),
(2, True),
(3, True),
(2, False),
(3, False),
],
[
{KC.N0},
{KC.N0, KC.N1},
{KC.N0, KC.N1, KC.N2},
{KC.N0, KC.N2},
{KC.N2},
{KC.N2, KC.N3},
{KC.N3},
{},
],
)

def test_sticky_layer(self):
keyboard = self.keyboard
self.keyboard.keyboard.active_layers = [1]
Expand Down Expand Up @@ -455,6 +523,30 @@ def test_sticky_key_deferred(self):
],
)

keyboard.test(
'hold multiple, tap interrupt, release one held, tap interrupt',
[
(0, True),
(1, True),
(2, True),
(2, False),
(1, False),
(3, True),
(3, False),
(0, False),
],
[
{KC.N0},
{KC.N0, KC.N1},
{KC.N0, KC.N1, KC.N2},
{KC.N0, KC.N1},
{KC.N0},
{KC.N0, KC.N3},
{KC.N0},
{},
],
)

def test_sticky_key_in_tapdance(self):
self.keyboard.keyboard.active_layers = [3]
keyboard = self.keyboard
Expand Down

0 comments on commit c02f0b3

Please sign in to comment.