2011-03-03 16:22:22 +01:00
|
|
|
#!perl
|
|
|
|
# vim:ts=4:sw=4:expandtab
|
|
|
|
#
|
2012-09-10 14:09:01 +02:00
|
|
|
# Please read the following documents before working on tests:
|
|
|
|
# • http://build.i3wm.org/docs/testsuite.html
|
|
|
|
# (or docs/testsuite)
|
|
|
|
#
|
|
|
|
# • http://build.i3wm.org/docs/lib-i3test.html
|
|
|
|
# (alternatively: perldoc ./testcases/lib/i3test.pm)
|
|
|
|
#
|
|
|
|
# • http://build.i3wm.org/docs/ipc.html
|
|
|
|
# (or docs/ipc)
|
|
|
|
#
|
|
|
|
# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
|
|
|
|
# (unless you are already familiar with Perl)
|
|
|
|
#
|
2011-03-03 16:22:22 +01:00
|
|
|
# Test if the requested width/height is set after making the window floating.
|
|
|
|
#
|
|
|
|
use i3test;
|
|
|
|
|
2011-03-09 20:25:17 +01:00
|
|
|
my $tmp = fresh_workspace;
|
2011-03-03 16:22:22 +01:00
|
|
|
|
|
|
|
# Create a floating window which is smaller than the minimum enforced size of i3
|
2011-11-22 00:47:32 +01:00
|
|
|
my $window = open_window({ rect => [ 0, 0, 400, 150 ] });
|
2011-03-03 16:22:22 +01:00
|
|
|
|
|
|
|
my ($absolute, $top) = $window->rect;
|
|
|
|
|
|
|
|
ok($window->mapped, 'Window is mapped');
|
|
|
|
cmp_ok($absolute->{width}, '>', 400, 'i3 raised the width');
|
|
|
|
cmp_ok($absolute->{height}, '>', 150, 'i3 raised the height');
|
|
|
|
|
2011-06-10 02:06:47 +02:00
|
|
|
cmd 'floating toggle';
|
2011-11-22 01:13:37 +01:00
|
|
|
sync_with_i3;
|
2011-03-03 16:22:22 +01:00
|
|
|
|
|
|
|
($absolute, $top) = $window->rect;
|
|
|
|
|
|
|
|
diag('new width: ' . $absolute->{width});
|
|
|
|
diag('new height: ' . $absolute->{height});
|
|
|
|
|
|
|
|
# we compare with a tolerance of ± 20 pixels for borders in each direction
|
|
|
|
# (overkill, but hey)
|
|
|
|
cmp_ok($absolute->{width}, '>', 400-20, 'width now > 380');
|
|
|
|
cmp_ok($absolute->{width}, '<', 400+20, 'width now < 420');
|
|
|
|
cmp_ok($absolute->{height}, '>', 150-20, 'height now > 130');
|
|
|
|
cmp_ok($absolute->{height}, '<', 150+20, 'height now < 170');
|
|
|
|
|
|
|
|
#cmp_ok($absolute->{width}, '>=', 75, 'i3 raised the width to 75');
|
|
|
|
#cmp_ok($absolute->{height}, '>=', 50, 'i3 raised the height to 50');
|
|
|
|
|
|
|
|
done_testing;
|