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 => 16;
11 use Time::HiRes qw(sleep);
13 use Digest::SHA1 qw(sha1_base64);
14 use lib "$FindBin::Bin/lib";
18 use_ok('IO::Socket::UNIX') or BAIL_OUT('Cannot load IO::Socket::UNIX');
19 use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection');
22 my $x = X11::XCB::Connection->new;
24 my $sock = IO::Socket::UNIX->new(Peer => '/tmp/i3-ipc.sock');
25 isa_ok($sock, 'IO::Socket::UNIX');
27 # Switch to the nineth workspace
28 $sock->write(i3test::format_ipc_command("9"));
32 #####################################################################
33 # Create a floating window and see if resizing works
34 #####################################################################
36 # Create a floating window
37 my $window = $x->root->create_child(
38 class => WINDOW_CLASS_INPUT_OUTPUT,
39 rect => [ 0, 0, 30, 30],
40 background_color => '#C0C0C0',
41 # replace the type with 'utility' as soon as the coercion works again in X11::XCB
42 type => $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY'),
45 isa_ok($window, 'X11::XCB::Window');
52 $window->rect(X11::XCB::Rect->new(x => 0, y => 0, width => 100, height => 100));
54 my ($absolute, $top) = $window->rect;
56 # Make sure the width/height are different from what we’re gonna test, so
57 # that the test will work.
58 isnt($absolute->width, 300, 'width != 300');
59 isnt($absolute->height, 500, 'height != 500');
61 $window->rect(X11::XCB::Rect->new(x => 0, y => 0, width => 300, height => 500));
64 ($absolute, $top) = $window->rect;
66 is($absolute->width, 300, 'width = 300');
67 is($absolute->height, 500, 'height = 500');
70 # Test with default border
74 $sock->write(i3test::format_ipc_command("bb"));
79 # Test with 1-px-border
80 $sock->write(i3test::format_ipc_command("bp"));