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;
15 my $i3 = i3(get_socket_path());
17 my $tmp = fresh_workspace;
19 #####################################################################
20 # open a window with 200x80
21 #####################################################################
23 my $first = $x->root->create_child(
24 class => WINDOW_CLASS_INPUT_OUTPUT,
25 rect => [ 0, 0, 200, 80],
26 background_color => '#FF0000',
33 #####################################################################
34 # Open a second window with 300x90
35 #####################################################################
37 my $second = $x->root->create_child(
38 class => WINDOW_CLASS_INPUT_OUTPUT,
39 rect => [ 0, 0, 300, 90],
40 background_color => '#00FF00',
47 #####################################################################
48 # Set the parent to floating
49 #####################################################################
50 cmd 'nop setting floating';
52 cmd 'floating enable';
54 #####################################################################
55 # Get geometry of the first floating node (the split container)
56 #####################################################################
58 my @nodes = @{get_ws($tmp)->{floating_nodes}};
59 my $rect = $nodes[0]->{rect};
61 # we compare the width with ± 20 pixels for borders
62 cmp_ok($rect->{width}, '>', 500-20, 'width now > 480');
63 cmp_ok($rect->{width}, '<', 500+20, 'width now < 520');
64 # we compare the height with ± 40 pixels for decorations
65 cmp_ok($rect->{height}, '>', 90-40, 'width now > 50');
66 cmp_ok($rect->{height}, '<', 90+40, 'width now < 130');