File: 04-window.t

package info (click to toggle)
libx11-xcb-perl 0.24-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 960 kB
  • sloc: perl: 3,005; makefile: 5; ansic: 4
file content (52 lines) | stat: -rw-r--r-- 1,120 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!perl
# vim:ts=4:sw=4:expandtab

use Test::More tests => 4;
use Test::Deep;
use Time::HiRes qw(sleep);
use X11::XCB qw(:all);
use Data::Dumper;

BEGIN {
	use_ok('X11::XCB::Connection') or BAIL_OUT('Unable to load X11::XCB::Connection');
	use_ok('X11::XCB::Window');
}

my $x;

SKIP: {
    eval { $x = X11::XCB::Connection->new; };

    skip "Could not setup X11 connection", 2 if $@ or $x->has_error();

    my $root = $x->root;

    isa_ok($root, 'X11::XCB::Window');

SKIP: {
    my $wm_protocols_atom = $x->atom(name => 'WM_PROTOCOLS');
    skip "Connection doesn't support atom WM_PROTOCOLS, maybe related to Xvfb.", 1
        unless $wm_protocols_atom->exists;

    my $rect = $root->rect;

    ok('rect of the root window could be retrieved');

    my $window = $x->root->create_child(
        class => WINDOW_CLASS_INPUT_OUTPUT,
        rect => [0, 0, 30, 30],
        background_color => '#C0C0C0',
    );

    $window->map;
    sleep 0.25;

    $window->add_hint('urgency');
    sleep 1;
    $window->delete_hint('urgency');
    sleep 1;
} # end SKIP WM_PROTOCOLS

}

diag( "Testing X11::XCB, Perl $], $^X" );