forge
Explore
Log in

Don't you dare go Hollow

tests/binds: Add some more edge cases

Browse files at this commit

c3e25664b36f820ae7d4ec9eecfbdd26bd1db088Ivan MolodetskikhParent: b7ada46
src/tests/binds.rsmodified+60 -0
@@ -131,6 +131,7 @@ fn combos() {
131131 let c = "
132132 binds {
133133 Mod+Ctrl+Q { close-window; }
134+ Mod+Ctrl+W { close-window; }
134135 }
135136 ";
136137
@@ -156,6 +157,31 @@ fn combos() {
156157 "
157158 );
158159
160+ // Two actions interleaved.
161+ assert_snapshot!(
162+ run(c, "+LWIN +LCTL +LatQ +LatW -LatQ -LatW -LCTL -LWIN"),
163+ @"
164+ +LWIN 133 XK_Super_L
165+ surface modifiers: depressed=64, latched=0, locked=0, group=0
166+ surface key pressed: 125
167+ +LCTL 37 XK_Control_L
168+ surface modifiers: depressed=68, latched=0, locked=0, group=0
169+ surface key pressed: 29
170+ +AD01 24 XK_q
171+ niri test-action
172+ +AD02 25 XK_w
173+ niri test-action
174+ -AD01 24 XK_q
175+ -AD02 25 XK_w
176+ -LCTL 37 XK_Control_L
177+ surface modifiers: depressed=64, latched=0, locked=0, group=0
178+ surface key released: 29
179+ -LWIN 133 XK_Super_L
180+ surface modifiers: depressed=0, latched=0, locked=0, group=0
181+ surface key released: 125
182+ "
183+ );
184+
159185 // Extra Alt = no action.
160186 assert_snapshot!(
161187 run(c, "+LWIN +LCTL +LALT +LatQ -LALT -LatQ -LCTL -LWIN"),
@@ -281,6 +307,29 @@ fn combos() {
281307 -AD01 24 XK_q
282308 "
283309 );
310+
311+ // Modifiers after trigger key don't trigger the action.
312+ assert_snapshot!(
313+ run(c, "+LWIN +LatQ +LCTL -LCTL -LatQ -LWIN"),
314+ @"
315+ +LWIN 133 XK_Super_L
316+ surface modifiers: depressed=64, latched=0, locked=0, group=0
317+ surface key pressed: 125
318+ +AD01 24 XK_q
319+ surface key pressed: 16
320+ +LCTL 37 XK_Control_L
321+ surface modifiers: depressed=68, latched=0, locked=0, group=0
322+ surface key pressed: 29
323+ -LCTL 37 XK_Control_L
324+ surface modifiers: depressed=64, latched=0, locked=0, group=0
325+ surface key released: 29
326+ -AD01 24 XK_q
327+ surface key released: 16
328+ -LWIN 133 XK_Super_L
329+ surface modifiers: depressed=0, latched=0, locked=0, group=0
330+ surface key released: 125
331+ "
332+ );
284333 }
285334
286335 #[test]
@@ -288,6 +337,7 @@ fn inhibiting() {
288337 let config = "
289338 binds {
290339 Q { close-window; }
340+ U allow-inhibiting=false { close-window; }
291341 }
292342 ";
293343
@@ -307,6 +357,16 @@ fn inhibiting() {
307357 "
308358 );
309359
360+ // allow-inhibiting=false still triggers.
361+ assert_snapshot!(
362+ run_f(&mut f, id, &surface, "+LatU -LatU"),
363+ @"
364+ +AD07 30 XK_u
365+ niri test-action
366+ -AD07 30 XK_u
367+ "
368+ );
369+
310370 // Toggle it off after pressing the shortcut.
311371 assert_snapshot!(
312372 run_f(&mut f, id, &surface, "+LatQ"),