forge
Explore
Log in

Don't you dare go Hollow

tests/binds: Add two more layouts tests

Browse files at this commit

9d8f4f89f6a075a04ed24af5f13829d0bdba5b85Ivan MolodetskikhParent: 447cf77
src/tests/binds.rsmodified+48 -0
@@ -741,6 +741,54 @@ fn layouts() {
741741 -AD04 27 XK_r
742742 surface key released: 19
743743 ");
744+
745+ // We require the modifiers to match the bind for it to trigger.
746+ // So Ctrl-? cannot be triggered on us-qwerty since entering ? necessarily requires a Shift.
747+ // If you spell out Shift like Super-Shift-?, it should be triggerable (but currently isn't).
748+ let c = r#"
749+ input {
750+ keyboard {
751+ xkb {
752+ layout "us"
753+ }
754+ }
755+ }
756+
757+ binds {
758+ Ctrl+question { close-window; }
759+ Super+Shift+question { close-window; }
760+ }
761+ "#;
762+ assert_snapshot!(run(c, "+LCTL +AB10 -AB10 +LFSH +AB10 -AB10"),
763+ @"
764+ +LCTL 37 XK_Control_L
765+ surface key pressed: 29
766+ surface modifiers: depressed=4, latched=0, locked=0, group=0
767+ +AB10 61 XK_slash
768+ surface key pressed: 53
769+ -AB10 61 XK_slash
770+ surface key released: 53
771+ +LFSH 50 XK_Shift_L
772+ surface key pressed: 42
773+ surface modifiers: depressed=5, latched=0, locked=0, group=0
774+ +AB10 61 XK_question
775+ surface key pressed: 53
776+ -AB10 61 XK_question
777+ surface key released: 53
778+ ");
779+ assert_snapshot!(run(c, "+LWIN +LFSH +AB10 -AB10"),
780+ @"
781+ +LWIN 133 XK_Super_L
782+ surface key pressed: 125
783+ surface modifiers: depressed=64, latched=0, locked=0, group=0
784+ +LFSH 50 XK_Shift_L
785+ surface key pressed: 42
786+ surface modifiers: depressed=65, latched=0, locked=0, group=0
787+ +AB10 61 XK_question
788+ surface key pressed: 53
789+ -AB10 61 XK_question
790+ surface key released: 53
791+ ");
744792 }
745793
746794 #[test]