]> git.sur5r.net Git - i3/i3/blob - testcases/t/155-floating-split-size.t
Fix incorrect y-offset for text in i3bar
[i3/i3] / testcases / t / 155-floating-split-size.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 #
4 # Please read the following documents before working on tests:
5 # • http://build.i3wm.org/docs/testsuite.html
6 #   (or docs/testsuite)
7 #
8 # • http://build.i3wm.org/docs/lib-i3test.html
9 #   (alternatively: perldoc ./testcases/lib/i3test.pm)
10 #
11 # • http://build.i3wm.org/docs/ipc.html
12 #   (or docs/ipc)
13 #
14 # • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
15 #   (unless you are already familiar with Perl)
16 #
17 # Test to see if i3 combines the geometry of all children in a split container
18 # when setting the split container to floating
19 #
20 use i3test;
21
22 my $tmp = fresh_workspace;
23
24 #####################################################################
25 # open a window with 200x80
26 #####################################################################
27
28 my $first = open_window({
29         rect => [ 0, 0, 200, 80],
30         background_color => '#FF0000',
31     });
32
33 #####################################################################
34 # Open a second window with 300x90
35 #####################################################################
36
37 my $second = open_window({
38         rect => [ 0, 0, 300, 90],
39         background_color => '#00FF00',
40     });
41
42 #####################################################################
43 # Set the parent to floating
44 #####################################################################
45 cmd 'nop setting floating';
46 cmd 'focus parent';
47 cmd 'floating enable';
48
49 #####################################################################
50 # Get geometry of the first floating node (the split container)
51 #####################################################################
52
53 my @nodes = @{get_ws($tmp)->{floating_nodes}};
54 my $rect = $nodes[0]->{rect};
55
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');
62
63 done_testing;