]> git.sur5r.net Git - i3/i3/blob - testcases/t/14-client-leader.t
bf07b9273c66f3482ecb290b52ab117644e2be74
[i3/i3] / testcases / t / 14-client-leader.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 # Beware that this test uses workspace 9 and 10 to perform some tests (it expects
4 # the workspace to be empty).
5 # TODO: skip it by default?
6
7 use i3test tests => 3;
8 use X11::XCB qw(:all);
9 use Time::HiRes qw(sleep);
10
11 BEGIN {
12     use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection');
13 }
14
15 my $x = X11::XCB::Connection->new;
16 my $i3 = i3;
17
18 # Switch to the nineth workspace
19 $i3->command('9')->recv;
20
21 #####################################################################
22 # Create a parent window
23 #####################################################################
24
25 my $window = $x->root->create_child(
26 class => WINDOW_CLASS_INPUT_OUTPUT,
27 rect => [ 0, 0, 30, 30 ],
28 background_color => '#C0C0C0',
29 );
30
31 $window->name('Parent window');
32 $window->map;
33
34 sleep 0.25;
35
36 #########################################################################
37 # Switch workspace to 10 and open a child window. It should be positioned
38 # on workspace 9.
39 #########################################################################
40 $i3->command('10')->recv;
41
42 my $child = $x->root->create_child(
43 class => WINDOW_CLASS_INPUT_OUTPUT,
44 rect => [ 0, 0, 30, 30 ],
45 background_color => '#C0C0C0',
46 );
47
48 $child->name('Child window');
49 $child->client_leader($window);
50 $child->map;
51
52 sleep 0.25;
53
54 isnt($x->input_focus, $child->id, "Child window focused");
55
56 # Switch back
57 $i3->command('9')->recv;
58
59 is($x->input_focus, $child->id, "Child window focused");