2 # vim:ts=4:sw=4:expandtab
4 # Please read the following documents before working on tests:
5 # • http://build.i3wm.org/docs/testsuite.html
8 # • http://build.i3wm.org/docs/lib-i3test.html
9 # (alternatively: perldoc ./testcases/lib/i3test.pm)
11 # • http://build.i3wm.org/docs/ipc.html
14 # • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
15 # (unless you are already familiar with Perl)
17 # Test if the requested width/height is set after making the window floating.
21 my $tmp = fresh_workspace;
23 # Create a floating window which is smaller than the minimum enforced size of i3
24 my $window = open_window({ rect => [ 0, 0, 400, 150 ] });
26 my ($absolute, $top) = $window->rect;
28 ok($window->mapped, 'Window is mapped');
29 cmp_ok($absolute->{width}, '>', 400, 'i3 raised the width');
30 cmp_ok($absolute->{height}, '>', 150, 'i3 raised the height');
32 cmd 'floating toggle';
35 ($absolute, $top) = $window->rect;
37 diag('new width: ' . $absolute->{width});
38 diag('new height: ' . $absolute->{height});
40 # we compare with a tolerance of ± 20 pixels for borders in each direction
42 cmp_ok($absolute->{width}, '>', 400-20, 'width now > 380');
43 cmp_ok($absolute->{width}, '<', 400+20, 'width now < 420');
44 cmp_ok($absolute->{height}, '>', 150-20, 'height now > 130');
45 cmp_ok($absolute->{height}, '<', 150+20, 'height now < 170');
47 #cmp_ok($absolute->{width}, '>=', 75, 'i3 raised the width to 75');
48 #cmp_ok($absolute->{height}, '>=', 50, 'i3 raised the height to 50');