]> git.sur5r.net Git - i3/i3/blob - testcases/t/257-keypress-group1-fallback.t
Merge branch 'next' into master
[i3/i3] / testcases / t / 257-keypress-group1-fallback.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 #
4 # Please read the following documents before working on tests:
5 # • https://build.i3wm.org/docs/testsuite.html
6 #   (or docs/testsuite)
7 #
8 # • https://build.i3wm.org/docs/lib-i3test.html
9 #   (alternatively: perldoc ./testcases/lib/i3test.pm)
10 #
11 # • https://build.i3wm.org/docs/ipc.html
12 #   (or docs/ipc)
13 #
14 # • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
15 #   (unless you are already familiar with Perl)
16 #
17 # Verifies that when using multiple keyboard layouts at the same time, bindings
18 # without a specified XKB group will work in all XKB groups.
19 # Ticket: #2062
20 # Bug still in: 4.11-103-gc8d51b4
21 # Bug introduced with commit 0e5180cae9e9295678e3f053042b559e82cb8c98
22 use i3test
23     i3_config => <<EOT;
24 # i3 config file (v4)
25 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
26
27 bindsym Print nop Print
28 bindsym Mod4+Return nop Mod4+Return
29 EOT
30 use i3test::XTEST;
31 use ExtUtils::PkgConfig;
32
33 SKIP: {
34     skip "libxcb-xkb too old (need >= 1.11)", 1 unless
35         ExtUtils::PkgConfig->atleast_version('xcb-xkb', '1.11');
36     skip "setxkbmap not found", 1 if
37         system(q|setxkbmap -print >/dev/null|) != 0;
38
39 system(q|setxkbmap us,ru -option grp:alt_shift_toggle|);
40
41 is(listen_for_binding(
42     sub {
43         xtest_key_press(107);
44         xtest_key_release(107);
45         xtest_sync_with_i3;
46     },
47     ),
48    'Print',
49    'triggered the "Print" keybinding');
50
51 is(listen_for_binding(
52     sub {
53         xtest_key_press(133); # Super_L
54         xtest_key_press(36); # Return
55         xtest_key_release(36); # Return
56         xtest_key_release(133); # Super_L
57         xtest_sync_with_i3;
58     },
59     ),
60    'Mod4+Return',
61    'triggered the "Mod4+Return" keybinding');
62
63 # Switch keyboard group to russian.
64 set_xkb_group(1);
65
66 is(listen_for_binding(
67     sub {
68         xtest_key_press(107);
69         xtest_key_release(107);
70         xtest_sync_with_i3;
71     },
72     ),
73    'Print',
74    'triggered the "Print" keybinding');
75
76 is(listen_for_binding(
77     sub {
78         xtest_key_press(133); # Super_L
79         xtest_key_press(36); # Return
80         xtest_key_release(36); # Return
81         xtest_key_release(133); # Super_L
82         xtest_sync_with_i3;
83     },
84     ),
85    'Mod4+Return',
86    'triggered the "Mod4+Return" keybinding');
87
88 # Disable the grp:alt_shift_toggle option, as we use Alt+Shift in other testcases.
89 system(q|setxkbmap us -option|);
90
91 }
92
93 done_testing;