]> git.sur5r.net Git - i3/i3/blob - testcases/t/155-floating-split-size.t
Merge branch 'fix-floating-pos'
[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 X11::XCB qw(:all);
8 use i3test;
9
10 BEGIN {
11     use_ok('X11::XCB::Window');
12 }
13
14 my $x = X11::XCB::Connection->new;
15
16 my $tmp = fresh_workspace;
17
18 #####################################################################
19 # open a window with 200x80
20 #####################################################################
21
22 my $first = open_window($x, {
23         rect => [ 0, 0, 200, 80],
24         background_color => '#FF0000',
25     });
26
27 #####################################################################
28 # Open a second window with 300x90
29 #####################################################################
30
31 my $second = open_window($x, {
32         rect => [ 0, 0, 300, 90],
33         background_color => '#00FF00',
34     });
35
36 #####################################################################
37 # Set the parent to floating
38 #####################################################################
39 cmd 'nop setting floating';
40 cmd 'focus parent';
41 cmd 'floating enable';
42
43 #####################################################################
44 # Get geometry of the first floating node (the split container)
45 #####################################################################
46
47 my @nodes = @{get_ws($tmp)->{floating_nodes}};
48 my $rect = $nodes[0]->{rect};
49
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');
56
57 done_testing;