2 # vim:ts=4:sw=4:expandtab
8 use_ok('X11::XCB::Window');
11 my $x = X11::XCB::Connection->new;
13 # Create a floating window which is smaller than the minimum enforced size of i3
14 my $window = $x->root->create_child(
15 class => WINDOW_CLASS_INPUT_OUTPUT,
16 rect => [ 0, 0, 30, 30],
17 background_color => '#C0C0C0',
18 # replace the type with 'utility' as soon as the coercion works again in X11::XCB
19 window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY'),
22 isa_ok($window, 'X11::XCB::Window');
28 my ($absolute, $top) = $window->rect;
30 ok($window->mapped, 'Window is mapped');
31 cmp_ok($absolute->{width}, '>=', 75, 'i3 raised the width to 75');
32 cmp_ok($absolute->{height}, '>=', 50, 'i3 raised the height to 50');
34 ok($absolute->{x} != 0 && $absolute->{y} != 0, 'i3 did not map it to (0x0)');
38 $window = $x->root->create_child(
39 class => WINDOW_CLASS_INPUT_OUTPUT,
40 rect => [ 1, 1, 80, 90],
41 background_color => '#C0C0C0',
42 window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY'),
45 isa_ok($window, 'X11::XCB::Window');
51 ($absolute, $top) = $window->rect;
53 cmp_ok($absolute->{width}, '==', 80, "i3 let the width at 80");
54 cmp_ok($absolute->{height}, '==', 90, "i3 let the height at 90");
56 # We need to compare the position with decorations due to the way
57 # we do decoration rendering (on the parent frame) in the tree branch
58 cmp_ok($top->{x}, '==', 1, 'i3 mapped it to x=1');
59 cmp_ok($top->{y}, '==', 19, 'i3 mapped it to y=18');
63 #####################################################################
64 # check that a tiling window which is then made floating still has
65 # at least the size of its initial geometry
66 #####################################################################
68 $window = $x->root->create_child(
69 class => WINDOW_CLASS_INPUT_OUTPUT,
70 rect => [ 1, 1, 80, 90],
71 background_color => '#C0C0C0',
72 #window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY'),
75 isa_ok($window, 'X11::XCB::Window');
81 cmd 'floating enable';
83 ($absolute, $top) = $window->rect;
85 cmp_ok($absolute->{width}, '==', 80, "i3 let the width at 80");
86 cmp_ok($absolute->{height}, '==', 90, "i3 let the height at 90");