Skip to content

Commit

Permalink
layout: add test reproducing a panic
Browse files Browse the repository at this point in the history
  • Loading branch information
borisfaure committed Jan 6, 2025
1 parent b95e064 commit d6f87ad
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,29 @@ mod test {
assert_keys(&[], layout.keycodes());
}

#[test]
fn stacked_hold_tap() {
static LAYERS: Layers<2, 1, 1> = [[[
k(Enter),
HoldTap(&HoldTapAction {
timeout: 10,
hold: k(LAlt),
tap: k(Space),
config: HoldTapConfig::Default,
tap_hold_interval: 0,
}),
]]];

let mut layout = Layout::new(&LAYERS);
assert_eq!(CustomEvent::NoEvent, layout.tick());
// Push 2 events in a row, without ticking:
// Press/Release attached to a HoldTap
layout.event(Press(0, 1));
layout.event(Release(0, 1));
assert_eq!(CustomEvent::NoEvent, layout.tick());
assert_eq!(CustomEvent::NoEvent, layout.tick());
}

#[test]
fn multiple_actions() {
static LAYERS: Layers<2, 1, 2> = [
Expand Down

0 comments on commit d6f87ad

Please sign in to comment.