2 # vim:ts=4:sw=4:expandtab
4 # Please read the following documents before working on tests:
5 # • https://build.i3wm.org/docs/testsuite.html
8 # • https://build.i3wm.org/docs/lib-i3test.html
9 # (alternatively: perldoc ./testcases/lib/i3test.pm)
11 # • https://build.i3wm.org/docs/ipc.html
14 # • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
15 # (unless you are already familiar with Perl)
17 # Test to see if i3 combines the geometry of all children in a split container
18 # when setting the split container to floating
22 my $tmp = fresh_workspace;
27 #####################################################################
28 # open a window with 200x80
29 #####################################################################
31 my $first = open_window({
32 rect => [ 0, 0, 200, 80],
33 background_color => '#FF0000',
38 #####################################################################
39 # Open a second window with 300x90
40 #####################################################################
42 my $second = open_window({
43 rect => [ 0, 0, 300, 90],
44 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');