]> git.sur5r.net Git - i3/i3/blob - testcases/t/33-size-hints.t
Merge branch 'cloexec-errorlog'
[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 $i3 = i3(get_socket_path());
9
10 my $x = X11::XCB::Connection->new;
11
12 my $tmp = fresh_workspace;
13
14 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
15
16 my $win = $x->root->create_child(
17     class => WINDOW_CLASS_INPUT_OUTPUT,
18     rect => X11::XCB::Rect->new(x => 0, y => 0, width => 30, height => 30),
19     background_color => '#C0C0C0',
20 );
21
22 # XXX: we should check screen size. in screens with an AR of 2.0,
23 # this is not a good idea.
24 my $aspect = X11::XCB::Sizehints::Aspect->new;
25 $aspect->min_num(600);
26 $aspect->min_den(300);
27 $aspect->max_num(600);
28 $aspect->max_den(300);
29 $win->_create;
30 $win->map;
31 sleep 0.25;
32 $win->hints->aspect($aspect);
33 $x->flush;
34
35 sleep 0.25;
36
37 my $rect = $win->rect;
38 my $ar = $rect->width / $rect->height;
39 diag("Aspect ratio = $ar");
40 ok(($ar > 1.90) && ($ar < 2.10), 'Aspect ratio about 2.0');
41
42 done_testing;