2 # vim:ts=4:sw=4:expandtab
4 # Please read the following documents before working on tests:
5 # • http://build.i3wm.org/docs/testsuite.html
8 # • http://build.i3wm.org/docs/lib-i3test.html
9 # (alternatively: perldoc ./testcases/lib/i3test.pm)
11 # • http://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;
24 #####################################################################
25 # open a window with 200x80
26 #####################################################################
28 my $first = open_window({
29 rect => [ 0, 0, 200, 80],
30 background_color => '#FF0000',
33 #####################################################################
34 # Open a second window with 300x90
35 #####################################################################
37 my $second = open_window({
38 rect => [ 0, 0, 300, 90],
39 background_color => '#00FF00',
42 #####################################################################
43 # Set the parent to floating
44 #####################################################################
45 cmd 'nop setting floating';
47 cmd 'floating enable';
49 #####################################################################
50 # Get geometry of the first floating node (the split container)
51 #####################################################################
53 my @nodes = @{get_ws($tmp)->{floating_nodes}};
54 my $rect = $nodes[0]->{rect};
56 # we compare the width with ± 20 pixels for borders
57 cmp_ok($rect->{width}, '>', 500-20, 'width now > 480');
58 cmp_ok($rect->{width}, '<', 500+20, 'width now < 520');
59 # we compare the height with ± 40 pixels for decorations
60 cmp_ok($rect->{height}, '>', 90-40, 'width now > 50');
61 cmp_ok($rect->{height}, '<', 90+40, 'width now < 130');