forge
Explore
Log in

Don't you dare go Hollow

tests/binds: Add some more layouts tests

Browse files at this commit

447cf77167a8b3927cacc619e53e66d565919236Ivan MolodetskikhParent: 5f23510
src/tests/binds.rsmodified+72 -0
@@ -669,6 +669,78 @@ fn layouts() {
669 surface modifiers: depressed=0, latched=0, locked=0, group=1669 surface modifiers: depressed=0, latched=0, locked=0, group=1
670 "670 "
671 );671 );
672+
673+ // ASCII binds on Russian should search the configured ASCII layout, not QWERTY.
674+ // LatR corresponds to P on colemak_dh_ortho.
675+ let c = r#"
676+ input {
677+ keyboard {
678+ xkb {
679+ layout "us,ru"
680+ variant "colemak_dh_ortho,"
681+ options "grp:lalt_toggle"
682+ }
683+ }
684+ }
685+
686+ binds {
687+ P { close-window; }
688+ }
689+ "#;
690+ assert_snapshot!(run(c, "+LALT -LALT +LatR -LatR"),
691+ @"
692+ +LALT 64 XK_ISO_Next_Group
693+ surface key pressed: 56
694+ surface modifiers: depressed=0, latched=0, locked=0, group=1
695+ -LALT 64 XK_ISO_Next_Group
696+ surface key released: 56
697+ +AD04 27 XK_Cyrillic_ka
698+ niri test-action
699+ -AD04 27 XK_Cyrillic_ka
700+ ");
701+
702+ // ASCII fallback should find the first configured ASCII layout.
703+ let c = r#"
704+ input {
705+ keyboard {
706+ xkb {
707+ layout "ru,us,us"
708+ variant ",colemak_dh_ortho,"
709+ options "grp:lalt_toggle"
710+ }
711+ }
712+ }
713+
714+ binds {
715+ P { close-window; }
716+ }
717+ "#;
718+ // Input in ru (should fall back to us-colemak),
719+ // then input in us-colemak (no fallback, works),
720+ // then input in us-qwerty (no fallback, no bind).
721+ assert_snapshot!(run(c, "+LatR -LatR +LALT -LALT +LatR -LatR +LALT -LALT +LatR -LatR"),
722+ @"
723+ +AD04 27 XK_Cyrillic_ka
724+ niri test-action
725+ -AD04 27 XK_Cyrillic_ka
726+ +LALT 64 XK_ISO_Next_Group
727+ surface key pressed: 56
728+ surface modifiers: depressed=0, latched=0, locked=0, group=1
729+ -LALT 64 XK_ISO_Next_Group
730+ surface key released: 56
731+ +AD04 27 XK_p
732+ niri test-action
733+ -AD04 27 XK_p
734+ +LALT 64 XK_ISO_Next_Group
735+ surface key pressed: 56
736+ surface modifiers: depressed=0, latched=0, locked=0, group=2
737+ -LALT 64 XK_ISO_Next_Group
738+ surface key released: 56
739+ +AD04 27 XK_r
740+ surface key pressed: 19
741+ -AD04 27 XK_r
742+ surface key released: 19
743+ ");
672 }744 }
673 745
674 #[test]746 #[test]