]> git.sur5r.net Git - i3/i3/blob - testcases/t/133-size-hints.t
Merge branch 'release-4.16.1'
[i3/i3] / testcases / t / 133-size-hints.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 #
4 # Please read the following documents before working on tests:
5 # • https://build.i3wm.org/docs/testsuite.html
6 #   (or docs/testsuite)
7 #
8 # • https://build.i3wm.org/docs/lib-i3test.html
9 #   (alternatively: perldoc ./testcases/lib/i3test.pm)
10 #
11 # • https://build.i3wm.org/docs/ipc.html
12 #   (or docs/ipc)
13 #
14 # • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
15 #   (unless you are already familiar with Perl)
16 #
17 # Checks if size hints are interpreted correctly.
18 #
19 use i3test;
20
21 my $tmp = fresh_workspace;
22
23 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
24
25 my $win = open_window({ dont_map => 1 });
26 # XXX: we should check screen size. in screens with an AR of 2.0,
27 # this is not a good idea.
28 my $aspect = X11::XCB::Sizehints::Aspect->new;
29 $aspect->min_num(600);
30 $aspect->min_den(300);
31 $aspect->max_num(600);
32 $aspect->max_den(300);
33 $win->_create;
34 $win->map;
35 wait_for_map $win;
36 $win->hints->aspect($aspect);
37 $x->flush;
38
39 sync_with_i3;
40
41 my $rect = $win->rect;
42 my $ar = $rect->width / $rect->height;
43 diag("Aspect ratio = $ar");
44 ok(($ar > 1.90) && ($ar < 2.10), 'Aspect ratio about 2.0');
45
46 done_testing;