]> git.sur5r.net Git - i3/i3/blob - testcases/t/153-floating-originalsize.t
Merge branch 'master' into next
[i3/i3] / testcases / t / 153-floating-originalsize.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 #
4 # Test if the requested width/height is set after making the window floating.
5 #
6 use i3test;
7
8 my $tmp = fresh_workspace;
9
10 # Create a floating window which is smaller than the minimum enforced size of i3
11 my $window = open_window({ rect => [ 0, 0, 400, 150 ] });
12
13 my ($absolute, $top) = $window->rect;
14
15 ok($window->mapped, 'Window is mapped');
16 cmp_ok($absolute->{width}, '>', 400, 'i3 raised the width');
17 cmp_ok($absolute->{height}, '>', 150, 'i3 raised the height');
18
19 cmd 'floating toggle';
20 sync_with_i3;
21
22 ($absolute, $top) = $window->rect;
23
24 diag('new width: ' . $absolute->{width});
25 diag('new height: ' . $absolute->{height});
26
27 # we compare with a tolerance of ± 20 pixels for borders in each direction
28 # (overkill, but hey)
29 cmp_ok($absolute->{width}, '>', 400-20, 'width now > 380');
30 cmp_ok($absolute->{width}, '<', 400+20, 'width now < 420');
31 cmp_ok($absolute->{height}, '>', 150-20, 'height now > 130');
32 cmp_ok($absolute->{height}, '<', 150+20, 'height now < 170');
33
34 #cmp_ok($absolute->{width}, '>=', 75, 'i3 raised the width to 75');
35 #cmp_ok($absolute->{height}, '>=', 50, 'i3 raised the height to 50');
36
37 done_testing;