2014-01-13 21:36:11 +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
|
2014-01-13 21:36:11 +01:00
|
|
|
# (or docs/testsuite)
|
|
|
|
#
|
2017-09-24 10:19:50 +02:00
|
|
|
# • https://build.i3wm.org/docs/lib-i3test.html
|
2014-01-13 21:36:11 +01:00
|
|
|
# (alternatively: perldoc ./testcases/lib/i3test.pm)
|
|
|
|
#
|
2017-09-24 10:19:50 +02:00
|
|
|
# • https://build.i3wm.org/docs/ipc.html
|
2014-01-13 21:36:11 +01:00
|
|
|
# (or docs/ipc)
|
|
|
|
#
|
|
|
|
# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
|
|
|
|
# (unless you are already familiar with Perl)
|
|
|
|
#
|
|
|
|
# Make sure the command `move <direction>` properly sends the workspace focus
|
|
|
|
# ipc event required for i3bar to be properly updated and redrawn.
|
|
|
|
#
|
|
|
|
# Bug still in: 4.6-195-g34232b8
|
2017-09-14 12:30:42 +02:00
|
|
|
use i3test i3_config => <<EOT;
|
2014-01-13 21:36:11 +01:00
|
|
|
# i3 config file (v4)
|
|
|
|
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
|
|
|
|
|
|
|
fake-outputs 1024x768+0+0,1024x768+1024+0
|
|
|
|
workspace ws-left output fake-0
|
|
|
|
workspace ws-right output fake-1
|
|
|
|
EOT
|
|
|
|
|
|
|
|
# open two windows on the left output
|
|
|
|
cmd 'workspace ws-left';
|
|
|
|
open_window;
|
|
|
|
open_window;
|
|
|
|
|
2017-09-24 15:40:30 +02:00
|
|
|
sub focus_subtest {
|
|
|
|
my ($cmd, $want) = @_;
|
2014-01-13 21:36:11 +01:00
|
|
|
|
2017-09-24 15:40:30 +02:00
|
|
|
my @events = events_for(
|
|
|
|
sub { cmd $cmd },
|
|
|
|
'workspace');
|
2014-01-13 21:36:11 +01:00
|
|
|
|
2017-09-24 15:40:30 +02:00
|
|
|
my @focus = grep { $_->{change} eq 'focus' } @events;
|
|
|
|
is(scalar @focus, 1, 'Received 1 workspace::focus event');
|
|
|
|
is($focus[0]->{current}->{name}, 'ws-right', 'focus event gave the right workspace');
|
|
|
|
is(@{$focus[0]->{current}->{nodes}}, $want, 'focus event gave the right number of windows on the workspace');
|
|
|
|
}
|
|
|
|
|
|
|
|
# move a window over to the right output
|
|
|
|
subtest 'move right (1)', \&focus_subtest, 'move right', 1;
|
2014-05-18 07:56:50 +02:00
|
|
|
|
2017-09-24 15:40:30 +02:00
|
|
|
# move another window
|
|
|
|
cmd 'workspace ws-left';
|
|
|
|
subtest 'move right (2)', \&focus_subtest, 'move right', 2;
|
2014-01-13 21:36:11 +01:00
|
|
|
|
|
|
|
done_testing;
|