]> git.sur5r.net Git - i3/i3/blob - testcases/t/08-focus-stack.t
Merge branch 'tree' into next
[i3/i3] / testcases / t / 08-focus-stack.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 # Checks if the focus is correctly restored, when creating a floating client
4 # over an unfocused tiling client and destroying the floating one again.
5
6 use i3test;
7 use X11::XCB qw(:all);
8
9 BEGIN {
10     use_ok('X11::XCB::Window') or BAIL_OUT('Could not load X11::XCB::Window');
11 }
12
13 my $x = X11::XCB::Connection->new;
14
15 my $i3 = i3(get_socket_path());
16 fresh_workspace;
17
18 cmd 'split h';
19 my $tiled_left = open_standard_window($x);
20 my $tiled_right = open_standard_window($x);
21
22 sleep 0.25;
23
24 # Get input focus before creating the floating window
25 my $focus = $x->input_focus;
26
27 # Create a floating window which is smaller than the minimum enforced size of i3
28 my $window = $x->root->create_child(
29     class => WINDOW_CLASS_INPUT_OUTPUT,
30     rect => [ 1, 1, 30, 30],
31     background_color => '#C0C0C0',
32     type => $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY'),
33 );
34
35 isa_ok($window, 'X11::XCB::Window');
36
37 $window->map;
38
39 sleep 1;
40 sleep 0.25;
41 is($x->input_focus, $window->id, 'floating window focused');
42
43 $window->unmap;
44
45 sleep 0.25;
46
47 is($x->input_focus, $focus, 'Focus correctly restored');
48
49 done_testing;