]> git.sur5r.net Git - i3/i3/blob - testcases/t/33-size-hints.t
Merge branch 'master' into next
[i3/i3] / testcases / t / 33-size-hints.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 #
4 # Checks if size hints are interpreted correctly.
5 #
6 use i3test;
7
8 my $x = X11::XCB::Connection->new;
9
10 my $tmp = fresh_workspace;
11
12 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
13
14 my $win = open_window($x, { dont_map => 1 });
15 # XXX: we should check screen size. in screens with an AR of 2.0,
16 # this is not a good idea.
17 my $aspect = X11::XCB::Sizehints::Aspect->new;
18 $aspect->min_num(600);
19 $aspect->min_den(300);
20 $aspect->max_num(600);
21 $aspect->max_den(300);
22 $win->_create;
23 $win->map;
24 wait_for_map $x;
25 $win->hints->aspect($aspect);
26 $x->flush;
27
28 sync_with_i3($x);
29
30 my $rect = $win->rect;
31 my $ar = $rect->width / $rect->height;
32 diag("Aspect ratio = $ar");
33 ok(($ar > 1.90) && ($ar < 2.10), 'Aspect ratio about 2.0');
34
35 done_testing;