Skip to content

Commit dd18df5

Browse files
committed
layout: add test reproducing a panic
1 parent 76b3d23 commit dd18df5

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/layout.rs

+23
Original file line numberDiff line numberDiff line change
@@ -960,6 +960,29 @@ mod test {
960960
assert_keys(&[], layout.keycodes());
961961
}
962962

963+
#[test]
964+
fn stacked_hold_tap() {
965+
static LAYERS: Layers<2, 1, 1> = [[[
966+
k(Enter),
967+
HoldTap(&HoldTapAction {
968+
timeout: 10,
969+
hold: k(LAlt),
970+
tap: k(Space),
971+
config: HoldTapConfig::Default,
972+
tap_hold_interval: 0,
973+
}),
974+
]]];
975+
976+
let mut layout = Layout::new(&LAYERS);
977+
assert_eq!(CustomEvent::NoEvent, layout.tick());
978+
// Push 2 events in a row, without ticking:
979+
// Press/Release attached to a HoldTap
980+
layout.event(Press(0, 1));
981+
layout.event(Release(0, 1));
982+
assert_eq!(CustomEvent::NoEvent, layout.tick());
983+
assert_eq!(CustomEvent::NoEvent, layout.tick());
984+
}
985+
963986
#[test]
964987
fn multiple_actions() {
965988
static LAYERS: Layers<2, 1, 2> = [

0 commit comments

Comments
 (0)