i3/testcases/t/33-size-hints.t
Michael Stapelberg de5286da59 tests: lib/i3test: Remove open_standard_window, introduce open_window
open_window has a better API than open_standard_window. It uses named
parameters and supplies default values for everything you don’t specify. This
way, you can use every feature which X11::XCB::Window supports.
2011-09-24 15:11:37 +01:00

36 lines
767 B
Perl

#!perl
# vim:ts=4:sw=4:expandtab
#
# Checks if size hints are interpreted correctly.
#
use i3test;
my $x = X11::XCB::Connection->new;
my $tmp = fresh_workspace;
ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
my $win = open_window($x, { dont_map => 1 });
# XXX: we should check screen size. in screens with an AR of 2.0,
# this is not a good idea.
my $aspect = X11::XCB::Sizehints::Aspect->new;
$aspect->min_num(600);
$aspect->min_den(300);
$aspect->max_num(600);
$aspect->max_den(300);
$win->_create;
$win->map;
wait_for_map $x;
$win->hints->aspect($aspect);
$x->flush;
sync_with_i3($x);
my $rect = $win->rect;
my $ar = $rect->width / $rect->height;
diag("Aspect ratio = $ar");
ok(($ar > 1.90) && ($ar < 2.10), 'Aspect ratio about 2.0');
done_testing;