]> git.sur5r.net Git - i3/i3/blob - testcases/t/53-floating-originalsize.t
Merge branch 'master' into next
[i3/i3] / testcases / t / 53-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 X11::XCB qw(:all);
7 use i3test;
8
9 my $tmp = fresh_workspace;
10
11 my $x = X11::XCB::Connection->new;
12
13 # Create a floating window which is smaller than the minimum enforced size of i3
14 my $window = open_window($x, { rect => [ 0, 0, 400, 150 ] });
15
16 my ($absolute, $top) = $window->rect;
17
18 ok($window->mapped, 'Window is mapped');
19 cmp_ok($absolute->{width}, '>', 400, 'i3 raised the width');
20 cmp_ok($absolute->{height}, '>', 150, 'i3 raised the height');
21
22 cmd 'floating toggle';
23 sync_with_i3($x);
24
25 ($absolute, $top) = $window->rect;
26
27 diag('new width: ' . $absolute->{width});
28 diag('new height: ' . $absolute->{height});
29
30 # we compare with a tolerance of ± 20 pixels for borders in each direction
31 # (overkill, but hey)
32 cmp_ok($absolute->{width}, '>', 400-20, 'width now > 380');
33 cmp_ok($absolute->{width}, '<', 400+20, 'width now < 420');
34 cmp_ok($absolute->{height}, '>', 150-20, 'height now > 130');
35 cmp_ok($absolute->{height}, '<', 150+20, 'height now < 170');
36
37 #cmp_ok($absolute->{width}, '>=', 75, 'i3 raised the width to 75');
38 #cmp_ok($absolute->{height}, '>=', 50, 'i3 raised the height to 50');
39
40 done_testing;