2015-11-16 09:25:53 +01:00
|
|
|
#!perl
|
|
|
|
# vim:ts=4:sw=4:expandtab
|
|
|
|
#
|
|
|
|
# Please read the following documents before working on tests:
|
2017-09-24 10:19:50 +02:00
|
|
|
# • https://build.i3wm.org/docs/testsuite.html
|
2015-11-16 09:25:53 +01:00
|
|
|
# (or docs/testsuite)
|
|
|
|
#
|
2017-09-24 10:19:50 +02:00
|
|
|
# • https://build.i3wm.org/docs/lib-i3test.html
|
2015-11-16 09:25:53 +01:00
|
|
|
# (alternatively: perldoc ./testcases/lib/i3test.pm)
|
|
|
|
#
|
2017-09-24 10:19:50 +02:00
|
|
|
# • https://build.i3wm.org/docs/ipc.html
|
2015-11-16 09:25:53 +01:00
|
|
|
# (or docs/ipc)
|
|
|
|
#
|
|
|
|
# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
|
|
|
|
# (unless you are already familiar with Perl)
|
|
|
|
#
|
|
|
|
# Verifies that --release key bindings are not shadowed by non-release key
|
|
|
|
# bindings for the same key.
|
|
|
|
# Ticket: #2002
|
|
|
|
# Bug still in: 4.11-103-gc8d51b4
|
|
|
|
# Bug introduced with commit bf3cd41b5ddf1e757515ab5fbf811be56e5f69cc
|
2017-09-14 12:30:42 +02:00
|
|
|
use i3test i3_config => <<EOT;
|
2015-11-16 09:25:53 +01:00
|
|
|
# i3 config file (v4)
|
|
|
|
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
|
|
|
|
|
|
|
bindsym Print nop Print
|
|
|
|
bindsym --release Control+Print nop Control+Print
|
2016-09-12 12:57:13 +02:00
|
|
|
|
|
|
|
# see issue #2442
|
|
|
|
bindsym Mod1+b nop Mod1+b
|
|
|
|
bindsym --release Mod1+Shift+b nop Mod1+Shift+b release
|
2018-03-17 22:28:23 +01:00
|
|
|
|
|
|
|
bindsym --release Shift+x nop Shift+x
|
2018-03-16 02:38:13 +01:00
|
|
|
|
|
|
|
# see issue #2733
|
|
|
|
# 133 == Mod4
|
|
|
|
bindcode 133 nop 133
|
|
|
|
bindcode --release 133 nop 133 release
|
2018-03-20 00:44:50 +01:00
|
|
|
|
|
|
|
mode "a_mode" {
|
|
|
|
# 27 == r
|
|
|
|
bindcode 27 --release mode "default"
|
|
|
|
}
|
|
|
|
bindsym Mod1+r mode "a_mode"
|
|
|
|
bindcode 27 nop do not receive
|
2015-11-16 09:25:53 +01:00
|
|
|
EOT
|
2017-09-14 12:30:42 +02:00
|
|
|
use i3test::XTEST;
|
|
|
|
use ExtUtils::PkgConfig;
|
2015-11-16 09:25:53 +01:00
|
|
|
|
2017-09-14 12:30:42 +02:00
|
|
|
SKIP: {
|
|
|
|
skip "libxcb-xkb too old (need >= 1.11)", 1 unless
|
|
|
|
ExtUtils::PkgConfig->atleast_version('xcb-xkb', '1.11');
|
2015-11-16 09:25:53 +01:00
|
|
|
|
|
|
|
is(listen_for_binding(
|
|
|
|
sub {
|
|
|
|
xtest_key_press(107); # Print
|
|
|
|
xtest_key_release(107); # Print
|
2017-09-30 11:27:53 +02:00
|
|
|
xtest_sync_with_i3;
|
2015-11-16 09:25:53 +01:00
|
|
|
},
|
|
|
|
),
|
|
|
|
'Print',
|
|
|
|
'triggered the "Print" keybinding');
|
|
|
|
|
|
|
|
is(listen_for_binding(
|
|
|
|
sub {
|
|
|
|
xtest_key_press(37); # Control_L
|
|
|
|
xtest_key_press(107); # Print
|
|
|
|
xtest_key_release(107); # Print
|
|
|
|
xtest_key_release(37); # Control_L
|
2017-09-30 11:27:53 +02:00
|
|
|
xtest_sync_with_i3;
|
2015-11-16 09:25:53 +01:00
|
|
|
},
|
|
|
|
),
|
|
|
|
'Control+Print',
|
|
|
|
'triggered the "Control+Print" keybinding');
|
|
|
|
|
2016-09-12 12:57:13 +02:00
|
|
|
is(listen_for_binding(
|
|
|
|
sub {
|
|
|
|
xtest_key_press(64); # Alt_L
|
|
|
|
xtest_key_press(56); # b
|
|
|
|
xtest_key_release(56); # b
|
|
|
|
xtest_key_release(64); # Alt_L
|
2017-09-30 11:27:53 +02:00
|
|
|
xtest_sync_with_i3;
|
2016-09-12 12:57:13 +02:00
|
|
|
},
|
|
|
|
),
|
|
|
|
'Mod1+b',
|
|
|
|
'triggered the "Mod1+b" keybinding');
|
|
|
|
|
|
|
|
is(listen_for_binding(
|
|
|
|
sub {
|
|
|
|
xtest_key_press(64); # Alt_L
|
|
|
|
xtest_key_press(50); # Shift_L
|
|
|
|
xtest_key_press(56); # b
|
|
|
|
xtest_key_release(56); # b
|
|
|
|
xtest_key_release(50); # Shift_L
|
|
|
|
xtest_key_release(64); # Alt_L
|
2017-09-30 11:27:53 +02:00
|
|
|
xtest_sync_with_i3;
|
2016-09-12 12:57:13 +02:00
|
|
|
},
|
|
|
|
),
|
|
|
|
'Mod1+Shift+b release',
|
|
|
|
'triggered the "Mod1+Shift+b" release keybinding');
|
|
|
|
|
2018-03-17 22:28:23 +01:00
|
|
|
is(listen_for_binding(
|
|
|
|
sub {
|
|
|
|
xtest_key_press(50); # Shift
|
|
|
|
xtest_key_press(53); # x
|
|
|
|
xtest_key_release(53); # x
|
|
|
|
xtest_key_release(50); # Shift
|
|
|
|
xtest_sync_with_i3;
|
|
|
|
},
|
|
|
|
),
|
|
|
|
'Shift+x',
|
|
|
|
'triggered the "Shift+x" keybinding by releasing x first');
|
|
|
|
|
|
|
|
is(listen_for_binding(
|
|
|
|
sub {
|
|
|
|
xtest_key_press(50); # Shift
|
|
|
|
xtest_key_press(53); # x
|
|
|
|
xtest_key_release(50); # Shift
|
|
|
|
xtest_key_release(53); # x
|
|
|
|
xtest_sync_with_i3;
|
|
|
|
},
|
|
|
|
),
|
|
|
|
'Shift+x',
|
|
|
|
'triggered the "Shift+x" keybinding by releasing Shift first');
|
2018-03-16 02:38:13 +01:00
|
|
|
|
|
|
|
is(listen_for_binding(
|
|
|
|
sub {
|
|
|
|
xtest_key_press(133);
|
|
|
|
xtest_sync_with_i3;
|
|
|
|
},
|
|
|
|
),
|
|
|
|
'133',
|
|
|
|
'triggered the 133 keycode press binding');
|
|
|
|
|
|
|
|
is(listen_for_binding(
|
|
|
|
sub {
|
|
|
|
xtest_key_release(133);
|
|
|
|
xtest_sync_with_i3;
|
|
|
|
},
|
|
|
|
),
|
|
|
|
'133 release',
|
|
|
|
'triggered the 133 keycode release binding');
|
|
|
|
|
2018-03-20 00:44:50 +01:00
|
|
|
for my $i (1 .. 2) {
|
|
|
|
is(listen_for_binding(
|
|
|
|
sub {
|
|
|
|
xtest_key_press(64); # Alt_l
|
|
|
|
xtest_key_press(27); # r
|
|
|
|
xtest_key_release(27); # r
|
|
|
|
xtest_key_release(64); # Alt_l
|
|
|
|
xtest_sync_with_i3;
|
|
|
|
},
|
|
|
|
),
|
|
|
|
'mode "a_mode"',
|
|
|
|
"switched to mode \"a_mode\" $i/2");
|
|
|
|
|
|
|
|
is(listen_for_binding(
|
|
|
|
sub {
|
|
|
|
xtest_key_press(27); # r
|
|
|
|
xtest_key_release(27); # r
|
|
|
|
xtest_sync_with_i3;
|
|
|
|
},
|
|
|
|
),
|
|
|
|
'mode "default"',
|
|
|
|
"switched back to default $i/2");
|
|
|
|
}
|
|
|
|
|
2015-11-16 09:25:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
done_testing;
|