]> git.sur5r.net Git - i3/i3/blobdiff - testcases/t/005-floating.t
Merge branch 'master' into next
[i3/i3] / testcases / t / 005-floating.t
index 688de40a5634a5e0d8250ea44715e985d8d5a4dd..db5fb6db5ed564bf27a35c731724af7a32220134 100644 (file)
@@ -2,30 +2,12 @@
 # vim:ts=4:sw=4:expandtab
 
 use i3test;
-use X11::XCB qw(:all);
-
-BEGIN {
-    use_ok('X11::XCB::Window');
-}
-
-my $x = X11::XCB::Connection->new;
 
 # Create a floating window which is smaller than the minimum enforced size of i3
-my $window = $x->root->create_child(
-    class => WINDOW_CLASS_INPUT_OUTPUT,
-    rect => [ 0, 0, 30, 30],
-    background_color => '#C0C0C0',
-    # replace the type with 'utility' as soon as the coercion works again in X11::XCB
-    window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY'),
-    event_mask => [ 'structure_notify' ],
-);
+my $window = open_floating_window;
 
 isa_ok($window, 'X11::XCB::Window');
 
-$window->map;
-
-wait_for_map $x;
-
 my ($absolute, $top) = $window->rect;
 
 ok($window->mapped, 'Window is mapped');
@@ -36,20 +18,10 @@ ok($absolute->{x} != 0 && $absolute->{y} != 0, 'i3 did not map it to (0x0)');
 
 $window->unmap;
 
-$window = $x->root->create_child(
-    class => WINDOW_CLASS_INPUT_OUTPUT,
-    rect => [ 20, 20, 80, 90],
-    background_color => '#C0C0C0',
-    window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY'),
-    event_mask => [ 'structure_notify' ],
-);
+$window = open_floating_window(rect => [ 20, 20, 80, 90 ]);
 
 isa_ok($window, 'X11::XCB::Window');
 
-$window->map;
-
-wait_for_map $x;
-
 ($absolute, $top) = $window->rect;
 
 cmp_ok($absolute->{width}, '==', 80, "i3 let the width at 80");
@@ -65,21 +37,12 @@ $window->unmap;
 # at least the size of its initial geometry
 #####################################################################
 
-$window = $x->root->create_child(
-    class => WINDOW_CLASS_INPUT_OUTPUT,
-    rect => [ 1, 1, 80, 90],
-    background_color => '#C0C0C0',
-    #window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY'),
-    event_mask => [ 'structure_notify' ],
-);
+$window = open_window(rect => [ 1, 1, 80, 90 ]);
 
 isa_ok($window, 'X11::XCB::Window');
 
-$window->map;
-
-wait_for_map $x;
-
 cmd 'floating enable';
+sync_with_i3;
 
 ($absolute, $top) = $window->rect;