2 # vim:ts=4:sw=4:expandtab
4 # Test to see if i3 combines the geometry of all children in a split container
5 # when setting the split container to floating
11 use_ok('X11::XCB::Window');
14 my $x = X11::XCB::Connection->new;
16 my $tmp = fresh_workspace;
18 #####################################################################
19 # open a window with 200x80
20 #####################################################################
22 my $first = open_window($x, {
23 rect => [ 0, 0, 200, 80],
24 background_color => '#FF0000',
27 #####################################################################
28 # Open a second window with 300x90
29 #####################################################################
31 my $second = open_window($x, {
32 rect => [ 0, 0, 300, 90],
33 background_color => '#00FF00',
36 #####################################################################
37 # Set the parent to floating
38 #####################################################################
39 cmd 'nop setting floating';
41 cmd 'floating enable';
43 #####################################################################
44 # Get geometry of the first floating node (the split container)
45 #####################################################################
47 my @nodes = @{get_ws($tmp)->{floating_nodes}};
48 my $rect = $nodes[0]->{rect};
50 # we compare the width with ± 20 pixels for borders
51 cmp_ok($rect->{width}, '>', 500-20, 'width now > 480');
52 cmp_ok($rect->{width}, '<', 500+20, 'width now < 520');
53 # we compare the height with ± 40 pixels for decorations
54 cmp_ok($rect->{height}, '>', 90-40, 'width now > 50');
55 cmp_ok($rect->{height}, '<', 90+40, 'width now < 130');