]> git.sur5r.net Git - i3/i3/blob - testcases/t/140-focus-lost.t
testcases: drop sync_with_i3()s $x parameter, use global
[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     cmp_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 sync_with_i3;
26
27 diag("left = " . $left->id . ", mid = " . $mid->id . ", right = " . $right->id);
28
29 is($x->input_focus, $right->id, 'Right window focused');
30
31 cmd 'focus left';
32
33 is($x->input_focus, $mid->id, 'Mid window focused');
34
35 cmd 'layout stacked';
36
37 is($x->input_focus, $mid->id, 'Mid window focused');
38
39 done_testing;