From 0702f1fb7befbeae5914f2b1cb6b27d8809ae36b Mon Sep 17 00:00:00 2001 From: Maik Fischer Date: Tue, 22 Nov 2011 01:13:37 +0100 Subject: [PATCH] testcases: drop sync_with_i3()s $x parameter, use global --- testcases/lib/i3test.pm | 8 +++---- testcases/t/002-i3-sync.t | 2 +- testcases/t/003-ipc.t | 2 +- testcases/t/005-floating.t | 2 +- testcases/t/100-fullscreen.t | 10 ++++---- testcases/t/101-focus.t | 2 +- testcases/t/102-dock.t | 2 +- testcases/t/111-goto.t | 2 +- testcases/t/112-floating-resize.t | 6 ++--- testcases/t/113-urgent.t | 6 ++--- testcases/t/119-match.t | 2 +- testcases/t/133-size-hints.t | 2 +- testcases/t/135-floating-focus.t | 32 ++++++++++++------------- testcases/t/137-floating-unmap.t | 2 +- testcases/t/140-focus-lost.t | 2 +- testcases/t/141-resize.t | 2 +- testcases/t/153-floating-originalsize.t | 2 +- testcases/t/156-fullscreen-focus.t | 4 ++-- testcases/t/162-regress-dock-urgent.t | 2 +- testcases/t/163-wm-state.t | 2 +- testcases/t/164-kill-win-vs-client.t | 2 +- testcases/t/165-for_window.t | 10 ++++---- testcases/t/166-assign.t | 2 +- testcases/t/167-workspace_layout.t | 4 ++-- testcases/t/170-force_focus_wrapping.t | 2 +- testcases/t/175-startup-notification.t | 6 ++--- 26 files changed, 59 insertions(+), 61 deletions(-) diff --git a/testcases/lib/i3test.pm b/testcases/lib/i3test.pm index d3d8ad04..d1a17865 100644 --- a/testcases/lib/i3test.pm +++ b/testcases/lib/i3test.pm @@ -139,7 +139,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(); } # @@ -174,7 +174,7 @@ 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); + sync_with_i3(); return $window; } @@ -325,8 +325,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 +468,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(@_); } diff --git a/testcases/t/002-i3-sync.t b/testcases/t/002-i3-sync.t index 75871f9d..1377ee94 100644 --- a/testcases/t/002-i3-sync.t +++ b/testcases/t/002-i3-sync.t @@ -5,7 +5,7 @@ # use i3test; -my $result = sync_with_i3($x); +my $result = sync_with_i3; ok($result, 'syncing was successful'); done_testing; diff --git a/testcases/t/003-ipc.t b/testcases/t/003-ipc.t index 477b7163..34359f20 100644 --- a/testcases/t/003-ipc.t +++ b/testcases/t/003-ipc.t @@ -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"); diff --git a/testcases/t/005-floating.t b/testcases/t/005-floating.t index ac6623f2..6de3ea80 100644 --- a/testcases/t/005-floating.t +++ b/testcases/t/005-floating.t @@ -76,7 +76,7 @@ $window->map; wait_for_map $window; cmd 'floating enable'; -sync_with_i3($x); +sync_with_i3; ($absolute, $top) = $window->rect; diff --git a/testcases/t/100-fullscreen.t b/testcases/t/100-fullscreen.t index f5fb6693..dc7eec18 100644 --- a/testcases/t/100-fullscreen.t +++ b/testcases/t/100-fullscreen.t @@ -56,7 +56,7 @@ $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"); @@ -123,7 +123,7 @@ 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'); @@ -131,12 +131,12 @@ $new_rect = $swindow->rect; ok(!eq_deeply($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'); diff --git a/testcases/t/101-focus.t b/testcases/t/101-focus.t index 545b9dd0..8f6038e6 100644 --- a/testcases/t/101-focus.t +++ b/testcases/t/101-focus.t @@ -25,7 +25,7 @@ sub focus_after { my $msg = shift; cmd $msg; - sync_with_i3 $x; + sync_with_i3; return $x->input_focus; } diff --git a/testcases/t/102-dock.t b/testcases/t/102-dock.t index ce33f052..20acf49e 100644 --- a/testcases/t/102-dock.t +++ b/testcases/t/102-dock.t @@ -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'); diff --git a/testcases/t/111-goto.t b/testcases/t/111-goto.t index 5f4d7762..fa9aaf3c 100644 --- a/testcases/t/111-goto.t +++ b/testcases/t/111-goto.t @@ -24,7 +24,7 @@ sub focus_after { my $msg = shift; cmd $msg; - sync_with_i3($x); + sync_with_i3; return $x->input_focus; } diff --git a/testcases/t/112-floating-resize.t b/testcases/t/112-floating-resize.t index fe9803e6..ff3a1c04 100644 --- a/testcases/t/112-floating-resize.t +++ b/testcases/t/112-floating-resize.t @@ -15,7 +15,7 @@ my $window = open_floating_window; 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; diff --git a/testcases/t/113-urgent.t b/testcases/t/113-urgent.t index fcfd11e7..5ee61a4d 100644 --- a/testcases/t/113-urgent.t +++ b/testcases/t/113-urgent.t @@ -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'); diff --git a/testcases/t/119-match.t b/testcases/t/119-match.t index e2e553f4..2124c02e 100644 --- a/testcases/t/119-match.t +++ b/testcases/t/119-match.t @@ -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'); diff --git a/testcases/t/133-size-hints.t b/testcases/t/133-size-hints.t index 34b5e4a5..d3736e3c 100644 --- a/testcases/t/133-size-hints.t +++ b/testcases/t/133-size-hints.t @@ -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; diff --git a/testcases/t/135-floating-focus.t b/testcases/t/135-floating-focus.t index f5182e1b..4955618f 100644 --- a/testcases/t/135-floating-focus.t +++ b/testcases/t/135-floating-focus.t @@ -36,7 +36,7 @@ cmd 'floating enable'; cmd '[id="' . $second->id . '"] focus'; -sync_with_i3($x); +sync_with_i3; is($x->input_focus, $second->id, 'second con focused'); @@ -67,7 +67,7 @@ cmd 'floating enable'; cmd '[id="' . $second->id . '"] focus'; -sync_with_i3($x); +sync_with_i3; is($x->input_focus, $second->id, 'second con focused'); @@ -103,13 +103,13 @@ cmd 'floating enable'; cmd '[id="' . $second->id . '"] focus'; -sync_with_i3($x); +sync_with_i3; 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,7 +132,7 @@ $tmp = fresh_workspace; $first = open_window({ background_color => '#ff0000' }); # window 8 $second = open_window({ background_color => '#00ff00' }); # window 9 -sync_with_i3($x); +sync_with_i3; is($x->input_focus, $second->id, 'second container focused'); @@ -142,31 +142,31 @@ is($x->input_focus, $second->id, 'second container focused'); cmd 'focus tiling'; -sync_with_i3($x); +sync_with_i3; is($x->input_focus, $first->id, 'first (tiling) container focused'); cmd 'focus floating'; -sync_with_i3($x); +sync_with_i3; is($x->input_focus, $second->id, 'second (floating) container focused'); cmd 'focus floating'; -sync_with_i3($x); +sync_with_i3; is($x->input_focus, $second->id, 'second (floating) container still focused'); cmd 'focus mode_toggle'; -sync_with_i3($x); +sync_with_i3; is($x->input_focus, $first->id, 'first (tiling) container focused'); cmd 'focus mode_toggle'; -sync_with_i3($x); +sync_with_i3; is($x->input_focus, $second->id, 'second (floating) container focused'); @@ -180,37 +180,37 @@ $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 -sync_with_i3($x); +sync_with_i3; is($x->input_focus, $third->id, 'third container focused'); cmd 'focus left'; -sync_with_i3($x); +sync_with_i3; is($x->input_focus, $second->id, 'second container focused'); cmd 'focus left'; -sync_with_i3($x); +sync_with_i3; is($x->input_focus, $first->id, 'first container focused'); cmd 'focus left'; -sync_with_i3($x); +sync_with_i3; is($x->input_focus, $third->id, 'focus wrapped to third container'); cmd 'focus right'; -sync_with_i3($x); +sync_with_i3; is($x->input_focus, $first->id, 'focus wrapped to first container'); cmd 'focus right'; -sync_with_i3($x); +sync_with_i3; is($x->input_focus, $second->id, 'focus on second container'); diff --git a/testcases/t/137-floating-unmap.t b/testcases/t/137-floating-unmap.t index 0d126fea..e91870bc 100644 --- a/testcases/t/137-floating-unmap.t +++ b/testcases/t/137-floating-unmap.t @@ -21,7 +21,7 @@ ok($window->mapped, 'Window is mapped'); my $otmp = fresh_workspace; -sync_with_i3($x); +sync_with_i3; ok(!$window->mapped, 'Window is not mapped after switching ws'); diff --git a/testcases/t/140-focus-lost.t b/testcases/t/140-focus-lost.t index 042afcfe..e7388fd9 100644 --- a/testcases/t/140-focus-lost.t +++ b/testcases/t/140-focus-lost.t @@ -22,7 +22,7 @@ my $left = open_window; my $mid = open_window; my $right = open_window; -sync_with_i3($x); +sync_with_i3; diag("left = " . $left->id . ", mid = " . $mid->id . ", right = " . $right->id); diff --git a/testcases/t/141-resize.t b/testcases/t/141-resize.t index b2c7d0f3..3f332ce1 100644 --- a/testcases/t/141-resize.t +++ b/testcases/t/141-resize.t @@ -10,7 +10,7 @@ cmd 'split v'; my $top = open_window; my $bottom = open_window; -sync_with_i3($x); +sync_with_i3; diag("top = " . $top->id . ", bottom = " . $bottom->id); diff --git a/testcases/t/153-floating-originalsize.t b/testcases/t/153-floating-originalsize.t index dcd1144e..83f3e85d 100644 --- a/testcases/t/153-floating-originalsize.t +++ b/testcases/t/153-floating-originalsize.t @@ -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; diff --git a/testcases/t/156-fullscreen-focus.t b/testcases/t/156-fullscreen-focus.t index 78323990..75133cae 100644 --- a/testcases/t/156-fullscreen-focus.t +++ b/testcases/t/156-fullscreen-focus.t @@ -46,7 +46,7 @@ my $third = open_window({ $third->map; -sync_with_i3 $x; +sync_with_i3; diag("third = " . $third->id); @@ -58,7 +58,7 @@ cmd "move workspace $tmp2"; # verify that the third window has the focus -sync_with_i3($x); +sync_with_i3; is($x->input_focus, $third->id, 'third window focused'); diff --git a/testcases/t/162-regress-dock-urgent.t b/testcases/t/162-regress-dock-urgent.t index 39e4eac4..7a0ac487 100644 --- a/testcases/t/162-regress-dock-urgent.t +++ b/testcases/t/162-regress-dock-urgent.t @@ -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; diff --git a/testcases/t/163-wm-state.t b/testcases/t/163-wm-state.t index 468499d5..b14dd5b5 100644 --- a/testcases/t/163-wm-state.t +++ b/testcases/t/163-wm-state.t @@ -9,7 +9,7 @@ use X11::XCB qw(ICCCM_WM_STATE_NORMAL ICCCM_WM_STATE_WITHDRAWN); my $window = open_window; -sync_with_i3($x); +sync_with_i3; is($window->state, ICCCM_WM_STATE_NORMAL, 'WM_STATE normal'); diff --git a/testcases/t/164-kill-win-vs-client.t b/testcases/t/164-kill-win-vs-client.t index 20dd50ca..5c112341 100644 --- a/testcases/t/164-kill-win-vs-client.t +++ b/testcases/t/164-kill-win-vs-client.t @@ -14,7 +14,7 @@ sub two_windows { my $first = open_window; my $second = open_window; - sync_with_i3 $x; + sync_with_i3; is($x->input_focus, $second->id, 'second window focused'); ok(@{get_ws_content($tmp)} == 2, 'two containers opened'); diff --git a/testcases/t/165-for_window.t b/testcases/t/165-for_window.t index 281f840f..c7601809 100644 --- a/testcases/t/165-for_window.t +++ b/testcases/t/165-for_window.t @@ -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'); diff --git a/testcases/t/166-assign.t b/testcases/t/166-assign.t index f42962f3..a10516a6 100644 --- a/testcases/t/166-assign.t +++ b/testcases/t/166-assign.t @@ -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'); diff --git a/testcases/t/167-workspace_layout.t b/testcases/t/167-workspace_layout.t index d5a02ca6..e6704d24 100644 --- a/testcases/t/167-workspace_layout.t +++ b/testcases/t/167-workspace_layout.t @@ -26,7 +26,7 @@ ok(@{get_ws_content($tmp)} == 0, 'no containers yet'); my $first = open_window; my $second = open_window; -sync_with_i3($x); +sync_with_i3; is($x->input_focus, $second->id, 'second window focused'); my @content = @{get_ws_content($tmp)}; @@ -56,7 +56,7 @@ ok(@{get_ws_content($tmp)} == 0, 'no containers yet'); $first = open_window; $second = open_window; -sync_with_i3($x); +sync_with_i3; is($x->input_focus, $second->id, 'second window focused'); @content = @{get_ws_content($tmp)}; diff --git a/testcases/t/170-force_focus_wrapping.t b/testcases/t/170-force_focus_wrapping.t index bf66c44e..69d14688 100644 --- a/testcases/t/170-force_focus_wrapping.t +++ b/testcases/t/170-force_focus_wrapping.t @@ -70,7 +70,7 @@ cmd 'focus parent'; $third = open_window; -sync_with_i3($x); +sync_with_i3; is($x->input_focus, $third->id, 'third window focused'); diff --git a/testcases/t/175-startup-notification.t b/testcases/t/175-startup-notification.t index a794f70a..3a4dbc81 100644 --- a/testcases/t/175-startup-notification.t +++ b/testcases/t/175-startup-notification.t @@ -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'); -- 2.39.2