]> git.sur5r.net Git - i3/i3/blob - testcases/t/04-floating.t
implement configure requests, adapt testcase
[i3/i3] / testcases / t / 04-floating.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3
4 use i3test tests => 11;
5 use X11::XCB qw(:all);
6 use Time::HiRes qw(sleep);
7
8 BEGIN {
9     use_ok('X11::XCB::Window');
10 }
11
12 my $x = X11::XCB::Connection->new;
13
14 # Create a floating window which is smaller than the minimum enforced size of i3
15 my $window = $x->root->create_child(
16     class => WINDOW_CLASS_INPUT_OUTPUT,
17     rect => [ 0, 0, 30, 30],
18     background_color => '#C0C0C0',
19     # replace the type with 'utility' as soon as the coercion works again in X11::XCB
20     window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY'),
21 );
22
23 isa_ok($window, 'X11::XCB::Window');
24
25 $window->map;
26
27 sleep(0.25);
28
29 my ($absolute, $top) = $window->rect;
30
31 ok($window->mapped, 'Window is mapped');
32 cmp_ok($absolute->{width}, '>=', 75, 'i3 raised the width to 75');
33 cmp_ok($absolute->{height}, '>=', 50, 'i3 raised the height to 50');
34
35 ok($absolute->{x} != 0 && $absolute->{y} != 0, 'i3 did not map it to (0x0)');
36
37 $window->unmap;
38
39 $window = $x->root->create_child(
40     class => WINDOW_CLASS_INPUT_OUTPUT,
41     rect => [ 1, 1, 80, 90],
42     background_color => '#C0C0C0',
43     window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY'),
44 );
45
46 isa_ok($window, 'X11::XCB::Window');
47
48 $window->map;
49
50 sleep(0.25);
51
52 ($absolute, $top) = $window->rect;
53
54 cmp_ok($absolute->{width}, '==', 80, "i3 let the width at 80");
55 cmp_ok($absolute->{height}, '==', 90, "i3 let the height at 90");
56
57 cmp_ok($top->{x}, '==', 1, 'i3 mapped it to x=1');
58 cmp_ok($top->{y}, '==', 1, 'i3 mapped it to y=1');
59
60 $window->unmap;
61
62 diag( "Testing i3, Perl $], $^X" );