]> git.sur5r.net Git - i3/i3/blob - testcases/t/140-focus-lost.t
Merge branch 'fix-var-tabs'
[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 use X11::XCB qw(:all);
7
8 BEGIN {
9     use_ok('X11::XCB::Window');
10 }
11
12 my $i3 = i3(get_socket_path());
13 my $x = X11::XCB::Connection->new;
14
15 sub check_order {
16     my ($msg) = @_;
17
18     my @ws = @{$i3->get_workspaces->recv};
19     my @nums = map { $_->{num} } grep { defined($_->{num}) } @ws;
20     my @sorted = sort @nums;
21
22     cmp_deeply(\@nums, \@sorted, $msg);
23 }
24
25 my $tmp = fresh_workspace;
26
27 my $left = open_window($x);
28 my $mid = open_window($x);
29 my $right = open_window($x);
30
31 sync_with_i3($x);
32
33 diag("left = " . $left->id . ", mid = " . $mid->id . ", right = " . $right->id);
34
35 is($x->input_focus, $right->id, 'Right window focused');
36
37 cmd 'focus left';
38
39 is($x->input_focus, $mid->id, 'Mid window focused');
40
41 cmd 'layout stacked';
42
43 is($x->input_focus, $mid->id, 'Mid window focused');
44
45 done_testing;