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 i3test tests => 15;
9 use Time::HiRes qw(sleep);
12 use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection');
15 my $x = X11::XCB::Connection->new;
17 my $i3 = i3("/tmp/nestedcons");
18 my $tmp = get_unused_workspace();
19 $i3->command("workspace $tmp")->recv;
21 #####################################################################
22 # Create a floating window and see if resizing works
23 #####################################################################
25 # Create a floating window
26 my $window = $x->root->create_child(
27 class => WINDOW_CLASS_INPUT_OUTPUT,
28 rect => [ 0, 0, 30, 30],
29 background_color => '#C0C0C0',
30 # replace the type with 'utility' as soon as the coercion works again in X11::XCB
31 window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY'),
34 isa_ok($window, 'X11::XCB::Window');
39 # See if configurerequests cause window movements (they should not)
40 my ($a, $t) = $window->rect;
41 $window->rect(X11::XCB::Rect->new(x => $a->x, y => $a->y, width => $a->width, height => $a->height));
44 my ($na, $nt) = $window->rect;
45 is_deeply($na, $a, 'Rects are equal after configurerequest');
48 $window->rect(X11::XCB::Rect->new(x => 0, y => 0, width => 100, height => 100));
50 my ($absolute, $top) = $window->rect;
52 # Make sure the width/height are different from what we’re gonna test, so
53 # that the test will work.
54 isnt($absolute->width, 300, 'width != 300');
55 isnt($absolute->height, 500, 'height != 500');
57 $window->rect(X11::XCB::Rect->new(x => 0, y => 0, width => 300, height => 500));
60 ($absolute, $top) = $window->rect;
62 is($absolute->width, 300, 'width = 300');
63 is($absolute->height, 500, 'height = 500');
66 # Test with default border
70 $i3->command('border none')->recv;
74 # Test with 1-px-border
75 $i3->command('border 1pixel')->recv;