2 # vim:ts=4:sw=4:expandtab
3 # Beware that this test uses workspace 9 to perform some tests (it expects
4 # the workspace to be empty).
5 # TODO: skip it by default?
7 use Test::More tests => 15;
11 use Time::HiRes qw(sleep);
13 use Digest::SHA1 qw(sha1_base64);
14 use lib "$FindBin::Bin/lib";
19 use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection');
22 my $x = X11::XCB::Connection->new;
26 # Switch to the nineth workspace
27 $i3->command('9')->recv;
29 #####################################################################
30 # Create a floating window and see if resizing works
31 #####################################################################
33 # Create a floating window
34 my $window = $x->root->create_child(
35 class => WINDOW_CLASS_INPUT_OUTPUT,
36 rect => [ 0, 0, 30, 30],
37 background_color => '#C0C0C0',
38 # replace the type with 'utility' as soon as the coercion works again in X11::XCB
39 type => $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY'),
42 isa_ok($window, 'X11::XCB::Window');
47 # See if configurerequests cause window movements (they should not)
48 my ($a, $t) = $window->rect;
49 $window->rect(X11::XCB::Rect->new(x => $a->x, y => $a->y, width => $a->width, height => $a->height));
52 my ($na, $nt) = $window->rect;
53 is_deeply($na, $a, 'Rects are equal after configurerequest');
56 $window->rect(X11::XCB::Rect->new(x => 0, y => 0, width => 100, height => 100));
58 my ($absolute, $top) = $window->rect;
60 # Make sure the width/height are different from what we’re gonna test, so
61 # that the test will work.
62 isnt($absolute->width, 300, 'width != 300');
63 isnt($absolute->height, 500, 'height != 500');
65 $window->rect(X11::XCB::Rect->new(x => 0, y => 0, width => 300, height => 500));
68 ($absolute, $top) = $window->rect;
70 is($absolute->width, 300, 'width = 300');
71 is($absolute->height, 500, 'height = 500');
74 # Test with default border
78 $i3->command('bb')->recv;
82 # Test with 1-px-border
83 $i3->command('bp')->recv;