]> git.sur5r.net Git - i3/i3/commitdiff
Merge branch 'testsuite' into next
authorMichael Stapelberg <michael@stapelberg.de>
Wed, 23 Nov 2011 00:04:53 +0000 (00:04 +0000)
committerMichael Stapelberg <michael@stapelberg.de>
Wed, 23 Nov 2011 00:04:53 +0000 (00:04 +0000)
40 files changed:
.gitignore
testcases/Makefile.PL
testcases/lib/i3test.pm
testcases/t/001-tile.t
testcases/t/002-i3-sync.t
testcases/t/003-ipc.t
testcases/t/005-floating.t
testcases/t/100-fullscreen.t
testcases/t/101-focus.t
testcases/t/102-dock.t
testcases/t/104-focus-stack.t
testcases/t/111-goto.t
testcases/t/112-floating-resize.t
testcases/t/113-urgent.t
testcases/t/114-client-leader.t
testcases/t/116-nestedcons.t
testcases/t/119-match.t
testcases/t/124-move.t
testcases/t/133-size-hints.t
testcases/t/135-floating-focus.t
testcases/t/136-floating-ws-empty.t
testcases/t/137-floating-unmap.t
testcases/t/138-floating-attach.t
testcases/t/139-ws-numbers.t
testcases/t/140-focus-lost.t
testcases/t/141-resize.t
testcases/t/146-floating-reinsert.t
testcases/t/153-floating-originalsize.t
testcases/t/156-fullscreen-focus.t
testcases/t/162-regress-dock-urgent.t
testcases/t/163-wm-state.t
testcases/t/164-kill-win-vs-client.t
testcases/t/165-for_window.t
testcases/t/166-assign.t
testcases/t/167-workspace_layout.t
testcases/t/170-force_focus_wrapping.t
testcases/t/172-start-on-named-ws.t
testcases/t/173-get-marks.t
testcases/t/174-border-config.t
testcases/t/175-startup-notification.t

index cad6ad9a2120daffdde2a58c3b705fa253c0a77a..b641592b9069e8222382d3bd2ca23d512753cf52 100644 (file)
@@ -7,6 +7,7 @@ loglevels.tmp
 *.gcno
 testcases/testsuite-*
 testcases/latest
+testcases/Makefile
 *.output
 *.tab.*
 *.yy.c
index fd7b5e0d0cca229c66ae9cc2ea7548e734136d91..eb0f73a45dd3076eb0272ae9e182e54488eade00 100755 (executable)
@@ -10,10 +10,7 @@ WriteMakefile(
         'AnyEvent'     => 0,
         'AnyEvent::I3' => '0.09',
         'X11::XCB'     => '0.03',
-        'Test::Most'   => 0,
-        'Test::Deep'   => 0,
-       'EV'           => 0,
-       'Inline'       => 0,
+        'Inline'       => 0,
     },
     PM => {}, # do not install any files from this directory
     clean => {
index 1ddaa52b0d5e6e832d83a23508f676f0fab51a7f..0f2f2e07e979dd5156d3d75973d96efdcc340eb5 100644 (file)
@@ -8,7 +8,6 @@ use X11::XCB::Rect;
 use X11::XCB::Window;
 use X11::XCB qw(:all);
 use AnyEvent::I3;
-use EV;
 use List::Util qw(first);
 use Time::HiRes qw(sleep);
 use Cwd qw(abs_path);
@@ -61,15 +60,14 @@ sub import {
     my $class = shift;
     my $pkg = caller;
 
-    my $test_most_args = @_ ? "qw(@_)" : "";
+    my $test_more_args = @_ ? "qw(@_)" : "";
     local $@;
     eval << "__";
 package $pkg;
-use Test::Most $test_most_args;
+use Test::More $test_more_args;
 use Data::Dumper;
 use AnyEvent::I3;
 use Time::HiRes qw(sleep);
-use Test::Deep qw(eq_deeply cmp_deeply);
 __
     $tester->bail_out("$@") if $@;
     feature->import(":5.10");
@@ -95,11 +93,12 @@ sub wait_for_event {
 
     my $cv = AE::cv;
 
-    my $prep = EV::prepare sub {
-        $x->flush;
-    };
+    $x->flush;
+
+    # unfortunately, there is no constant for this
+    my $ae_read = 0;
 
-    my $check = EV::check sub {
+    my $guard = AE::io $x->get_file_descriptor, $ae_read, sub {
         while (defined(my $event = $x->poll_for_event)) {
             if ($cb->($event)) {
                 $cv->send(1);
@@ -108,15 +107,12 @@ sub wait_for_event {
         }
     };
 
-    my $watcher = EV::io $x->get_file_descriptor, EV::READ, sub {
-        # do nothing, we only need this watcher so that EV picks up the events
-    };
-
     # Trigger timeout after $timeout seconds (can be fractional)
     my $t = AE::timer $timeout, 0, sub { warn "timeout ($timeout secs)"; $cv->send(0) };
 
     my $result = $cv->recv;
     undef $t;
+    undef $guard;
     return $result;
 }
 
@@ -139,7 +135,7 @@ sub wait_for_unmap {
     wait_for_event 2, sub {
         $_[0]->{response_type} == UNMAP_NOTIFY # and $_[0]->{window} == $id
     };
-    sync_with_i3($x);
+    sync_with_i3();
 }
 
 #
@@ -173,15 +169,13 @@ sub open_window {
 
     $window->map;
     wait_for_map($window);
-    # We sync with i3 here to make sure $x->input_focus is updated.
-    sync_with_i3($x);
     return $window;
 }
 
 # Thin wrapper around open_window which sets window_type to
 # _NET_WM_WINDOW_TYPE_UTILITY to make the window floating.
 sub open_floating_window {
-    my ($x, $args) = @_;
+    my ($args) = @_;
     my %args = ($args ? %$args : ());
 
     $args{window_type} = $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY');
@@ -325,8 +319,6 @@ sub focused_ws {
 # See also docs/testsuite for a long explanation
 #
 sub sync_with_i3 {
-    my ($x) = @_;
-
     # Since we need a (mapped) window for receiving a ClientMessage, we create
     # one on the first call of sync_with_i3. It will be re-used in all
     # subsequent calls.
@@ -470,7 +462,7 @@ use parent 'X11::XCB::Connection';
 
 sub input_focus {
     my $self = shift;
-    i3test::sync_with_i3($self);
+    i3test::sync_with_i3();
 
     return $self->SUPER::input_focus(@_);
 }
index 066bc64045397870058a5af14e0793eab93fc46d..460cbd9042f75251595d49e61c89f7cd392d5018 100644 (file)
@@ -21,6 +21,6 @@ $window->map;
 sleep(0.25);
 
 my $new_rect = $window->rect;
-ok(!eq_deeply($new_rect, $original_rect), "Window got repositioned");
+ok(!eq_hash($new_rect, $original_rect), "Window got repositioned");
 
 done_testing;
index 75871f9deaa190850c93aab1b09a898c92407311..1377ee942407f8c615273212ea82e563b1134441 100644 (file)
@@ -5,7 +5,7 @@
 #
 use i3test;
 
-my $result = sync_with_i3($x);
+my $result = sync_with_i3;
 ok($result, 'syncing was successful');
 
 done_testing;
index 477b7163a64f3bebdeb677d342af59dd675b6e82..34359f20a7e28410378666bbd0f2c3665fa12295 100644 (file)
@@ -17,7 +17,7 @@ my $focus = $x->input_focus;
 # Switch to another workspace
 fresh_workspace;
 
-sync_with_i3($x);
+sync_with_i3;
 my $new_focus = $x->input_focus;
 isnt($focus, $new_focus, "Focus changed");
 
index ac6623f2b383f8108b0a339170397bbab4208dd1..6de3ea8060e1bb5e444f69f717ee4f641ff59a49 100644 (file)
@@ -76,7 +76,7 @@ $window->map;
 wait_for_map $window;
 
 cmd 'floating enable';
-sync_with_i3($x);
+sync_with_i3;
 
 ($absolute, $top) = $window->rect;
 
index f5fb66932d3f66c246fc7d706ec1925da3a3f177..4a8f87a75dc7ad7fe46b7f86e00d117c23472e6c 100644 (file)
@@ -51,15 +51,15 @@ wait_for_map $window;
 cmd 'open';
 
 my $new_rect = $window->rect;
-ok(!eq_deeply($new_rect, $original_rect), "Window got repositioned");
+ok(!eq_hash($new_rect, $original_rect), "Window got repositioned");
 $original_rect = $new_rect;
 
 $window->fullscreen(1);
 
-sync_with_i3($x);
+sync_with_i3;
 
 $new_rect = $window->rect;
-ok(!eq_deeply($new_rect, $original_rect), "Window got repositioned after fullscreen");
+ok(!eq_hash($new_rect, $original_rect), "Window got repositioned after fullscreen");
 
 my $orect = $output->{rect};
 my $wrect = $new_rect;
@@ -98,7 +98,7 @@ $window->map;
 wait_for_map $window;
 
 $new_rect = $window->rect;
-ok(!eq_deeply($new_rect, $original_rect), "Window got repositioned after fullscreen");
+ok(!eq_hash($new_rect, $original_rect), "Window got repositioned after fullscreen");
 ok($window->mapped, "Window is mapped after opening it in fullscreen mode");
 
 $wrect = $new_rect;
@@ -123,20 +123,20 @@ my $swindow = $x->root->create_child(
 
 $swindow->map;
 
-sync_with_i3($x);
+sync_with_i3;
 
 ok(!$swindow->mapped, 'window not mapped while fullscreen window active');
 
 $new_rect = $swindow->rect;
-ok(!eq_deeply($new_rect, $original_rect), "Window got repositioned");
+ok(!eq_hash($new_rect, $original_rect), "Window got repositioned");
 
 $swindow->fullscreen(1);
-sync_with_i3($x);
+sync_with_i3;
 
 is(fullscreen_windows(), 1, 'amount of fullscreen windows');
 
 $window->fullscreen(0);
-sync_with_i3($x);
+sync_with_i3;
 is(fullscreen_windows(), 0, 'amount of fullscreen windows');
 
 ok($swindow->mapped, 'window mapped after other fullscreen ended');
@@ -148,7 +148,7 @@ ok($swindow->mapped, 'window mapped after other fullscreen ended');
 ###########################################################################
 
 $swindow->fullscreen(0);
-sync_with_i3($x);
+sync_with_i3;
 
 is(fullscreen_windows(), 0, 'amount of fullscreen windows after disabling');
 
index 545b9dd05907b948eae7dc4d60ccd9fcff18565c..8a795c46c0a3d4f8a555fa08f5700c0be00b9cf0 100644 (file)
@@ -25,7 +25,6 @@ sub focus_after {
     my $msg = shift;
 
     cmd $msg;
-    sync_with_i3 $x;
     return $x->input_focus;
 }
 
index ce33f052166fdf55e86e3617e34a430ad4b03dfe..20acf49e033ded8426b45b9f54671b06006c618d 100644 (file)
@@ -52,7 +52,7 @@ is($docknode->{rect}->{height}, 30, 'dock node has unchanged height');
 
 $window->rect(X11::XCB::Rect->new(x => 0, y => 0, width => 50, height => 40));
 
-sync_with_i3 $x;
+sync_with_i3;
 
 @docked = get_dock_clients('top');
 is(@docked, 1, 'one dock client found');
index f72cd75faab9d3148ececa6bba3ff1295676349b..3b3fe74d79f5c02a844aa053e005a2a275e327f1 100644 (file)
@@ -15,7 +15,7 @@ my $tiled_right = open_window;
 my $focus = $x->input_focus;
 
 # Create a floating window which is smaller than the minimum enforced size of i3
-my $window = open_floating_window($x);
+my $window = open_floating_window;
 
 is($x->input_focus, $window->id, 'floating window focused');
 
index 5f4d7762702240a05e67f1b07f648059a4524f8f..dd60d9cf200d33964b8471cd306d2e43be3410ae 100644 (file)
@@ -24,7 +24,6 @@ sub focus_after {
     my $msg = shift;
 
     cmd $msg;
-    sync_with_i3($x);
     return $x->input_focus;
 }
 
index a428df4f8b92a58317b653fc16e013660d85ad9d..ff3a1c04e0922cf3b3cd759b278f27894e2f8651 100644 (file)
@@ -9,13 +9,13 @@ fresh_workspace;
 # Create a floating window and see if resizing works
 #####################################################################
 
-my $window = open_floating_window($x);
+my $window = open_floating_window;
 
 # See if configurerequests cause window movements (they should not)
 my ($a, $t) = $window->rect;
 $window->rect(X11::XCB::Rect->new(x => $a->x, y => $a->y, width => $a->width, height => $a->height));
 
-sync_with_i3($x);
+sync_with_i3;
 
 my ($na, $nt) = $window->rect;
 is_deeply($na, $a, 'Rects are equal after configurerequest');
@@ -23,7 +23,7 @@ is_deeply($na, $a, 'Rects are equal after configurerequest');
 sub test_resize {
     $window->rect(X11::XCB::Rect->new(x => 0, y => 0, width => 100, height => 100));
 
-    sync_with_i3($x);
+    sync_with_i3;
 
     my ($absolute, $top) = $window->rect;
 
@@ -34,7 +34,7 @@ sub test_resize {
 
     $window->rect(X11::XCB::Rect->new(x => 0, y => 0, width => 300, height => 500));
 
-    sync_with_i3($x);
+    sync_with_i3;
 
     ($absolute, $top) = $window->rect;
 
index fcfd11e7dd318237956297d734b2ba81a0145478..5ee61a4d2b887c34a2776e3920a27743ffefe2df 100644 (file)
@@ -24,7 +24,7 @@ is(@urgent, 0, 'no window got the urgent flag');
 # Add the urgency hint, switch to a different workspace and back again
 #####################################################################
 $top->add_hint('urgency');
-sync_with_i3($x);
+sync_with_i3;
 
 my @content = @{get_ws_content($tmp)};
 @urgent = grep { $_->{urgent} } @content;
@@ -41,7 +41,7 @@ cmd '[id="' . $top->id . '"] focus';
 is(@urgent, 0, 'no window got the urgent flag after focusing');
 
 $top->add_hint('urgency');
-sync_with_i3($x);
+sync_with_i3;
 
 @urgent = grep { $_->{urgent} } @{get_ws_content($tmp)};
 is(@urgent, 0, 'no window got the urgent flag after re-setting urgency hint');
@@ -55,7 +55,7 @@ ok(!$ws->{urgent}, 'urgent flag not set on workspace');
 my $otmp = fresh_workspace;
 
 $top->add_hint('urgency');
-sync_with_i3($x);
+sync_with_i3;
 
 $ws = get_ws($tmp);
 ok($ws->{urgent}, 'urgent flag set on workspace');
index 3b0bddc0781a5b77e602011867ed711ddfb3d25b..497bad9e1aa73195bc8eb6d434650032a842fe83 100644 (file)
@@ -18,7 +18,7 @@ my $right = open_window({ name => 'Right' });
 
 my ($abs, $rgeom) = $right->rect;
 
-my $child = open_floating_window($x, {
+my $child = open_floating_window({
         dont_map => 1,
         name => 'Child window',
     });
@@ -31,7 +31,7 @@ my $cgeom;
 ($abs, $cgeom) = $child->rect;
 cmp_ok($cgeom->x, '>=', $rgeom->x, 'Child X >= right container X');
 
-my $child2 = open_floating_window($x, {
+my $child2 = open_floating_window({
         dont_map => 1,
         name => 'Child window 2',
     });
index 4b3958a1eb4ec09bc94f15802f325a363649b893..f6d4848dd8afd57bcf9464c68a68fbf9f694a163 100644 (file)
@@ -29,28 +29,44 @@ my $i3 = i3(get_socket_path());
 
 my $tree = $i3->get_tree->recv;
 
+# a unique value
+my $ignore = \"";
+
 my $expected = {
     fullscreen_mode => 0,
-    nodes => ignore(),
+    nodes => $ignore,
     window => undef,
     name => 'root',
-    orientation => ignore(),
+    orientation => $ignore,
     type => 0,
-    id => ignore(),
-    rect => ignore(),
-    window_rect => ignore(),
-    geometry => ignore(),
-    swallows => ignore(),
+    id => $ignore,
+    rect => $ignore,
+    window_rect => $ignore,
+    geometry => $ignore,
+    swallows => $ignore,
     percent => undef,
     layout => 'default',
-    focus => ignore(),
+    focus => $ignore,
     focused => JSON::XS::false,
     urgent => JSON::XS::false,
     border => 'normal',
-    'floating_nodes' => ignore(),
+    'floating_nodes' => $ignore,
 };
 
-cmp_deeply($tree, $expected, 'root node OK');
+# a shallow copy is sufficient, since we only ignore values at the root
+my $tree_copy = { %$tree };
+
+for (keys %$expected) {
+    my $val = $expected->{$_};
+
+    # delete unwanted keys, so we can use is_deeply()
+    if (ref($val) eq 'SCALAR' and $val == $ignore) {
+        delete $tree_copy->{$_};
+        delete $expected->{$_};
+    }
+}
+
+is_deeply($tree_copy, $expected, 'root node OK');
 
 my @nodes = @{$tree->{nodes}};
 
index e2e553f439b372c52cabcf3ee5c579c7a47bec1a..2124c02ef7d28a472bf4969af68480a8453b35d0 100644 (file)
@@ -101,7 +101,7 @@ ok(@{$content} == 2, 'two windows opened');
 
 cmd '[class="special" title="left"] kill';
 
-sync_with_i3($x);
+sync_with_i3;
 
 $content = get_ws_content($tmp);
 is(@{$content}, 1, 'one window still there');
index 9d7a235faccdcabfa0c2c4dfbd56cdd5bfb37337..a078a9e842f5f4454dc71ecd7ac8864c611e515c 100644 (file)
@@ -136,7 +136,7 @@ is(@{$content}, 1, 'only one nodes on this workspace');
 ######################################################################
 
 $tmp = fresh_workspace;
-my $floatwin = open_floating_window($x);
+my $floatwin = open_floating_window;
 my ($absolute_before, $top_before) = $floatwin->rect;
 
 cmd 'move left';
index 34b5e4a5be7bd71a47c17034a243c1ef062ee377..d3736e3c35fee0d64db0546b4de63adcdd8da24b 100644 (file)
@@ -23,7 +23,7 @@ wait_for_map $win;
 $win->hints->aspect($aspect);
 $x->flush;
 
-sync_with_i3($x);
+sync_with_i3;
 
 my $rect = $win->rect;
 my $ar = $rect->width / $rect->height;
index 37d141b1783a5266eae9d6fab6a66117455c7a9d..c7218130166f082f22a8dcd2a991df3fcc000fc7 100644 (file)
@@ -36,8 +36,6 @@ cmd 'floating enable';
 
 cmd '[id="' . $second->id . '"] focus';
 
-sync_with_i3($x);
-
 is($x->input_focus, $second->id, 'second con focused');
 
 cmd 'floating enable';
@@ -67,8 +65,6 @@ cmd 'floating enable';
 
 cmd '[id="' . $second->id . '"] focus';
 
-sync_with_i3($x);
-
 is($x->input_focus, $second->id, 'second con focused');
 
 cmd 'floating enable';
@@ -103,13 +99,11 @@ cmd 'floating enable';
 
 cmd '[id="' . $second->id . '"] focus';
 
-sync_with_i3($x);
-
 is($x->input_focus, $second->id, 'second con focused');
 
 cmd 'floating enable';
 
-sync_with_i3($x);
+sync_with_i3;
 
 # now kill the second one. focus should fall back to the third one, which is
 # also floating
@@ -132,8 +126,6 @@ $tmp = fresh_workspace;
 $first = open_window({ background_color => '#ff0000' });    # window 8
 $second = open_window({ background_color => '#00ff00' });   # window 9
 
-sync_with_i3($x);
-
 is($x->input_focus, $second->id, 'second container focused');
 
 cmd 'floating enable';
@@ -142,32 +134,22 @@ is($x->input_focus, $second->id, 'second container focused');
 
 cmd 'focus tiling';
 
-sync_with_i3($x);
-
 is($x->input_focus, $first->id, 'first (tiling) container focused');
 
 cmd 'focus floating';
 
-sync_with_i3($x);
-
 is($x->input_focus, $second->id, 'second (floating) container focused');
 
 cmd 'focus floating';
 
-sync_with_i3($x);
-
 is($x->input_focus, $second->id, 'second (floating) container still focused');
 
 cmd 'focus mode_toggle';
 
-sync_with_i3($x);
-
 is($x->input_focus, $first->id, 'first (tiling) container focused');
 
 cmd 'focus mode_toggle';
 
-sync_with_i3($x);
-
 is($x->input_focus, $second->id, 'second (floating) container focused');
 
 #############################################################################
@@ -176,42 +158,30 @@ is($x->input_focus, $second->id, 'second (floating) container focused');
 
 $tmp = fresh_workspace;
 
-$first = open_floating_window($x, { background_color => '#ff0000' });# window 10
-$second = open_floating_window($x, { background_color => '#00ff00' }); # window 11
-$third = open_floating_window($x, { background_color => '#0000ff' }); # window 12
-
-sync_with_i3($x);
+$first = open_floating_window({ background_color => '#ff0000' });# window 10
+$second = open_floating_window({ background_color => '#00ff00' }); # window 11
+$third = open_floating_window({ background_color => '#0000ff' }); # window 12
 
 is($x->input_focus, $third->id, 'third container focused');
 
 cmd 'focus left';
 
-sync_with_i3($x);
-
 is($x->input_focus, $second->id, 'second container focused');
 
 cmd 'focus left';
 
-sync_with_i3($x);
-
 is($x->input_focus, $first->id, 'first container focused');
 
 cmd 'focus left';
 
-sync_with_i3($x);
-
 is($x->input_focus, $third->id, 'focus wrapped to third container');
 
 cmd 'focus right';
 
-sync_with_i3($x);
-
 is($x->input_focus, $first->id, 'focus wrapped to first container');
 
 cmd 'focus right';
 
-sync_with_i3($x);
-
 is($x->input_focus, $second->id, 'focus on second container');
 
 done_testing;
index 1666884e5e1bafb221ce2f4a54eb2fac0a21e9b0..f17b0ec146fa465b9ffad2c5de81a867b768edf6 100644 (file)
@@ -15,7 +15,7 @@ my $tmp = fresh_workspace;
 ok(workspace_exists($tmp), "workspace $tmp exists");
 
 # Create a floating window which is smaller than the minimum enforced size of i3
-my $window = open_floating_window($x);
+my $window = open_floating_window;
 ok($window->mapped, 'Window is mapped');
 
 # switch to a different workspace, see if the window is still mapped?
index 29762594e51922059fd1cf14fd9cfd28b4f1d4c3..e91870bc35e0ee1fd6bd1a203803f96c1355635a 100644 (file)
@@ -14,14 +14,14 @@ my $tmp = fresh_workspace;
 #############################################################################
 
 # Create a floating window which is smaller than the minimum enforced size of i3
-my $window = open_floating_window($x);
+my $window = open_floating_window;
 ok($window->mapped, 'Window is mapped');
 
 # switch to a different workspace, see if the window is still mapped?
 
 my $otmp = fresh_workspace;
 
-sync_with_i3($x);
+sync_with_i3;
 
 ok(!$window->mapped, 'Window is not mapped after switching ws');
 
index 71f10ef54c25ed717a2578deffd8ba2ee0cd81c2..db86e1ca71e6e9c2e044ad8c94508697f2628cff 100644 (file)
@@ -14,7 +14,7 @@ my $tmp = fresh_workspace;
 #############################################################################
 
 # Create a floating window
-my $window = open_floating_window($x);
+my $window = open_floating_window;
 ok($window->mapped, 'Window is mapped');
 
 my $ws = get_ws($tmp);
@@ -47,7 +47,7 @@ is(@{$ws->{floating_nodes}}, 0, 'no floating nodes so far');
 is(@{$ws->{nodes}}, 1, 'one tiling node (stacked con)');
 
 # Create a floating window
-$window = open_floating_window($x);
+$window = open_floating_window;
 ok($window->mapped, 'Window is mapped');
 
 $ws = get_ws($tmp);
index aac1debf0e642946fae4fe1960cb73a8408fd40e..78b9191a73f278374d8b5a0a50aae230826434d9 100644 (file)
@@ -13,7 +13,7 @@ sub check_order {
     my @nums = map { $_->{num} } grep { defined($_->{num}) } @ws;
     my @sorted = sort @nums;
 
-    cmp_deeply(\@nums, \@sorted, $msg);
+    is_deeply(\@nums, \@sorted, $msg);
 }
 
 check_order('workspace order alright before testing');
index 042afcfefd9e59e21d7c26a628e94c471301e06b..3d78b1bd566a9ee022977e80bee5890cb67dfd00 100644 (file)
@@ -13,7 +13,7 @@ sub check_order {
     my @nums = map { $_->{num} } grep { defined($_->{num}) } @ws;
     my @sorted = sort @nums;
 
-    cmp_deeply(\@nums, \@sorted, $msg);
+    is_deeply(\@nums, \@sorted, $msg);
 }
 
 my $tmp = fresh_workspace;
@@ -22,8 +22,6 @@ my $left = open_window;
 my $mid = open_window;
 my $right = open_window;
 
-sync_with_i3($x);
-
 diag("left = " . $left->id . ", mid = " . $mid->id . ", right = " . $right->id);
 
 is($x->input_focus, $right->id, 'Right window focused');
index b2c7d0f36226befb269722f141478dd35e74e359..0b429fb0c64e9fb65b55d5852493456e8f09e9f0 100644 (file)
@@ -10,8 +10,6 @@ cmd 'split v';
 my $top = open_window;
 my $bottom = open_window;
 
-sync_with_i3($x);
-
 diag("top = " . $top->id . ", bottom = " . $bottom->id);
 
 is($x->input_focus, $bottom->id, 'Bottom window focused');
index c3a4512a7349229bd86162e6ee551aec67b02ed4..ca209e1cadc1a799148aa00b4c4b9e8f0050896a 100644 (file)
@@ -18,7 +18,7 @@ my ($nodes, $focus) = get_ws_content($tmp);
 #############################################################################
 
 # Create a floating window
-my $window = open_floating_window($x);
+my $window = open_floating_window;
 ok($window->mapped, 'Window is mapped');
 
 ($nodes, $focus) = get_ws_content($tmp);
index dcd1144e76dede059bd0d9f8bb02153548f7ffc4..83f3e85d58bf7cac5d9fe823d0c6ed07b57bda1c 100644 (file)
@@ -17,7 +17,7 @@ cmp_ok($absolute->{width}, '>', 400, 'i3 raised the width');
 cmp_ok($absolute->{height}, '>', 150, 'i3 raised the height');
 
 cmd 'floating toggle';
-sync_with_i3($x);
+sync_with_i3;
 
 ($absolute, $top) = $window->rect;
 
index 78323990e14c85774174722fb8e18fbdf607b1f9..c7646e417e7c760c11fdf68c717ea41ced67ee65 100644 (file)
@@ -46,7 +46,7 @@ my $third = open_window({
 
 $third->map;
 
-sync_with_i3 $x;
+sync_with_i3;
 
 diag("third = " . $third->id);
 
@@ -57,9 +57,6 @@ my $tmp2 = get_unused_workspace;
 cmd "move workspace $tmp2";
 
 # verify that the third window has the focus
-
-sync_with_i3($x);
-
 is($x->input_focus, $third->id, 'third window focused');
 
 done_testing;
index 39e4eac4bfb12c042cb76e850effd4065196303c..7a0ac48788de3258c0f9788530ca37590ee828ac 100644 (file)
@@ -47,7 +47,7 @@ is($docknode->{rect}->{height}, 30, 'dock node has unchanged height');
 
 $window->add_hint('urgency');
 
-sync_with_i3($x);
+sync_with_i3;
 
 does_i3_live;
 
index 468499d502c6cd0a8f9248b3582b02a098afc87b..6df2bcbddf0392a5c7d71dec0da1a158818d01f9 100644 (file)
@@ -9,8 +9,6 @@ use X11::XCB qw(ICCCM_WM_STATE_NORMAL ICCCM_WM_STATE_WITHDRAWN);
 
 my $window = open_window;
 
-sync_with_i3($x);
-
 is($window->state, ICCCM_WM_STATE_NORMAL, 'WM_STATE normal');
 
 $window->unmap;
index 20dd50ca349aa40596ef7e72098900cc702dcb6c..165a32cec0f90438e31d4d6472104534af55cade 100644 (file)
@@ -14,8 +14,6 @@ sub two_windows {
     my $first = open_window;
     my $second = open_window;
 
-    sync_with_i3 $x;
-
     is($x->input_focus, $second->id, 'second window focused');
     ok(@{get_ws_content($tmp)} == 2, 'two containers opened');
 
index 281f840f6658eb71ceee7b0bf914d10402eb18e8..c7601809da764b6e2b99584ab8deca9d6bad536b 100644 (file)
@@ -124,13 +124,13 @@ cmp_ok(@content, '==', 1, 'one node on this workspace now');
 is($content[0]->{border}, 'normal', 'normal border');
 
 $window->name('special borderless title');
-sync_with_i3 $x;
+sync_with_i3;
 
 @content = @{get_ws_content($tmp)};
 is($content[0]->{border}, 'none', 'no border');
 
 $window->name('special title');
-sync_with_i3 $x;
+sync_with_i3;
 
 cmd 'border normal';
 
@@ -138,7 +138,7 @@ cmd 'border normal';
 is($content[0]->{border}, 'normal', 'border reset to normal');
 
 $window->name('special borderless title');
-sync_with_i3 $x;
+sync_with_i3;
 
 @content = @{get_ws_content($tmp)};
 is($content[0]->{border}, 'normal', 'still normal border');
@@ -235,7 +235,7 @@ wait_for_unmap $window;
 $window->destroy;
 
 # give i3 a chance to delete the window from its tree
-sync_with_i3 $x;
+sync_with_i3;
 
 @content = @{get_ws_content($tmp)};
 cmp_ok(@content, '==', 0, 'no nodes on this workspace now');
@@ -457,7 +457,7 @@ $x->change_property(
 
 $x->flush;
 
-sync_with_i3 $x;
+sync_with_i3;
 
 @content = @{get_ws_content($tmp)};
 cmp_ok(@content, '==', 1, 'one node on this workspace now');
index f42962f3ace0f2632ad5b703e5d626c7aa7c1570..a10516a61254db6eb50a56f5705ab476350a292f 100644 (file)
@@ -135,7 +135,7 @@ $window->map;
 # We use sync_with_i3 instead of wait_for_map here because i3 will not actually
 # map the window -- it will be assigned to a different workspace and will only
 # be mapped once you switch to that workspace
-sync_with_i3 $x;
+sync_with_i3;
 
 ok(@{get_ws_content($tmp)} == 0, 'still no containers');
 ok(@{get_ws_content('targetws')} == 2, 'two containers on targetws');
index d5a02ca626302bcf355242a3791cac8526940d98..aeb700bad0a1f945f9571f0e9553ae95d4a53b21 100644 (file)
@@ -26,8 +26,6 @@ ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
 my $first = open_window;
 my $second = open_window;
 
-sync_with_i3($x);
-
 is($x->input_focus, $second->id, 'second window focused');
 my @content = @{get_ws_content($tmp)};
 ok(@content == 2, 'two containers opened');
@@ -56,8 +54,6 @@ ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
 $first = open_window;
 $second = open_window;
 
-sync_with_i3($x);
-
 is($x->input_focus, $second->id, 'second window focused');
 @content = @{get_ws_content($tmp)};
 ok(@content == 1, 'one con at workspace level');
index bf66c44e8b45b61f289907eb638413fa018617ac..30458b00a2920503dfe3b1c70882f331a3d7a602 100644 (file)
@@ -70,8 +70,6 @@ cmd 'focus parent';
 
 $third = open_window;
 
-sync_with_i3($x);
-
 is($x->input_focus, $third->id, 'third window focused');
 
 cmd 'focus left';
index 97ae16e96effab59a28a6b9235a1c32736cf57e8..34d987768bd0b2915e72a1d9c630028fb1578f75 100644 (file)
@@ -18,7 +18,7 @@ EOT
 my $pid = launch_with_config($config);
 
 my @names = @{get_workspace_names()};
-cmp_deeply(\@names, [ '1' ], 'i3 starts on workspace 1 without any configuration');
+is_deeply(\@names, [ '1' ], 'i3 starts on workspace 1 without any configuration');
 
 exit_gracefully($pid);
 
@@ -36,7 +36,7 @@ EOT
 $pid = launch_with_config($config);
 
 @names = @{get_workspace_names()};
-cmp_deeply(\@names, [ 'foobar' ], 'i3 starts on named workspace foobar');
+is_deeply(\@names, [ 'foobar' ], 'i3 starts on named workspace foobar');
 
 exit_gracefully($pid);
 
@@ -54,7 +54,7 @@ EOT
 $pid = launch_with_config($config);
 
 @names = @{get_workspace_names()};
-cmp_deeply(\@names, [ 'foobar' ], 'i3 starts on named workspace foobar');
+is_deeply(\@names, [ 'foobar' ], 'i3 starts on named workspace foobar');
 
 exit_gracefully($pid);
 
index e74c233a6a3560858909c9631f3164ff35780b0b..75b6e7a8f0594c34e593cdbb73be277f4053b8c7 100644 (file)
@@ -16,7 +16,7 @@ sub get_marks {
 my $tmp = fresh_workspace;
 
 my $marks = get_marks();
-cmp_deeply($marks, [], 'no marks set so far');
+is_deeply($marks, [], 'no marks set so far');
 
 ##############################################################
 # 2: check that setting a mark is reflected in the get_marks reply
@@ -25,7 +25,7 @@ cmp_deeply($marks, [], 'no marks set so far');
 cmd 'open';
 cmd 'mark foo';
 
-cmp_deeply(get_marks(), [ 'foo' ], 'mark foo set');
+is_deeply(get_marks(), [ 'foo' ], 'mark foo set');
 
 ##############################################################
 # 3: check that the mark is gone after killing the container
@@ -33,7 +33,7 @@ cmp_deeply(get_marks(), [ 'foo' ], 'mark foo set');
 
 cmd 'kill';
 
-cmp_deeply(get_marks(), [ ], 'mark gone');
+is_deeply(get_marks(), [ ], 'mark gone');
 
 ##############################################################
 # 4: check that duplicate marks are included twice in the get_marks reply
@@ -45,6 +45,6 @@ cmd 'mark bar';
 cmd 'open';
 cmd 'mark bar';
 
-cmp_deeply(get_marks(), [ 'bar', 'bar' ], 'duplicate mark found twice');
+is_deeply(get_marks(), [ 'bar', 'bar' ], 'duplicate mark found twice');
 
 done_testing;
index 6196b6846c06c0e4a42bd28dcb7dc5525e3de00b..009f5094ef437597a429ba1333314751a3b70e1a 100644 (file)
@@ -73,7 +73,7 @@ $tmp = fresh_workspace;
 
 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
 
-$first = open_floating_window($x);
+$first = open_floating_window;
 
 my $wscontent = get_ws($tmp);
 my @floating = @{$wscontent->{floating_nodes}};
@@ -101,7 +101,7 @@ $tmp = fresh_workspace;
 
 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
 
-$first = open_floating_window($x);
+$first = open_floating_window;
 
 $wscontent = get_ws($tmp);
 @floating = @{$wscontent->{floating_nodes}};
index a794f70ae5d8b8afc6bcab90d96d590d6c334beb..3a4dbc81f3ed5d4a305f725acaab5cc516c3bacd 100644 (file)
@@ -103,7 +103,7 @@ $win->map;
 # We don’t use wait_for_map because the window will not get mapped -- it is on
 # a different workspace.
 # We sync with i3 here to make sure $x->input_focus is updated.
-sync_with_i3($x);
+sync_with_i3;
 
 is(@{get_ws_content($second_ws)}, 0, 'still no containers on the second workspace');
 is(@{get_ws_content($first_ws)}, 1, 'one container on the first workspace');
@@ -117,7 +117,7 @@ mark_window($leader->id);
 
 $win = open_window({ dont_map => 1, client_leader => $leader });
 $win->map;
-sync_with_i3($x);
+sync_with_i3;
 
 is(@{get_ws_content($second_ws)}, 0, 'still no containers on the second workspace');
 is(@{get_ws_content($first_ws)}, 2, 'two containers on the first workspace');
@@ -128,7 +128,7 @@ is(@{get_ws_content($first_ws)}, 2, 'two containers on the first workspace');
 ######################################################################
 
 complete_startup();
-sync_with_i3($x);
+sync_with_i3;
 
 my $otherwin = open_window;
 is(@{get_ws_content($second_ws)}, 1, 'one container on the second workspace');