2010-11-28 01:39:47 +01:00
|
|
|
#!perl
|
|
|
|
# vim:ts=4:sw=4:expandtab
|
2012-09-10 14:09:01 +02:00
|
|
|
#
|
|
|
|
# Please read the following documents before working on tests:
|
2017-09-24 10:19:50 +02:00
|
|
|
# • https://build.i3wm.org/docs/testsuite.html
|
2012-09-10 14:09:01 +02:00
|
|
|
# (or docs/testsuite)
|
|
|
|
#
|
2017-09-24 10:19:50 +02:00
|
|
|
# • https://build.i3wm.org/docs/lib-i3test.html
|
2012-09-10 14:09:01 +02:00
|
|
|
# (alternatively: perldoc ./testcases/lib/i3test.pm)
|
|
|
|
#
|
2017-09-24 10:19:50 +02:00
|
|
|
# • https://build.i3wm.org/docs/ipc.html
|
2012-09-10 14:09:01 +02:00
|
|
|
# (or docs/ipc)
|
|
|
|
#
|
|
|
|
# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
|
|
|
|
# (unless you are already familiar with Perl)
|
|
|
|
#
|
2010-11-28 01:39:47 +01:00
|
|
|
# Regression: Check if the focus stays the same when switching the layout
|
|
|
|
# bug introduced by 77d0d42ed2d7ac8cafe267c92b35a81c1b9491eb
|
2011-03-09 20:25:17 +01:00
|
|
|
use i3test;
|
2010-11-28 01:39:47 +01:00
|
|
|
|
2011-07-25 13:35:56 +02:00
|
|
|
my $i3 = i3(get_socket_path());
|
2010-11-28 01:39:47 +01:00
|
|
|
|
|
|
|
sub check_order {
|
|
|
|
my ($msg) = @_;
|
|
|
|
|
|
|
|
my @ws = @{$i3->get_workspaces->recv};
|
|
|
|
my @nums = map { $_->{num} } grep { defined($_->{num}) } @ws;
|
|
|
|
my @sorted = sort @nums;
|
|
|
|
|
2011-11-22 02:21:47 +01:00
|
|
|
is_deeply(\@nums, \@sorted, $msg);
|
2010-11-28 01:39:47 +01:00
|
|
|
}
|
|
|
|
|
2011-03-09 20:25:17 +01:00
|
|
|
my $tmp = fresh_workspace;
|
2010-11-28 01:39:47 +01:00
|
|
|
|
2011-11-22 00:47:32 +01:00
|
|
|
my $left = open_window;
|
|
|
|
my $mid = open_window;
|
|
|
|
my $right = open_window;
|
2011-09-23 21:37:45 +02:00
|
|
|
|
2010-11-28 01:39:47 +01:00
|
|
|
diag("left = " . $left->id . ", mid = " . $mid->id . ", right = " . $right->id);
|
|
|
|
|
|
|
|
is($x->input_focus, $right->id, 'Right window focused');
|
|
|
|
|
2011-06-08 20:49:49 +02:00
|
|
|
cmd 'focus left';
|
2010-11-28 01:39:47 +01:00
|
|
|
|
|
|
|
is($x->input_focus, $mid->id, 'Mid window focused');
|
|
|
|
|
2011-03-09 20:25:17 +01:00
|
|
|
cmd 'layout stacked';
|
2010-11-28 01:39:47 +01:00
|
|
|
|
|
|
|
is($x->input_focus, $mid->id, 'Mid window focused');
|
2011-03-09 20:25:17 +01:00
|
|
|
|
|
|
|
done_testing;
|