2010-11-27 19:39:47 -05:00
|
|
|
#!perl
|
|
|
|
# vim:ts=4:sw=4:expandtab
|
|
|
|
# Regression: Check if the focus stays the same when switching the layout
|
|
|
|
# bug introduced by 77d0d42ed2d7ac8cafe267c92b35a81c1b9491eb
|
2011-03-09 14:25:17 -05:00
|
|
|
use i3test;
|
2010-11-27 19:39:47 -05:00
|
|
|
|
2011-07-25 07:35:56 -04:00
|
|
|
my $i3 = i3(get_socket_path());
|
2010-11-27 19:39:47 -05:00
|
|
|
|
|
|
|
sub check_order {
|
|
|
|
my ($msg) = @_;
|
|
|
|
|
|
|
|
my @ws = @{$i3->get_workspaces->recv};
|
|
|
|
my @nums = map { $_->{num} } grep { defined($_->{num}) } @ws;
|
|
|
|
my @sorted = sort @nums;
|
|
|
|
|
|
|
|
cmp_deeply(\@nums, \@sorted, $msg);
|
|
|
|
}
|
|
|
|
|
2011-03-09 14:25:17 -05:00
|
|
|
my $tmp = fresh_workspace;
|
2010-11-27 19:39:47 -05:00
|
|
|
|
2011-09-24 10:11:37 -04:00
|
|
|
my $left = open_window($x);
|
|
|
|
my $mid = open_window($x);
|
|
|
|
my $right = open_window($x);
|
2011-09-23 15:37:45 -04:00
|
|
|
|
|
|
|
sync_with_i3($x);
|
2010-11-27 19:39:47 -05:00
|
|
|
|
|
|
|
diag("left = " . $left->id . ", mid = " . $mid->id . ", right = " . $right->id);
|
|
|
|
|
|
|
|
is($x->input_focus, $right->id, 'Right window focused');
|
|
|
|
|
2011-06-08 14:49:49 -04:00
|
|
|
cmd 'focus left';
|
2010-11-27 19:39:47 -05:00
|
|
|
|
|
|
|
is($x->input_focus, $mid->id, 'Mid window focused');
|
|
|
|
|
2011-03-09 14:25:17 -05:00
|
|
|
cmd 'layout stacked';
|
2010-11-27 19:39:47 -05:00
|
|
|
|
|
|
|
is($x->input_focus, $mid->id, 'Mid window focused');
|
2011-03-09 14:25:17 -05:00
|
|
|
|
|
|
|
done_testing;
|