tests/binds: Add some more edge cases
Browse files at this commitc3e25664b36f820ae7d4ec9eecfbdd26bd1db088Parent: b7ada461 changed file +60 -0
- src/tests/binds.rs +60 -0
src/tests/binds.rsmodified+60 -0
| @@ -131,6 +131,7 @@ fn combos() { | |||
| 131 | let c = " | 131 | let c = " |
| 132 | binds { | 132 | binds { |
| 133 | Mod+Ctrl+Q { close-window; } | 133 | Mod+Ctrl+Q { close-window; } |
| 134 | + Mod+Ctrl+W { close-window; } | ||
| 134 | } | 135 | } |
| 135 | "; | 136 | "; |
| 136 | 137 | ||
| @@ -156,6 +157,31 @@ fn combos() { | |||
| 156 | " | 157 | " |
| 157 | ); | 158 | ); |
| 158 | 159 | ||
| 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 | + | ||
| 159 | // Extra Alt = no action. | 185 | // Extra Alt = no action. |
| 160 | assert_snapshot!( | 186 | assert_snapshot!( |
| 161 | run(c, "+LWIN +LCTL +LALT +LatQ -LALT -LatQ -LCTL -LWIN"), | 187 | run(c, "+LWIN +LCTL +LALT +LatQ -LALT -LatQ -LCTL -LWIN"), |
| @@ -281,6 +307,29 @@ fn combos() { | |||
| 281 | -AD01 24 XK_q | 307 | -AD01 24 XK_q |
| 282 | " | 308 | " |
| 283 | ); | 309 | ); |
| 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 | + ); | ||
| 284 | } | 333 | } |
| 285 | 334 | ||
| 286 | #[test] | 335 | #[test] |
| @@ -288,6 +337,7 @@ fn inhibiting() { | |||
| 288 | let config = " | 337 | let config = " |
| 289 | binds { | 338 | binds { |
| 290 | Q { close-window; } | 339 | Q { close-window; } |
| 340 | + U allow-inhibiting=false { close-window; } | ||
| 291 | } | 341 | } |
| 292 | "; | 342 | "; |
| 293 | 343 | ||
| @@ -307,6 +357,16 @@ fn inhibiting() { | |||
| 307 | " | 357 | " |
| 308 | ); | 358 | ); |
| 309 | 359 | ||
| 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 | + | ||
| 310 | // Toggle it off after pressing the shortcut. | 370 | // Toggle it off after pressing the shortcut. |
| 311 | assert_snapshot!( | 371 | assert_snapshot!( |
| 312 | run_f(&mut f, id, &surface, "+LatQ"), | 372 | run_f(&mut f, id, &surface, "+LatQ"), |