2 # vim:ts=4:sw=4:expandtab
6 my $tmp = fresh_workspace;
8 ####################################################################################
9 # first part: test if a floating window will be correctly positioned above its leader
11 # This is verified by opening two windows, then opening a floating window above the
12 # right one, then above the left one. If the floating windows are all positioned alike,
13 # one of both (depending on your screen resolution) will be positioned wrong.
14 ####################################################################################
16 my $left = open_window({ name => 'Left' });
17 my $right = open_window({ name => 'Right' });
19 my ($abs, $rgeom) = $right->rect;
21 my $child = open_floating_window({
23 name => 'Child window',
25 $child->client_leader($right);
28 ok(wait_for_map($child), 'child window mapped');
31 ($abs, $cgeom) = $child->rect;
32 cmp_ok($cgeom->x, '>=', $rgeom->x, 'Child X >= right container X');
34 my $child2 = open_floating_window({
36 name => 'Child window 2',
38 $child2->client_leader($left);
41 ok(wait_for_map($child2), 'second child window mapped');
43 ($abs, $cgeom) = $child2->rect;
44 cmp_ok(($cgeom->x + $cgeom->width), '<', $rgeom->x, 'child above left window');
46 # check wm_transient_for
47 my $fwindow = open_window({ dont_map => 1 });
48 $fwindow->transient_for($right);
51 ok(wait_for_map($fwindow), 'transient window mapped');
53 my ($absolute, $top) = $fwindow->rect;
54 ok($absolute->{x} != 0 && $absolute->{y} != 0, 'i3 did not map it to (0x0)');
57 skip "(workspace placement by client_leader not yet implemented)", 3;
59 #####################################################################
60 # Create a parent window
61 #####################################################################
63 my $window = open_window({ dont_map => 1, name => 'Parent window' });
66 ok(wait_for_map($window), 'parent window mapped');
68 #########################################################################
69 # Switch to a different workspace and open a child window. It should be opened
70 # on the old workspace.
71 #########################################################################
74 my $child = open_window({ dont_map => 1, name => 'Child window' });
75 $child->client_leader($window);
78 ok(wait_for_map($child), 'child window mapped');
80 isnt($x->input_focus, $child->id, "Child window focused");
85 is($x->input_focus, $child->id, "Child window focused");