]> git.sur5r.net Git - i3/i3/blob - testcases/t/155-floating-split-size.t
Merge branch 'master' into next
[i3/i3] / testcases / t / 155-floating-split-size.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 #
4 # Test to see if i3 combines the geometry of all children in a split container
5 # when setting the split container to floating
6 #
7 use i3test;
8
9 my $tmp = fresh_workspace;
10
11 #####################################################################
12 # open a window with 200x80
13 #####################################################################
14
15 my $first = open_window({
16         rect => [ 0, 0, 200, 80],
17         background_color => '#FF0000',
18     });
19
20 #####################################################################
21 # Open a second window with 300x90
22 #####################################################################
23
24 my $second = open_window({
25         rect => [ 0, 0, 300, 90],
26         background_color => '#00FF00',
27     });
28
29 #####################################################################
30 # Set the parent to floating
31 #####################################################################
32 cmd 'nop setting floating';
33 cmd 'focus parent';
34 cmd 'floating enable';
35
36 #####################################################################
37 # Get geometry of the first floating node (the split container)
38 #####################################################################
39
40 my @nodes = @{get_ws($tmp)->{floating_nodes}};
41 my $rect = $nodes[0]->{rect};
42
43 # we compare the width with ± 20 pixels for borders
44 cmp_ok($rect->{width}, '>', 500-20, 'width now > 480');
45 cmp_ok($rect->{width}, '<', 500+20, 'width now < 520');
46 # we compare the height with ± 40 pixels for decorations
47 cmp_ok($rect->{height}, '>', 90-40, 'width now > 50');
48 cmp_ok($rect->{height}, '<', 90+40, 'width now < 130');
49
50 done_testing;