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