]> git.sur5r.net Git - i3/i3/blob - testcases/t/258-keypress-release.t
72bfc86281e2831355ebca4609713d3b8a4690ac
[i3/i3] / testcases / t / 258-keypress-release.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 --release key bindings are not shadowed by non-release key
18 # bindings for the same key.
19 # Ticket: #2002
20 # Bug still in: 4.11-103-gc8d51b4
21 # Bug introduced with commit bf3cd41b5ddf1e757515ab5fbf811be56e5f69cc
22 use i3test i3_config => <<EOT;
23 # i3 config file (v4)
24 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
25
26 bindsym Print nop Print
27 bindsym --release Control+Print nop Control+Print
28
29 # see issue #2442
30 bindsym Mod1+b nop Mod1+b
31 bindsym --release Mod1+Shift+b nop Mod1+Shift+b release
32 EOT
33 use i3test::XTEST;
34 use ExtUtils::PkgConfig;
35
36 SKIP: {
37     skip "libxcb-xkb too old (need >= 1.11)", 1 unless
38         ExtUtils::PkgConfig->atleast_version('xcb-xkb', '1.11');
39
40 start_binding_capture;
41
42 is(listen_for_binding(
43     sub {
44         xtest_key_press(107); # Print
45         xtest_key_release(107); # Print
46     },
47     ),
48     'Print',
49     'triggered the "Print" keybinding');
50
51 is(listen_for_binding(
52     sub {
53         xtest_key_press(37); # Control_L
54         xtest_key_press(107); # Print
55         xtest_key_release(107); # Print
56         xtest_key_release(37); # Control_L
57     },
58     ),
59     'Control+Print',
60     'triggered the "Control+Print" keybinding');
61
62 is(listen_for_binding(
63     sub {
64         xtest_key_press(64); # Alt_L
65         xtest_key_press(56); # b
66         xtest_key_release(56); # b
67         xtest_key_release(64); # Alt_L
68     },
69     ),
70     'Mod1+b',
71     'triggered the "Mod1+b" keybinding');
72
73 is(listen_for_binding(
74     sub {
75         xtest_key_press(64); # Alt_L
76         xtest_key_press(50); # Shift_L
77         xtest_key_press(56); # b
78         xtest_key_release(56); # b
79         xtest_key_release(50); # Shift_L
80         xtest_key_release(64); # Alt_L
81     },
82     ),
83     'Mod1+Shift+b release',
84     'triggered the "Mod1+Shift+b" release keybinding');
85
86 sync_with_i3;
87 is(scalar @i3test::XTEST::binding_events, 4, 'Received exactly 4 binding events');
88
89 }
90
91 done_testing;