2 # vim:ts=4:sw=4:expandtab
8 use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection');
11 my $x = X11::XCB::Connection->new;
13 my $tmp = fresh_workspace;
15 ####################################################################################
16 # first part: test if a floating window will be correctly positioned above its leader
18 # This is verified by opening two windows, then opening a floating window above the
19 # right one, then above the left one. If the floating windows are all positioned alike,
20 # one of both (depending on your screen resolution) will be positioned wrong.
21 ####################################################################################
23 my $left = open_window($x, { name => 'Left' });
24 my $right = open_window($x, { name => 'Right' });
26 my ($abs, $rgeom) = $right->rect;
28 my $child = open_floating_window($x, {
30 name => 'Child window',
32 $child->client_leader($right);
35 ok(wait_for_map($x), 'child window mapped');
38 ($abs, $cgeom) = $child->rect;
39 cmp_ok($cgeom->x, '>=', $rgeom->x, 'Child X >= right container X');
41 my $child2 = open_floating_window($x, {
43 name => 'Child window 2',
45 $child2->client_leader($left);
48 ok(wait_for_map($x), 'second child window mapped');
50 ($abs, $cgeom) = $child2->rect;
51 cmp_ok(($cgeom->x + $cgeom->width), '<', $rgeom->x, 'child above left window');
53 # check wm_transient_for
54 my $fwindow = open_window($x, { dont_map => 1 });
55 $fwindow->transient_for($right);
58 ok(wait_for_map($x), 'transient window mapped');
60 my ($absolute, $top) = $fwindow->rect;
61 ok($absolute->{x} != 0 && $absolute->{y} != 0, 'i3 did not map it to (0x0)');
64 skip "(workspace placement by client_leader not yet implemented)", 3;
66 #####################################################################
67 # Create a parent window
68 #####################################################################
70 my $window = open_window($x, { dont_map => 1, name => 'Parent window' });
73 ok(wait_for_map($x), 'parent window mapped');
75 #########################################################################
76 # Switch to a different workspace and open a child window. It should be opened
77 # on the old workspace.
78 #########################################################################
81 my $child = open_window($x, { dont_map => 1, name => 'Child window' });
82 $child->client_leader($window);
85 ok(wait_for_map($x), 'child window mapped');
87 isnt($x->input_focus, $child->id, "Child window focused");
92 is($x->input_focus, $child->id, "Child window focused");