]> git.sur5r.net Git - i3/i3/blob - testcases/t/258-keypress-release.t
release.sh: update for v4.13 release (#2582)
[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 # • http://build.i3wm.org/docs/testsuite.html
6 #   (or docs/testsuite)
7 #
8 # • http://build.i3wm.org/docs/lib-i3test.html
9 #   (alternatively: perldoc ./testcases/lib/i3test.pm)
10 #
11 # • http://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_autostart => 0;
23 use i3test::XTEST;
24 use ExtUtils::PkgConfig;
25
26 SKIP: {
27     skip "libxcb-xkb too old (need >= 1.11)", 1 unless
28         ExtUtils::PkgConfig->atleast_version('xcb-xkb', '1.11');
29
30 my $config = <<EOT;
31 # i3 config file (v4)
32 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
33
34 bindsym Print nop Print
35 bindsym --release Control+Print nop Control+Print
36
37 # see issue #2442
38 bindsym Mod1+b nop Mod1+b
39 bindsym --release Mod1+Shift+b nop Mod1+Shift+b release
40 EOT
41
42 my $pid = launch_with_config($config);
43
44 start_binding_capture;
45
46 is(listen_for_binding(
47     sub {
48         xtest_key_press(107); # Print
49         xtest_key_release(107); # Print
50     },
51     ),
52     'Print',
53     'triggered the "Print" keybinding');
54
55 is(listen_for_binding(
56     sub {
57         xtest_key_press(37); # Control_L
58         xtest_key_press(107); # Print
59         xtest_key_release(107); # Print
60         xtest_key_release(37); # Control_L
61     },
62     ),
63     'Control+Print',
64     'triggered the "Control+Print" keybinding');
65
66 is(listen_for_binding(
67     sub {
68         xtest_key_press(64); # Alt_L
69         xtest_key_press(56); # b
70         xtest_key_release(56); # b
71         xtest_key_release(64); # Alt_L
72     },
73     ),
74     'Mod1+b',
75     'triggered the "Mod1+b" keybinding');
76
77 is(listen_for_binding(
78     sub {
79         xtest_key_press(64); # Alt_L
80         xtest_key_press(50); # Shift_L
81         xtest_key_press(56); # b
82         xtest_key_release(56); # b
83         xtest_key_release(50); # Shift_L
84         xtest_key_release(64); # Alt_L
85     },
86     ),
87     'Mod1+Shift+b release',
88     'triggered the "Mod1+Shift+b" release keybinding');
89
90 sync_with_i3;
91 is(scalar @i3test::XTEST::binding_events, 4, 'Received exactly 4 binding events');
92
93 exit_gracefully($pid);
94
95 }
96
97 done_testing;