]> git.sur5r.net Git - i3/i3/blob - testcases/t/140-focus-lost.t
Merge branch 'master' into next
[i3/i3] / testcases / t / 140-focus-lost.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 # Regression: Check if the focus stays the same when switching the layout
4 # bug introduced by 77d0d42ed2d7ac8cafe267c92b35a81c1b9491eb
5 use i3test;
6
7 my $i3 = i3(get_socket_path());
8
9 sub check_order {
10     my ($msg) = @_;
11
12     my @ws = @{$i3->get_workspaces->recv};
13     my @nums = map { $_->{num} } grep { defined($_->{num}) } @ws;
14     my @sorted = sort @nums;
15
16     is_deeply(\@nums, \@sorted, $msg);
17 }
18
19 my $tmp = fresh_workspace;
20
21 my $left = open_window;
22 my $mid = open_window;
23 my $right = open_window;
24
25 diag("left = " . $left->id . ", mid = " . $mid->id . ", right = " . $right->id);
26
27 is($x->input_focus, $right->id, 'Right window focused');
28
29 cmd 'focus left';
30
31 is($x->input_focus, $mid->id, 'Mid window focused');
32
33 cmd 'layout stacked';
34
35 is($x->input_focus, $mid->id, 'Mid window focused');
36
37 done_testing;