]> git.sur5r.net Git - i3/i3/blob - testcases/t/08-focus-stack.t
Test 16 fixed expectation of the (root) focused field to exist in the tree and always...
[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 tests => 4;
7 use X11::XCB qw(:all);
8 use Time::HiRes qw(sleep);
9
10 BEGIN {
11     use_ok('X11::XCB::Window') or BAIL_OUT('Could not load X11::XCB::Window');
12 }
13
14 my $x = X11::XCB::Connection->new;
15
16 my $i3 = i3("/tmp/nestedcons");
17 my $tmp = get_unused_workspace();
18 $i3->command("workspace $tmp")->recv;
19
20
21 $i3->command('split h')->recv;
22 my $tiled_left = i3test::open_standard_window($x);
23 my $tiled_right = i3test::open_standard_window($x);
24
25 sleep 0.25;
26
27 # Get input focus before creating the floating window
28 my $focus = $x->input_focus;
29
30 # Create a floating window which is smaller than the minimum enforced size of i3
31 my $window = $x->root->create_child(
32     class => WINDOW_CLASS_INPUT_OUTPUT,
33     rect => [ 1, 1, 30, 30],
34     background_color => '#C0C0C0',
35     type => $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY'),
36 );
37
38 isa_ok($window, 'X11::XCB::Window');
39
40 $window->map;
41
42 sleep 1;
43 sleep 0.25;
44 is($x->input_focus, $window->id, 'floating window focused');
45
46 $window->unmap;
47
48 sleep 0.25;
49
50 is($x->input_focus, $focus, 'Focus correctly restored');
51
52 diag( "Testing i3, Perl $], $^X" );