tests/binds: Add some us,ru layout tests
Browse files at this commit027256c612cd48255fb742bb20c4276c6ba1c3c3Parent: c3e25661 changed file +96 -0
- src/tests/binds.rs +96 -0
src/tests/binds.rsmodified+96 -0
| @@ -406,3 +406,99 @@ fn inhibiting() { | ||
| 406 | 406 | @"-AD01 24 XK_q" |
| 407 | 407 | ); |
| 408 | 408 | } |
| 409 | + | |
| 410 | +#[test] | |
| 411 | +fn layouts() { | |
| 412 | + let c = r#" | |
| 413 | + input { | |
| 414 | + keyboard { | |
| 415 | + xkb { | |
| 416 | + layout "us,ru" | |
| 417 | + options "grp:lalt_toggle" | |
| 418 | + } | |
| 419 | + } | |
| 420 | + } | |
| 421 | + | |
| 422 | + binds { | |
| 423 | + Q { close-window; } | |
| 424 | + Shift+Slash { close-window; } | |
| 425 | + } | |
| 426 | + "#; | |
| 427 | + | |
| 428 | + // On a cyrillic layout (ru), an ascii bind is searched in the ascii layout (us). | |
| 429 | + assert_snapshot!( | |
| 430 | + run(c, "+LALT -LALT +LatQ -LatQ"), | |
| 431 | + @" | |
| 432 | + +LALT 64 XK_ISO_Next_Group | |
| 433 | + surface modifiers: depressed=0, latched=0, locked=0, group=1 | |
| 434 | + surface key pressed: 56 | |
| 435 | + -LALT 64 XK_ISO_Next_Group | |
| 436 | + surface key released: 56 | |
| 437 | + +AD01 24 XK_Cyrillic_shorti | |
| 438 | + niri test-action | |
| 439 | + -AD01 24 XK_Cyrillic_shorti | |
| 440 | + " | |
| 441 | + ); | |
| 442 | + | |
| 443 | + // The slash key has . , in ru, and pressing those shouldn't search another layout. | |
| 444 | + assert_snapshot!( | |
| 445 | + run( | |
| 446 | + c, | |
| 447 | + " | |
| 448 | + +LFSH +AB10 -AB10 -LFSH \ | |
| 449 | + +LALT -LALT \ | |
| 450 | + +LFSH +AB10 -AB10 -LFSH | |
| 451 | + " | |
| 452 | + ), | |
| 453 | + @" | |
| 454 | + +LFSH 50 XK_Shift_L | |
| 455 | + surface modifiers: depressed=1, latched=0, locked=0, group=0 | |
| 456 | + surface key pressed: 42 | |
| 457 | + +AB10 61 XK_question | |
| 458 | + niri test-action | |
| 459 | + -AB10 61 XK_question | |
| 460 | + -LFSH 50 XK_Shift_L | |
| 461 | + surface modifiers: depressed=0, latched=0, locked=0, group=0 | |
| 462 | + surface key released: 42 | |
| 463 | + +LALT 64 XK_ISO_Next_Group | |
| 464 | + surface modifiers: depressed=0, latched=0, locked=0, group=1 | |
| 465 | + surface key pressed: 56 | |
| 466 | + -LALT 64 XK_ISO_Next_Group | |
| 467 | + surface key released: 56 | |
| 468 | + +LFSH 50 XK_Shift_L | |
| 469 | + surface modifiers: depressed=1, latched=0, locked=0, group=1 | |
| 470 | + surface key pressed: 42 | |
| 471 | + +AB10 61 XK_comma | |
| 472 | + surface key pressed: 53 | |
| 473 | + -AB10 61 XK_comma | |
| 474 | + surface key released: 53 | |
| 475 | + -LFSH 50 XK_Shift_L | |
| 476 | + surface modifiers: depressed=0, latched=0, locked=0, group=1 | |
| 477 | + surface key released: 42 | |
| 478 | + " | |
| 479 | + ); | |
| 480 | + | |
| 481 | + // In ru, / is on the \ / key (so, Shift + \). So, arguably, it would make sense for Shift + / | |
| 482 | + // to trigger it, but it currently doesn't (niri requires an unshifted trigger key, despite | |
| 483 | + // working fine with capital case alphabetic keys). | |
| 484 | + assert_snapshot!( | |
| 485 | + run(c, "+LALT -LALT +LFSH +BKSL -BKSL -LFSH"), | |
| 486 | + @" | |
| 487 | + +LALT 64 XK_ISO_Next_Group | |
| 488 | + surface modifiers: depressed=0, latched=0, locked=0, group=1 | |
| 489 | + surface key pressed: 56 | |
| 490 | + -LALT 64 XK_ISO_Next_Group | |
| 491 | + surface key released: 56 | |
| 492 | + +LFSH 50 XK_Shift_L | |
| 493 | + surface modifiers: depressed=1, latched=0, locked=0, group=1 | |
| 494 | + surface key pressed: 42 | |
| 495 | + +BKSL 51 XK_slash | |
| 496 | + surface key pressed: 43 | |
| 497 | + -BKSL 51 XK_slash | |
| 498 | + surface key released: 43 | |
| 499 | + -LFSH 50 XK_Shift_L | |
| 500 | + surface modifiers: depressed=0, latched=0, locked=0, group=1 | |
| 501 | + surface key released: 42 | |
| 502 | + " | |
| 503 | + ); | |
| 504 | +} |