]> git.sur5r.net Git - i3/i3/blob - testcases/t/10-dock.t
less boilerplate by using Test::Kit and -It/lib in Makefile
[i3/i3] / testcases / t / 10-dock.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3
4 use i3test tests => 2;
5 use X11::XCB qw(:all);
6 use Time::HiRes qw(sleep);
7 use List::Util qw(first);
8
9 BEGIN {
10     use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection');
11 }
12
13 my $x = X11::XCB::Connection->new;
14
15 #####################################################################
16 # Create a dock window and see if it gets managed
17 #####################################################################
18
19 my $screens = $x->screens;
20
21 # Get the primary screen
22 my $primary = first { $_->primary } @{$screens};
23
24 # TODO: focus the primary screen before
25
26 my $window = $x->root->create_child(
27     class => WINDOW_CLASS_INPUT_OUTPUT,
28     rect => [ 0, 0, 30, 30],
29     background_color => '#FF0000',
30     type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'),
31 );
32
33 $window->map;
34
35 sleep 0.25;
36
37 my $rect = $window->rect;
38 is($rect->width, $primary->rect->width, 'dock client is as wide as the screen');
39
40 my $fwindow = $x->root->create_child(
41     class => WINDOW_CLASS_INPUT_OUTPUT,
42     rect => [ 0, 0, 30, 30],
43     background_color => '#FF0000',
44     type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'),
45 );
46
47 $fwindow->transient_for($window);
48 $fwindow->map;
49
50 sleep 0.25;
51
52
53 diag( "Testing i3, Perl $], $^X" );