From e72899efb698cb868ceec415dd6cf946a59afc34 Mon Sep 17 00:00:00 2001 From: Maik Fischer Date: Mon, 21 Nov 2011 16:57:07 +0100 Subject: [PATCH 01/10] testcases: move i3test::X11 from 170-force_focus_wrapping.t into i3test.pm --- testcases/lib/i3test.pm | 10 ++++++++++ testcases/t/170-force_focus_wrapping.t | 12 ------------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/testcases/lib/i3test.pm b/testcases/lib/i3test.pm index 591064c4..540e89bc 100644 --- a/testcases/lib/i3test.pm +++ b/testcases/lib/i3test.pm @@ -449,4 +449,14 @@ sub launch_with_config { return $pid; } +package i3test::X11; +use parent 'X11::XCB::Connection'; + +sub input_focus { + my $self = shift; + i3test::sync_with_i3($self); + + return $self->SUPER::input_focus(@_); +} + 1 diff --git a/testcases/t/170-force_focus_wrapping.t b/testcases/t/170-force_focus_wrapping.t index 48869c10..d2f15a65 100644 --- a/testcases/t/170-force_focus_wrapping.t +++ b/testcases/t/170-force_focus_wrapping.t @@ -6,18 +6,6 @@ # use i3test; -{ - package i3test::X11; - use parent 'X11::XCB::Connection'; - - sub input_focus { - my $self = shift; - i3test::sync_with_i3($self); - - return $self->SUPER::input_focus(@_); - } -} - my $x = i3test::X11->new; ##################################################################### From 0a65b770e8af3f8c021b384b439b4cf7d7668643 Mon Sep 17 00:00:00 2001 From: Maik Fischer Date: Mon, 21 Nov 2011 17:33:18 +0100 Subject: [PATCH 02/10] i3test.pm: bail_out if injection of exported modules fails --- testcases/lib/i3test.pm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/testcases/lib/i3test.pm b/testcases/lib/i3test.pm index 540e89bc..d1e0ed7d 100644 --- a/testcases/lib/i3test.pm +++ b/testcases/lib/i3test.pm @@ -56,8 +56,12 @@ BEGIN { sub import { my $class = shift; my $pkg = caller; - eval "package $pkg; -use Test::Most" . (@_ > 0 ? " qw(@_)" : "") . "; + + my $test_most_args = @_ ? "qw(@_)" : ""; + local $@; + eval << "__"; +package $pkg; +use Test::Most $test_most_args; use Data::Dumper; use AnyEvent::I3; use Time::HiRes qw(sleep); @@ -65,7 +69,9 @@ use Test::Deep qw(eq_deeply cmp_deeply cmp_set cmp_bag cmp_methods useclass nocl use v5.10; use strict; use warnings; -"; +__ + $tester->bail_out("$@") if $@; + @_ = ($class); goto \&Exporter::import; } From 1b1d7941ecb81de969c82acd8c41ba63b7a58e70 Mon Sep 17 00:00:00 2001 From: Maik Fischer Date: Mon, 21 Nov 2011 21:04:00 +0100 Subject: [PATCH 03/10] testcases: correctly enable lexical pragmata eval 'package foo; use strict;' enables strict within eval, it does not leak into the surrounding scope. Also fix various warnings/compile errors found due to now enabled strict and warnings. --- testcases/lib/i3test.pm | 6 +++--- testcases/t/101-focus.t | 2 +- testcases/t/102-dock.t | 8 ++++---- testcases/t/103-move.t | 2 +- testcases/t/105-stacking.t | 2 +- testcases/t/111-goto.t | 2 +- testcases/t/113-urgent.t | 6 +++--- testcases/t/117-workspace.t | 2 +- testcases/t/128-open-order.t | 2 +- testcases/t/130-close-empty-split.t | 8 ++++---- testcases/t/135-floating-focus.t | 2 +- testcases/t/138-floating-attach.t | 2 +- testcases/t/146-floating-reinsert.t | 2 +- testcases/t/157-regress-fullscreen-level-up.t | 4 ++-- testcases/t/164-kill-win-vs-client.t | 4 ++-- testcases/t/165-for_window.t | 2 +- testcases/t/166-assign.t | 18 +++++++++--------- testcases/t/167-workspace_layout.t | 5 +++-- testcases/t/172-start-on-named-ws.t | 4 ++-- 19 files changed, 42 insertions(+), 41 deletions(-) diff --git a/testcases/lib/i3test.pm b/testcases/lib/i3test.pm index d1e0ed7d..ad598b84 100644 --- a/testcases/lib/i3test.pm +++ b/testcases/lib/i3test.pm @@ -66,11 +66,11 @@ use Data::Dumper; use AnyEvent::I3; use Time::HiRes qw(sleep); use Test::Deep qw(eq_deeply cmp_deeply cmp_set cmp_bag cmp_methods useclass noclass set bag subbagof superbagof subsetof supersetof superhashof subhashof bool str arraylength Isa ignore methods regexprefonly regexpmatches num regexponly scalref reftype hashkeysonly blessed array re hash regexpref hash_each shallow array_each code arrayelementsonly arraylengthonly scalarrefonly listmethods any hashkeys isa); -use v5.10; -use strict; -use warnings; __ $tester->bail_out("$@") if $@; + feature->import(":5.10"); + strict->import; + warnings->import; @_ = ($class); goto \&Exporter::import; diff --git a/testcases/t/101-focus.t b/testcases/t/101-focus.t index 5ded494f..51119007 100644 --- a/testcases/t/101-focus.t +++ b/testcases/t/101-focus.t @@ -31,7 +31,7 @@ sub focus_after { return $x->input_focus; } -$focus = $x->input_focus; +my $focus = $x->input_focus; is($focus, $bottom->id, "Latest window focused"); $focus = focus_after('focus up'); diff --git a/testcases/t/102-dock.t b/testcases/t/102-dock.t index cad54c26..092cf3d2 100644 --- a/testcases/t/102-dock.t +++ b/testcases/t/102-dock.t @@ -88,7 +88,7 @@ $window = open_window($x, { window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'), }); -my $rect = $window->rect; +$rect = $window->rect; is($rect->width, $primary->rect->width, 'dock client is as wide as the screen'); is($rect->height, 30, 'height is unchanged'); @@ -153,8 +153,8 @@ $window = open_window($x, { $window->_create(); # Add a _NET_WM_STRUT_PARTIAL hint -my $atomname = $x->atom(name => '_NET_WM_STRUT_PARTIAL'); -my $atomtype = $x->atom(name => 'CARDINAL'); +$atomname = $x->atom(name => '_NET_WM_STRUT_PARTIAL'); +$atomtype = $x->atom(name => 'CARDINAL'); $x->change_property( PROP_MODE_REPLACE, @@ -180,7 +180,7 @@ $window->destroy; # regression test: transient dock client ##################################################################### -$fwindow = open_window($x, { +my $fwindow = open_window($x, { dont_map => 1, background_color => '#FF0000', window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'), diff --git a/testcases/t/103-move.t b/testcases/t/103-move.t index 6e35ebe4..040faf20 100644 --- a/testcases/t/103-move.t +++ b/testcases/t/103-move.t @@ -48,7 +48,7 @@ sub focus_after { return $x->input_focus; } -$focus = $x->input_focus; +my $focus = $x->input_focus; is($focus, $bottom->id, "Latest window focused"); $focus = focus_after("ml"); diff --git a/testcases/t/105-stacking.t b/testcases/t/105-stacking.t index cc285f32..ec7b8df8 100644 --- a/testcases/t/105-stacking.t +++ b/testcases/t/105-stacking.t @@ -46,7 +46,7 @@ sub focus_after { return $x->input_focus; } -$focus = $x->input_focus; +my $focus = $x->input_focus; is($focus, $bottom->id, "Latest window focused"); $focus = focus_after("s"); diff --git a/testcases/t/111-goto.t b/testcases/t/111-goto.t index 903fa0c4..76baec0e 100644 --- a/testcases/t/111-goto.t +++ b/testcases/t/111-goto.t @@ -30,7 +30,7 @@ sub focus_after { return $x->input_focus; } -$focus = $x->input_focus; +my $focus = $x->input_focus; is($focus, $bottom->id, "Latest window focused"); $focus = focus_after('focus left'); diff --git a/testcases/t/113-urgent.t b/testcases/t/113-urgent.t index 7954408f..cb547667 100644 --- a/testcases/t/113-urgent.t +++ b/testcases/t/113-urgent.t @@ -33,10 +33,10 @@ is(@urgent, 0, 'no window got the urgent flag'); $top->add_hint('urgency'); sync_with_i3($x); -@content = @{get_ws_content($tmp)}; +my @content = @{get_ws_content($tmp)}; @urgent = grep { $_->{urgent} } @content; -$top_info = first { $_->{window} == $top->id } @content; -$bottom_info = first { $_->{window} == $bottom->id } @content; +my $top_info = first { $_->{window} == $top->id } @content; +my $bottom_info = first { $_->{window} == $bottom->id } @content; ok($top_info->{urgent}, 'top window is marked urgent'); ok(!$bottom_info->{urgent}, 'bottom window is not marked urgent'); diff --git a/testcases/t/117-workspace.t b/testcases/t/117-workspace.t index 3c3b6cc6..a88c669c 100644 --- a/testcases/t/117-workspace.t +++ b/testcases/t/117-workspace.t @@ -108,7 +108,7 @@ ok(defined($ws), "workspace 3: $tmp was created"); is($ws->{num}, 3, 'workspace number is 3'); cmd "workspace 0: $tmp"; -my $ws = get_ws("0: $tmp"); +$ws = get_ws("0: $tmp"); ok(defined($ws), "workspace 0: $tmp was created"); is($ws->{num}, 0, 'workspace number is 0'); diff --git a/testcases/t/128-open-order.t b/testcases/t/128-open-order.t index b638e708..ee58968f 100644 --- a/testcases/t/128-open-order.t +++ b/testcases/t/128-open-order.t @@ -27,7 +27,7 @@ isnt($first, $second, 'different container focused'); cmd qq|[con_id="$first"] focus|; cmd 'open'; -$content = get_ws_content($tmp); +my $content = get_ws_content($tmp); ok(@{$content} == 3, 'three containers opened'); is($content->[0]->{id}, $first, 'first container unmodified'); diff --git a/testcases/t/130-close-empty-split.t b/testcases/t/130-close-empty-split.t index 57855cd5..ce9ebd7a 100644 --- a/testcases/t/130-close-empty-split.t +++ b/testcases/t/130-close-empty-split.t @@ -17,7 +17,7 @@ cmd qq|[con_id="$first"] focus|; cmd 'split v'; -($nodes, $focus) = get_ws_content($tmp); +my ($nodes, $focus) = get_ws_content($tmp); is($nodes->[0]->{focused}, 0, 'split container not focused'); @@ -27,7 +27,7 @@ cmd 'level up'; my $split = $focus->[0]; cmd 'level down'; -my $second = open_empty_con($i3); +$second = open_empty_con($i3); isnt($first, $second, 'different container focused'); @@ -62,10 +62,10 @@ is($nodes->[0]->{focused}, 0, 'split container not focused'); # focus the split container cmd 'level up'; ($nodes, $focus) = get_ws_content($tmp); -my $split = $focus->[0]; +$split = $focus->[0]; cmd 'level down'; -my $second = open_empty_con($i3); +$second = open_empty_con($i3); isnt($first, $second, 'different container focused'); diff --git a/testcases/t/135-floating-focus.t b/testcases/t/135-floating-focus.t index b43f0f7f..5e5a68f2 100644 --- a/testcases/t/135-floating-focus.t +++ b/testcases/t/135-floating-focus.t @@ -63,7 +63,7 @@ $tmp = fresh_workspace; $first = open_window($x, { background_color => '#ff0000' }); # window 5 $second = open_window($x, { background_color => '#00ff00' }); # window 6 -my $third = open_window($x, { background_color => '#0000ff' }); # window 7 +$third = open_window($x, { background_color => '#0000ff' }); # window 7 is($x->input_focus, $third->id, 'last container focused'); diff --git a/testcases/t/138-floating-attach.t b/testcases/t/138-floating-attach.t index b08190a2..ae035f61 100644 --- a/testcases/t/138-floating-attach.t +++ b/testcases/t/138-floating-attach.t @@ -54,7 +54,7 @@ is(@{$ws->{floating_nodes}}, 0, 'no floating nodes so far'); is(@{$ws->{nodes}}, 1, 'one tiling node (stacked con)'); # Create a floating window -my $window = open_floating_window($x); +$window = open_floating_window($x); ok($window->mapped, 'Window is mapped'); $ws = get_ws($tmp); diff --git a/testcases/t/146-floating-reinsert.t b/testcases/t/146-floating-reinsert.t index bc1302bb..b63e7ac9 100644 --- a/testcases/t/146-floating-reinsert.t +++ b/testcases/t/146-floating-reinsert.t @@ -37,7 +37,7 @@ is(@{$nodes->[1]->{nodes}}, 2, 'two windows in split con'); cmd 'floating toggle'; -my ($nodes, $focus) = get_ws_content($tmp); +($nodes, $focus) = get_ws_content($tmp); is(@{$nodes->[1]->{nodes}}, 3, 'three windows in split con after floating toggle'); diff --git a/testcases/t/157-regress-fullscreen-level-up.t b/testcases/t/157-regress-fullscreen-level-up.t index 7a101dbc..f067cb93 100644 --- a/testcases/t/157-regress-fullscreen-level-up.t +++ b/testcases/t/157-regress-fullscreen-level-up.t @@ -31,7 +31,7 @@ is($nodes->[0]->{fullscreen_mode}, 0, 'client not fullscreen'); cmd 'nop making fullscreen'; cmd 'fullscreen'; -my $nodes = get_ws_content $tmp; +$nodes = get_ws_content $tmp; is($nodes->[0]->{fullscreen_mode}, 1, 'client fullscreen now'); ##################################################################### @@ -40,7 +40,7 @@ is($nodes->[0]->{fullscreen_mode}, 1, 'client fullscreen now'); cmd 'level up'; cmd 'fullscreen'; -my $nodes = get_ws_content $tmp; +$nodes = get_ws_content $tmp; is($nodes->[0]->{fullscreen_mode}, 0, 'client not fullscreen any longer'); does_i3_live; diff --git a/testcases/t/164-kill-win-vs-client.t b/testcases/t/164-kill-win-vs-client.t index ef45a789..41ae6432 100644 --- a/testcases/t/164-kill-win-vs-client.t +++ b/testcases/t/164-kill-win-vs-client.t @@ -42,7 +42,7 @@ ok(@{get_ws_content($tmp)} == 1, 'one container left after killing'); # 'kill window' ############################################################## -my $tmp = two_windows; +$tmp = two_windows; cmd 'kill window'; @@ -55,7 +55,7 @@ ok(@{get_ws_content($tmp)} == 1, 'one container left after killing'); # and check if both are gone ############################################################## -my $tmp = two_windows; +$tmp = two_windows; cmd 'kill client'; diff --git a/testcases/t/165-for_window.t b/testcases/t/165-for_window.t index 6e921cef..b3fef117 100644 --- a/testcases/t/165-for_window.t +++ b/testcases/t/165-for_window.t @@ -46,7 +46,7 @@ is($content[0]->{border}, 'normal', 'normal border'); $window->unmap; wait_for_unmap $x; -my @content = @{get_ws_content($tmp)}; +@content = @{get_ws_content($tmp)}; cmp_ok(@content, '==', 0, 'no more nodes'); diag('content = '. Dumper(\@content)); diff --git a/testcases/t/166-assign.t b/testcases/t/166-assign.t index 4844f5b5..9492486c 100644 --- a/testcases/t/166-assign.t +++ b/testcases/t/166-assign.t @@ -84,7 +84,7 @@ ok(@{get_ws_content($tmp)} == 0, 'no containers yet'); my $workspaces = get_workspace_names; ok(!("targetws" ~~ @{$workspaces}), 'targetws does not exist yet'); -my $window = $x->root->create_child( +$window = $x->root->create_child( class => WINDOW_CLASS_INPUT_OUTPUT, rect => [ 0, 0, 30, 30 ], background_color => '#0000ff', @@ -124,7 +124,7 @@ $tmp = fresh_workspace; ok(@{get_ws_content($tmp)} == 0, 'no containers yet'); ok("targetws" ~~ @{get_workspace_names()}, 'targetws does not exist yet'); -my $window = $x->root->create_child( +$window = $x->root->create_child( class => WINDOW_CLASS_INPUT_OUTPUT, rect => [ 0, 0, 30, 30 ], background_color => '#0000ff', @@ -162,10 +162,10 @@ $pid = launch_with_config($config); $tmp = fresh_workspace; ok(@{get_ws_content($tmp)} == 0, 'no containers yet'); -my $workspaces = get_workspace_names; +$workspaces = get_workspace_names; ok(!("targetws" ~~ @{$workspaces}), 'targetws does not exist yet'); -my $window = $x->root->create_child( +$window = $x->root->create_child( class => WINDOW_CLASS_INPUT_OUTPUT, rect => [ 0, 0, 30, 30 ], background_color => '#0000ff', @@ -203,10 +203,10 @@ $pid = launch_with_config($config); $tmp = fresh_workspace; ok(@{get_ws_content($tmp)} == 0, 'no containers yet'); -my $workspaces = get_workspace_names; +$workspaces = get_workspace_names; ok(!("targetws" ~~ @{$workspaces}), 'targetws does not exist yet'); -my $window = $x->root->create_child( +$window = $x->root->create_child( class => WINDOW_CLASS_INPUT_OUTPUT, rect => [ 0, 0, 30, 30 ], background_color => '#0000ff', @@ -219,7 +219,7 @@ $window->name('special window'); $window->map; wait_for_map $x; -my $content = get_ws($tmp); +$content = get_ws($tmp); ok(@{$content->{nodes}} == 0, 'no tiling cons'); ok(@{$content->{floating_nodes}} == 1, 'one floating con'); @@ -255,7 +255,7 @@ my @docked = get_dock_clients; # syntax is(@docked, 1, 'one dock client yet'); -my $window = $x->root->create_child( +$window = $x->root->create_child( class => WINDOW_CLASS_INPUT_OUTPUT, rect => [ 0, 0, 30, 30 ], background_color => '#0000ff', @@ -269,7 +269,7 @@ $window->name('special window'); $window->map; wait_for_map $x; -my $content = get_ws($tmp); +$content = get_ws($tmp); ok(@{$content->{nodes}} == 0, 'no tiling cons'); ok(@{$content->{floating_nodes}} == 0, 'one floating con'); @docked = get_dock_clients; diff --git a/testcases/t/167-workspace_layout.t b/testcases/t/167-workspace_layout.t index e4b18adf..553717c5 100644 --- a/testcases/t/167-workspace_layout.t +++ b/testcases/t/167-workspace_layout.t @@ -33,7 +33,8 @@ my $second = open_window($x); sync_with_i3($x); is($x->input_focus, $second->id, 'second window focused'); -ok(@{get_ws_content($tmp)} == 2, 'two containers opened'); +my @content = @{get_ws_content($tmp)}; +ok(@content == 2, 'two containers opened'); isnt($content[0]->{layout}, 'stacked', 'layout not stacked'); isnt($content[1]->{layout}, 'stacked', 'layout not stacked'); @@ -62,7 +63,7 @@ $second = open_window($x); sync_with_i3($x); is($x->input_focus, $second->id, 'second window focused'); -my @content = @{get_ws_content($tmp)}; +@content = @{get_ws_content($tmp)}; ok(@content == 1, 'one con at workspace level'); is($content[0]->{layout}, 'stacked', 'layout stacked'); diff --git a/testcases/t/172-start-on-named-ws.t b/testcases/t/172-start-on-named-ws.t index 4493bf83..cdd2001d 100644 --- a/testcases/t/172-start-on-named-ws.t +++ b/testcases/t/172-start-on-named-ws.t @@ -39,7 +39,7 @@ EOT $pid = launch_with_config($config); -my @names = @{get_workspace_names()}; +@names = @{get_workspace_names()}; cmp_deeply(\@names, [ 'foobar' ], 'i3 starts on named workspace foobar'); exit_gracefully($pid); @@ -57,7 +57,7 @@ EOT $pid = launch_with_config($config); -my @names = @{get_workspace_names()}; +@names = @{get_workspace_names()}; cmp_deeply(\@names, [ 'foobar' ], 'i3 starts on named workspace foobar'); exit_gracefully($pid); From 30ea33decb9bb2adb99d6fefe5ab74b7aaa6e203 Mon Sep 17 00:00:00 2001 From: Maik Fischer Date: Mon, 21 Nov 2011 21:39:50 +0100 Subject: [PATCH 04/10] testcases: let i3test.pm export $x, adapt testcases --- testcases/lib/i3test.pm | 5 ++++- testcases/t/001-tile.t | 8 +------- testcases/t/002-i3-sync.t | 4 ---- testcases/t/003-ipc.t | 2 -- testcases/t/004-unmanaged.t | 8 +------- testcases/t/005-floating.t | 8 +------- testcases/t/100-fullscreen.t | 8 +------- testcases/t/101-focus.t | 2 -- testcases/t/102-dock.t | 8 +------- testcases/t/104-focus-stack.t | 2 -- testcases/t/111-goto.t | 2 -- testcases/t/112-floating-resize.t | 7 ------- testcases/t/113-urgent.t | 7 ------- testcases/t/114-client-leader.t | 7 ------- testcases/t/119-match.t | 3 +-- testcases/t/124-move.t | 2 -- testcases/t/129-focus-after-close.t | 3 --- testcases/t/132-move-workspace.t | 1 - testcases/t/133-size-hints.t | 2 -- testcases/t/135-floating-focus.t | 4 ---- testcases/t/136-floating-ws-empty.t | 7 ------- testcases/t/137-floating-unmap.t | 7 ------- testcases/t/138-floating-attach.t | 7 ------- testcases/t/139-ws-numbers.t | 6 ------ testcases/t/140-focus-lost.t | 6 ------ testcases/t/141-resize.t | 7 ------- testcases/t/144-regress-floating-resize.t | 3 --- testcases/t/145-flattening.t | 3 --- testcases/t/146-floating-reinsert.t | 7 ------- testcases/t/147-regress-floatingmove.t | 8 -------- testcases/t/148-regress-floatingmovews.t | 7 ------- testcases/t/150-regress-dock-restart.t | 7 ------- testcases/t/153-floating-originalsize.t | 3 --- testcases/t/154-regress-multiple-dock.t | 7 ------- testcases/t/155-floating-split-size.t | 7 ------- testcases/t/156-fullscreen-focus.t | 6 ------ testcases/t/157-regress-fullscreen-level-up.t | 7 ------- testcases/t/158-wm_take_focus.t | 4 ---- testcases/t/161-regress-borders-restart.t | 2 -- testcases/t/162-regress-dock-urgent.t | 7 +------ testcases/t/163-wm-state.t | 4 +--- testcases/t/164-kill-win-vs-client.t | 2 -- testcases/t/165-for_window.t | 5 +---- testcases/t/166-assign.t | 6 +----- testcases/t/167-workspace_layout.t | 4 ---- testcases/t/168-regress-fullscreen-restart.t | 4 ---- testcases/t/170-force_focus_wrapping.t | 2 -- testcases/t/172-start-on-named-ws.t | 4 ---- testcases/t/173-regress-focus-assign.t | 6 +----- testcases/t/174-border-config.t | 2 -- testcases/t/175-startup-notification.t | 1 - testcases/t/176-workspace-baf.t | 3 --- 52 files changed, 15 insertions(+), 239 deletions(-) diff --git a/testcases/lib/i3test.pm b/testcases/lib/i3test.pm index ad598b84..f5cb0602 100644 --- a/testcases/lib/i3test.pm +++ b/testcases/lib/i3test.pm @@ -39,6 +39,7 @@ our @EXPORT = qw( wait_for_event wait_for_map wait_for_unmap + $x ); my $tester = Test::Builder->new(); @@ -46,6 +47,8 @@ my $_cached_socket_path = undef; my $_sync_window = undef; my $tmp_socket_path = undef; +our $x; + BEGIN { my $window_count = 0; sub counter_window { @@ -72,6 +75,7 @@ __ strict->import; warnings->import; + $x ||= i3test::X11->new; @_ = ($class); goto \&Exporter::import; } @@ -404,7 +408,6 @@ sub get_socket_path { return $_cached_socket_path; } - my $x = X11::XCB::Connection->new; my $atom = $x->atom(name => 'I3_SOCKET_PATH'); my $cookie = $x->get_property(0, $x->get_root_window(), $atom->id, GET_PROPERTY_TYPE_ANY, 0, 256); my $reply = $x->get_property_reply($cookie->{sequence}); diff --git a/testcases/t/001-tile.t b/testcases/t/001-tile.t index 0db3b83b..066bc640 100644 --- a/testcases/t/001-tile.t +++ b/testcases/t/001-tile.t @@ -2,13 +2,7 @@ # 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; +use X11::XCB 'WINDOW_CLASS_INPUT_OUTPUT'; my $original_rect = X11::XCB::Rect->new(x => 0, y => 0, width => 30, height => 30); diff --git a/testcases/t/002-i3-sync.t b/testcases/t/002-i3-sync.t index 7518c949..75871f9d 100644 --- a/testcases/t/002-i3-sync.t +++ b/testcases/t/002-i3-sync.t @@ -3,12 +3,8 @@ # # checks if i3 supports I3_SYNC # -use X11::XCB qw(:all); -use X11::XCB::Connection; use i3test; -my $x = X11::XCB::Connection->new; - my $result = sync_with_i3($x); ok($result, 'syncing was successful'); diff --git a/testcases/t/003-ipc.t b/testcases/t/003-ipc.t index 982ece7e..296375ab 100644 --- a/testcases/t/003-ipc.t +++ b/testcases/t/003-ipc.t @@ -3,8 +3,6 @@ use i3test; -my $x = X11::XCB::Connection->new; - fresh_workspace; ##################################################################### diff --git a/testcases/t/004-unmanaged.t b/testcases/t/004-unmanaged.t index 1ef934ee..70bdb557 100644 --- a/testcases/t/004-unmanaged.t +++ b/testcases/t/004-unmanaged.t @@ -2,13 +2,7 @@ # 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; +use X11::XCB 'WINDOW_CLASS_INPUT_OUTPUT'; my $original_rect = X11::XCB::Rect->new(x => 0, y => 0, width => 30, height => 30); diff --git a/testcases/t/005-floating.t b/testcases/t/005-floating.t index d605328d..7e6b8922 100644 --- a/testcases/t/005-floating.t +++ b/testcases/t/005-floating.t @@ -2,13 +2,7 @@ # 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; +use X11::XCB 'WINDOW_CLASS_INPUT_OUTPUT'; # Create a floating window which is smaller than the minimum enforced size of i3 my $window = $x->root->create_child( diff --git a/testcases/t/100-fullscreen.t b/testcases/t/100-fullscreen.t index ae8c63f6..e014da48 100644 --- a/testcases/t/100-fullscreen.t +++ b/testcases/t/100-fullscreen.t @@ -2,7 +2,7 @@ # vim:ts=4:sw=4:expandtab use i3test; -use X11::XCB qw(:all); +use X11::XCB 'WINDOW_CLASS_INPUT_OUTPUT'; use List::Util qw(first); my $i3 = i3(get_socket_path()); @@ -26,12 +26,6 @@ for my $o (@outputs) { } } -BEGIN { - use_ok('X11::XCB::Window'); -} - -my $x = X11::XCB::Connection->new; - ################################## # map a window, then fullscreen it ################################## diff --git a/testcases/t/101-focus.t b/testcases/t/101-focus.t index 51119007..070d1385 100644 --- a/testcases/t/101-focus.t +++ b/testcases/t/101-focus.t @@ -3,8 +3,6 @@ use i3test; -my $x = X11::XCB::Connection->new; - my $tmp = fresh_workspace; ##################################################################### diff --git a/testcases/t/102-dock.t b/testcases/t/102-dock.t index 092cf3d2..213052f5 100644 --- a/testcases/t/102-dock.t +++ b/testcases/t/102-dock.t @@ -2,15 +2,9 @@ # vim:ts=4:sw=4:expandtab use i3test; -use X11::XCB qw(:all); +use X11::XCB 'PROP_MODE_REPLACE'; use List::Util qw(first); -BEGIN { - use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection'); -} - -my $x = X11::XCB::Connection->new; - ##################################################################### # verify that there is no dock window yet ##################################################################### diff --git a/testcases/t/104-focus-stack.t b/testcases/t/104-focus-stack.t index b5be284c..8807d015 100644 --- a/testcases/t/104-focus-stack.t +++ b/testcases/t/104-focus-stack.t @@ -5,8 +5,6 @@ use i3test; -my $x = X11::XCB::Connection->new; - fresh_workspace; cmd 'split h'; diff --git a/testcases/t/111-goto.t b/testcases/t/111-goto.t index 76baec0e..0da9e8e0 100644 --- a/testcases/t/111-goto.t +++ b/testcases/t/111-goto.t @@ -4,8 +4,6 @@ use i3test; use File::Temp; -my $x = X11::XCB::Connection->new; - my $tmp = fresh_workspace; cmd 'split h'; diff --git a/testcases/t/112-floating-resize.t b/testcases/t/112-floating-resize.t index ac3387a9..a428df4f 100644 --- a/testcases/t/112-floating-resize.t +++ b/testcases/t/112-floating-resize.t @@ -2,13 +2,6 @@ # vim:ts=4:sw=4:expandtab use i3test; -use X11::XCB qw(:all); - -BEGIN { - use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection'); -} - -my $x = X11::XCB::Connection->new; fresh_workspace; diff --git a/testcases/t/113-urgent.t b/testcases/t/113-urgent.t index cb547667..2b78b882 100644 --- a/testcases/t/113-urgent.t +++ b/testcases/t/113-urgent.t @@ -2,15 +2,8 @@ # vim:ts=4:sw=4:expandtab use i3test; -use X11::XCB qw(:all); use List::Util qw(first); -BEGIN { - use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection'); -} - -my $x = X11::XCB::Connection->new; - my $tmp = fresh_workspace; ##################################################################### diff --git a/testcases/t/114-client-leader.t b/testcases/t/114-client-leader.t index 6f7ffce0..d2fd16a0 100644 --- a/testcases/t/114-client-leader.t +++ b/testcases/t/114-client-leader.t @@ -2,13 +2,6 @@ # vim:ts=4:sw=4:expandtab use i3test; -use X11::XCB qw(:all); - -BEGIN { - use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection'); -} - -my $x = X11::XCB::Connection->new; my $tmp = fresh_workspace; diff --git a/testcases/t/119-match.t b/testcases/t/119-match.t index 8b9d21d3..80c94ab1 100644 --- a/testcases/t/119-match.t +++ b/testcases/t/119-match.t @@ -4,14 +4,13 @@ # Tests all kinds of matching methods # use i3test; -use X11::XCB qw(:all); +use X11::XCB qw(PROP_MODE_REPLACE WINDOW_CLASS_INPUT_OUTPUT); my $tmp = fresh_workspace; ok(@{get_ws_content($tmp)} == 0, 'no containers yet'); # Open a new window -my $x = X11::XCB::Connection->new; my $window = open_window($x); my $content = get_ws_content($tmp); ok(@{$content} == 1, 'window mapped'); diff --git a/testcases/t/124-move.t b/testcases/t/124-move.t index a6eb6164..9d7a235f 100644 --- a/testcases/t/124-move.t +++ b/testcases/t/124-move.t @@ -8,9 +8,7 @@ # 4) move a container in a different direction so that we need to go up in tree # use i3test; -use X11::XCB::Connection; -my $x = X11::XCB::Connection->new; my $i3 = i3(get_socket_path()); my $tmp = fresh_workspace; diff --git a/testcases/t/129-focus-after-close.t b/testcases/t/129-focus-after-close.t index 8d225613..1bb2eedc 100644 --- a/testcases/t/129-focus-after-close.t +++ b/testcases/t/129-focus-after-close.t @@ -4,11 +4,8 @@ # Check if the focus is correctly restored after closing windows. # use i3test; -use X11::XCB qw(:all); use List::Util qw(first); -my $x = X11::XCB::Connection->new; - my $i3 = i3(get_socket_path()); my $tmp = fresh_workspace; diff --git a/testcases/t/132-move-workspace.t b/testcases/t/132-move-workspace.t index 82e59dd1..1643fc75 100644 --- a/testcases/t/132-move-workspace.t +++ b/testcases/t/132-move-workspace.t @@ -9,7 +9,6 @@ my $i3 = i3(get_socket_path()); # We move the pointer out of our way to avoid a bug where the focus will # be set to the window under the cursor -my $x = X11::XCB::Connection->new; $x->root->warp_pointer(0, 0); my $tmp = get_unused_workspace(); diff --git a/testcases/t/133-size-hints.t b/testcases/t/133-size-hints.t index d2d77e8e..90ecf62e 100644 --- a/testcases/t/133-size-hints.t +++ b/testcases/t/133-size-hints.t @@ -5,8 +5,6 @@ # use i3test; -my $x = X11::XCB::Connection->new; - my $tmp = fresh_workspace; ok(@{get_ws_content($tmp)} == 0, 'no containers yet'); diff --git a/testcases/t/135-floating-focus.t b/testcases/t/135-floating-focus.t index 5e5a68f2..bae983e7 100644 --- a/testcases/t/135-floating-focus.t +++ b/testcases/t/135-floating-focus.t @@ -2,10 +2,6 @@ # vim:ts=4:sw=4:expandtab use i3test; -use X11::XCB qw(:all); -use X11::XCB::Connection; - -my $x = X11::XCB::Connection->new; my $tmp = fresh_workspace; diff --git a/testcases/t/136-floating-ws-empty.t b/testcases/t/136-floating-ws-empty.t index a6e0e405..1666884e 100644 --- a/testcases/t/136-floating-ws-empty.t +++ b/testcases/t/136-floating-ws-empty.t @@ -3,11 +3,6 @@ # Regression test: when only having a floating window on a workspace, it should not be deleted. use i3test; -use X11::XCB qw(:all); - -BEGIN { - use_ok('X11::XCB::Window'); -} my $i3 = i3(get_socket_path()); @@ -19,8 +14,6 @@ my $tmp = fresh_workspace; ok(workspace_exists($tmp), "workspace $tmp exists"); -my $x = X11::XCB::Connection->new; - # Create a floating window which is smaller than the minimum enforced size of i3 my $window = open_floating_window($x); ok($window->mapped, 'Window is mapped'); diff --git a/testcases/t/137-floating-unmap.t b/testcases/t/137-floating-unmap.t index ab1a33d3..29762594 100644 --- a/testcases/t/137-floating-unmap.t +++ b/testcases/t/137-floating-unmap.t @@ -4,11 +4,6 @@ # to a different workspace. use i3test; -use X11::XCB qw(:all); - -BEGIN { - use_ok('X11::XCB::Window'); -} my $i3 = i3(get_socket_path()); @@ -18,8 +13,6 @@ my $tmp = fresh_workspace; # 1: open a floating window, get it mapped ############################################################################# -my $x = X11::XCB::Connection->new; - # Create a floating window which is smaller than the minimum enforced size of i3 my $window = open_floating_window($x); ok($window->mapped, 'Window is mapped'); diff --git a/testcases/t/138-floating-attach.t b/testcases/t/138-floating-attach.t index ae035f61..9a7996b1 100644 --- a/testcases/t/138-floating-attach.t +++ b/testcases/t/138-floating-attach.t @@ -4,11 +4,6 @@ # if only a floating window is present on the workspace. use i3test; -use X11::XCB qw(:all); - -BEGIN { - use_ok('X11::XCB::Window'); -} my $i3 = i3(get_socket_path()); @@ -18,8 +13,6 @@ my $tmp = fresh_workspace; # 1: open a floating window, get it mapped ############################################################################# -my $x = X11::XCB::Connection->new; - # Create a floating window my $window = open_floating_window($x); ok($window->mapped, 'Window is mapped'); diff --git a/testcases/t/139-ws-numbers.t b/testcases/t/139-ws-numbers.t index 31f013ef..9d73ad1c 100644 --- a/testcases/t/139-ws-numbers.t +++ b/testcases/t/139-ws-numbers.t @@ -3,14 +3,8 @@ # Check if numbered workspaces and named workspaces are sorted in the right way # in get_workspaces IPC output (necessary for i3bar etc.). use i3test; -use X11::XCB qw(:all); - -BEGIN { - use_ok('X11::XCB::Window'); -} my $i3 = i3(get_socket_path()); -my $x = X11::XCB::Connection->new; sub check_order { my ($msg) = @_; diff --git a/testcases/t/140-focus-lost.t b/testcases/t/140-focus-lost.t index fb77f01e..cd6eee38 100644 --- a/testcases/t/140-focus-lost.t +++ b/testcases/t/140-focus-lost.t @@ -3,14 +3,8 @@ # Regression: Check if the focus stays the same when switching the layout # bug introduced by 77d0d42ed2d7ac8cafe267c92b35a81c1b9491eb use i3test; -use X11::XCB qw(:all); - -BEGIN { - use_ok('X11::XCB::Window'); -} my $i3 = i3(get_socket_path()); -my $x = X11::XCB::Connection->new; sub check_order { my ($msg) = @_; diff --git a/testcases/t/141-resize.t b/testcases/t/141-resize.t index 8691a044..18e28ccb 100644 --- a/testcases/t/141-resize.t +++ b/testcases/t/141-resize.t @@ -2,13 +2,6 @@ # vim:ts=4:sw=4:expandtab # Tests resizing tiling containers use i3test; -use X11::XCB qw(:all); - -BEGIN { - use_ok('X11::XCB::Window'); -} - -my $x = X11::XCB::Connection->new; my $tmp = fresh_workspace; diff --git a/testcases/t/144-regress-floating-resize.t b/testcases/t/144-regress-floating-resize.t index 44a67bc3..fa1edda5 100644 --- a/testcases/t/144-regress-floating-resize.t +++ b/testcases/t/144-regress-floating-resize.t @@ -8,9 +8,6 @@ # use i3test; use List::Util qw(sum); -use X11::XCB::Connection; - -my $x = X11::XCB::Connection->new; my $tmp = fresh_workspace; diff --git a/testcases/t/145-flattening.t b/testcases/t/145-flattening.t index 6810f479..8baf9217 100644 --- a/testcases/t/145-flattening.t +++ b/testcases/t/145-flattening.t @@ -10,11 +10,8 @@ # # This testcase checks that the tree is properly flattened after moving. # -use X11::XCB qw(:all); use i3test; -my $x = X11::XCB::Connection->new; - my $tmp = fresh_workspace; my $left = open_window($x); diff --git a/testcases/t/146-floating-reinsert.t b/testcases/t/146-floating-reinsert.t index b63e7ac9..1015f8f8 100644 --- a/testcases/t/146-floating-reinsert.t +++ b/testcases/t/146-floating-reinsert.t @@ -1,15 +1,8 @@ #!perl # vim:ts=4:sw=4:expandtab # -use X11::XCB qw(:all); use i3test; -BEGIN { - use_ok('X11::XCB::Window'); -} - -my $x = X11::XCB::Connection->new; - my $tmp = fresh_workspace; my $left = open_window($x); diff --git a/testcases/t/147-regress-floatingmove.t b/testcases/t/147-regress-floatingmove.t index 5f14741b..74adef69 100644 --- a/testcases/t/147-regress-floatingmove.t +++ b/testcases/t/147-regress-floatingmove.t @@ -4,16 +4,8 @@ # Regression test for moving a con outside of a floating con when there are no # tiling cons on a workspace # -use X11::XCB qw(:all); -use Time::HiRes qw(sleep); use i3test; -BEGIN { - use_ok('X11::XCB::Window'); -} - -my $x = X11::XCB::Connection->new; - my $tmp = fresh_workspace; my $left = open_window($x); diff --git a/testcases/t/148-regress-floatingmovews.t b/testcases/t/148-regress-floatingmovews.t index 6f9dfc40..0e6345b2 100644 --- a/testcases/t/148-regress-floatingmovews.t +++ b/testcases/t/148-regress-floatingmovews.t @@ -4,15 +4,8 @@ # Regression test for correct focus behaviour when moving a floating con to # another workspace. # -use X11::XCB qw(:all); use i3test; -BEGIN { - use_ok('X11::XCB::Window'); -} - -my $x = X11::XCB::Connection->new; - my $tmp = fresh_workspace; # open a tiling window on the first workspace diff --git a/testcases/t/150-regress-dock-restart.t b/testcases/t/150-regress-dock-restart.t index e294e6bd..a28e0730 100644 --- a/testcases/t/150-regress-dock-restart.t +++ b/testcases/t/150-regress-dock-restart.t @@ -3,15 +3,8 @@ # # Regression test for inplace restarting with dock clients # -use X11::XCB qw(:all); use i3test; -BEGIN { - use_ok('X11::XCB::Window'); -} - -my $x = X11::XCB::Connection->new; - my $tmp = fresh_workspace; ##################################################################### diff --git a/testcases/t/153-floating-originalsize.t b/testcases/t/153-floating-originalsize.t index db0b6e9c..2c798cfa 100644 --- a/testcases/t/153-floating-originalsize.t +++ b/testcases/t/153-floating-originalsize.t @@ -3,13 +3,10 @@ # # Test if the requested width/height is set after making the window floating. # -use X11::XCB qw(:all); use i3test; my $tmp = fresh_workspace; -my $x = X11::XCB::Connection->new; - # Create a floating window which is smaller than the minimum enforced size of i3 my $window = open_window($x, { rect => [ 0, 0, 400, 150 ] }); diff --git a/testcases/t/154-regress-multiple-dock.t b/testcases/t/154-regress-multiple-dock.t index 8b7f456c..52ab4004 100644 --- a/testcases/t/154-regress-multiple-dock.t +++ b/testcases/t/154-regress-multiple-dock.t @@ -3,15 +3,8 @@ # # Regression test for closing one of multiple dock clients # -use X11::XCB qw(:all); use i3test; -BEGIN { - use_ok('X11::XCB::Window'); -} - -my $x = X11::XCB::Connection->new; - my $tmp = fresh_workspace; ##################################################################### diff --git a/testcases/t/155-floating-split-size.t b/testcases/t/155-floating-split-size.t index 5de05e8b..618266b6 100644 --- a/testcases/t/155-floating-split-size.t +++ b/testcases/t/155-floating-split-size.t @@ -4,15 +4,8 @@ # Test to see if i3 combines the geometry of all children in a split container # when setting the split container to floating # -use X11::XCB qw(:all); use i3test; -BEGIN { - use_ok('X11::XCB::Window'); -} - -my $x = X11::XCB::Connection->new; - my $tmp = fresh_workspace; ##################################################################### diff --git a/testcases/t/156-fullscreen-focus.t b/testcases/t/156-fullscreen-focus.t index a559b5a5..e188b375 100644 --- a/testcases/t/156-fullscreen-focus.t +++ b/testcases/t/156-fullscreen-focus.t @@ -4,14 +4,8 @@ # Test if new containers get focused when there is a fullscreen container at # the time of launching the new one. # -use X11::XCB qw(:all); use i3test; -BEGIN { - use_ok('X11::XCB::Window'); -} - -my $x = X11::XCB::Connection->new; my $i3 = i3(get_socket_path()); my $tmp = fresh_workspace; diff --git a/testcases/t/157-regress-fullscreen-level-up.t b/testcases/t/157-regress-fullscreen-level-up.t index f067cb93..2c9c4b17 100644 --- a/testcases/t/157-regress-fullscreen-level-up.t +++ b/testcases/t/157-regress-fullscreen-level-up.t @@ -3,15 +3,8 @@ # # Regression test: level up should be a noop during fullscreen mode # -use X11::XCB qw(:all); use i3test; -BEGIN { - use_ok('X11::XCB::Window'); -} - -my $x = X11::XCB::Connection->new; - my $tmp = fresh_workspace; ##################################################################### diff --git a/testcases/t/158-wm_take_focus.t b/testcases/t/158-wm_take_focus.t index a90ce1c3..3da8d907 100644 --- a/testcases/t/158-wm_take_focus.t +++ b/testcases/t/158-wm_take_focus.t @@ -3,11 +3,7 @@ # # Tests if the WM_TAKE_FOCUS protocol is correctly handled by i3 # -use X11::XCB qw(:all); use i3test; -use v5.10; - -my $x = X11::XCB::Connection->new; subtest 'Window without WM_TAKE_FOCUS', sub { fresh_workspace; diff --git a/testcases/t/161-regress-borders-restart.t b/testcases/t/161-regress-borders-restart.t index c5e3ef80..ce53b002 100644 --- a/testcases/t/161-regress-borders-restart.t +++ b/testcases/t/161-regress-borders-restart.t @@ -5,11 +5,9 @@ # restart. # found in eb8ad348b28e243cba1972e802ca8ee636472fc9 # -use X11::XCB qw(:all); use List::Util qw(first); use i3test; -my $x = X11::XCB::Connection->new; my $i3 = i3(get_socket_path()); my $tmp = fresh_workspace; my $window = open_window($x); diff --git a/testcases/t/162-regress-dock-urgent.t b/testcases/t/162-regress-dock-urgent.t index 5fb88129..39e4eac4 100644 --- a/testcases/t/162-regress-dock-urgent.t +++ b/testcases/t/162-regress-dock-urgent.t @@ -4,14 +4,9 @@ # Regression test for setting the urgent hint on dock clients. # found in 4be3178d4d360c2996217d811e61161c84d25898 # -use X11::XCB qw(:all); use i3test; +use X11::XCB 'WINDOW_CLASS_INPUT_OUTPUT'; -BEGIN { - use_ok('X11::XCB::Window'); -} - -my $x = X11::XCB::Connection->new; my $i3 = i3(get_socket_path()); my $tmp = fresh_workspace; diff --git a/testcases/t/163-wm-state.t b/testcases/t/163-wm-state.t index e55d8682..e5b42df4 100644 --- a/testcases/t/163-wm-state.t +++ b/testcases/t/163-wm-state.t @@ -4,10 +4,8 @@ # Tests if WM_STATE is WM_STATE_NORMAL when mapped and WM_STATE_WITHDRAWN when # unmapped. # -use X11::XCB qw(:all); use i3test; - -my $x = X11::XCB::Connection->new; +use X11::XCB qw(ICCCM_WM_STATE_NORMAL ICCCM_WM_STATE_WITHDRAWN); my $window = open_window($x); diff --git a/testcases/t/164-kill-win-vs-client.t b/testcases/t/164-kill-win-vs-client.t index 41ae6432..df9b7fd8 100644 --- a/testcases/t/164-kill-win-vs-client.t +++ b/testcases/t/164-kill-win-vs-client.t @@ -6,8 +6,6 @@ # use i3test; -my $x = X11::XCB::Connection->new; - sub two_windows { my $tmp = fresh_workspace; diff --git a/testcases/t/165-for_window.t b/testcases/t/165-for_window.t index b3fef117..88c542eb 100644 --- a/testcases/t/165-for_window.t +++ b/testcases/t/165-for_window.t @@ -3,11 +3,8 @@ # !NO_I3_INSTANCE! will prevent complete-run.pl from starting i3 # # -use X11::XCB qw(:all); -use X11::XCB::Connection; use i3test; - -my $x = X11::XCB::Connection->new; +use X11::XCB qw(PROP_MODE_REPLACE WINDOW_CLASS_INPUT_OUTPUT); ############################################################## # 1: test the following directive: diff --git a/testcases/t/166-assign.t b/testcases/t/166-assign.t index 9492486c..d2bb9fa7 100644 --- a/testcases/t/166-assign.t +++ b/testcases/t/166-assign.t @@ -5,11 +5,7 @@ # Tests if assignments work # use i3test; -use X11::XCB qw(:all); -use X11::XCB::Connection; -use v5.10; - -my $x = X11::XCB::Connection->new; +use X11::XCB qw(PROP_MODE_REPLACE WINDOW_CLASS_INPUT_OUTPUT); # TODO: move to X11::XCB sub set_wm_class { diff --git a/testcases/t/167-workspace_layout.t b/testcases/t/167-workspace_layout.t index 553717c5..2744c9ba 100644 --- a/testcases/t/167-workspace_layout.t +++ b/testcases/t/167-workspace_layout.t @@ -6,10 +6,6 @@ # use i3test; -use X11::XCB qw(:all); -use X11::XCB::Connection; - -my $x = X11::XCB::Connection->new; ##################################################################### # 1: check that with an empty config, cons are place next to each diff --git a/testcases/t/168-regress-fullscreen-restart.t b/testcases/t/168-regress-fullscreen-restart.t index 1418b402..70bddd8e 100644 --- a/testcases/t/168-regress-fullscreen-restart.t +++ b/testcases/t/168-regress-fullscreen-restart.t @@ -4,10 +4,6 @@ # Verifies that i3 survives inplace restarts with fullscreen containers # use i3test; -use X11::XCB qw(:all); -use X11::XCB::Connection; - -my $x = X11::XCB::Connection->new; fresh_workspace; diff --git a/testcases/t/170-force_focus_wrapping.t b/testcases/t/170-force_focus_wrapping.t index d2f15a65..b8920c2d 100644 --- a/testcases/t/170-force_focus_wrapping.t +++ b/testcases/t/170-force_focus_wrapping.t @@ -6,8 +6,6 @@ # use i3test; -my $x = i3test::X11->new; - ##################################################################### # 1: test the wrapping behaviour without force_focus_wrapping ##################################################################### diff --git a/testcases/t/172-start-on-named-ws.t b/testcases/t/172-start-on-named-ws.t index cdd2001d..97ae16e9 100644 --- a/testcases/t/172-start-on-named-ws.t +++ b/testcases/t/172-start-on-named-ws.t @@ -4,12 +4,8 @@ # # checks if i3 starts up on workspace '1' or the first configured named workspace # -use X11::XCB qw(:all); -use X11::XCB::Connection; use i3test; -my $x = X11::XCB::Connection->new; - ############################################################## # 1: i3 should start with workspace '1' ############################################################## diff --git a/testcases/t/173-regress-focus-assign.t b/testcases/t/173-regress-focus-assign.t index 70414af3..bd0ff647 100644 --- a/testcases/t/173-regress-focus-assign.t +++ b/testcases/t/173-regress-focus-assign.t @@ -6,11 +6,7 @@ # assigned to an invisible workspace # use i3test; -use X11::XCB qw(:all); -use X11::XCB::Connection; -use v5.10; - -my $x = X11::XCB::Connection->new; +use X11::XCB qw(PROP_MODE_REPLACE WINDOW_CLASS_INPUT_OUTPUT); # TODO: move to X11::XCB sub set_wm_class { diff --git a/testcases/t/174-border-config.t b/testcases/t/174-border-config.t index cc1f5c90..a27126cb 100644 --- a/testcases/t/174-border-config.t +++ b/testcases/t/174-border-config.t @@ -7,8 +7,6 @@ use i3test; -my $x = X11::XCB::Connection->new; - ##################################################################### # 1: check that new windows start with 'normal' border unless configured # otherwise diff --git a/testcases/t/175-startup-notification.t b/testcases/t/175-startup-notification.t index 55df4142..b624508b 100644 --- a/testcases/t/175-startup-notification.t +++ b/testcases/t/175-startup-notification.t @@ -8,7 +8,6 @@ use i3test; use POSIX qw(mkfifo); use File::Temp qw(:POSIX); -my $x = X11::XCB::Connection->new; use ExtUtils::PkgConfig; # setup dependency on libstartup-notification using pkg-config diff --git a/testcases/t/176-workspace-baf.t b/testcases/t/176-workspace-baf.t index 48ea948d..31c4f248 100644 --- a/testcases/t/176-workspace-baf.t +++ b/testcases/t/176-workspace-baf.t @@ -7,9 +7,6 @@ # use i3test; -use X11::XCB::Connection; - -my $x = X11::XCB::Connection->new; my $config = < Date: Mon, 21 Nov 2011 23:37:04 +0100 Subject: [PATCH 05/10] testcases: use global $x in wait_for_event, drop $x parameter --- testcases/lib/i3test.pm | 12 +++++------- testcases/t/158-wm_take_focus.t | 4 ++-- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/testcases/lib/i3test.pm b/testcases/lib/i3test.pm index f5cb0602..304e0738 100644 --- a/testcases/lib/i3test.pm +++ b/testcases/lib/i3test.pm @@ -90,7 +90,7 @@ __ # wait_for_event $x, 0.25, sub { $_[0]->{response_type} == MAP_NOTIFY }; # sub wait_for_event { - my ($x, $timeout, $cb) = @_; + my ($timeout, $cb) = @_; my $cv = AE::cv; @@ -122,16 +122,14 @@ sub wait_for_event { # thin wrapper around wait_for_event which waits for MAP_NOTIFY # make sure to include 'structure_notify' in the window’s event_mask attribute sub wait_for_map { - my ($x) = @_; - wait_for_event $x, 2, sub { $_[0]->{response_type} == MAP_NOTIFY }; + wait_for_event 2, sub { $_[0]->{response_type} == MAP_NOTIFY }; } # Wrapper around wait_for_event which waits for UNMAP_NOTIFY. Also calls # sync_with_i3 to make sure i3 also picked up and processed the UnmapNotify # event. sub wait_for_unmap { - my ($x) = @_; - wait_for_event $x, 2, sub { $_[0]->{response_type} == UNMAP_NOTIFY }; + wait_for_event 2, sub { $_[0]->{response_type} == UNMAP_NOTIFY }; sync_with_i3($x); } @@ -334,7 +332,7 @@ sub sync_with_i3 { $_sync_window->map; - wait_for_event $x, 2, sub { $_[0]->{response_type} == MAP_NOTIFY }; + wait_for_event 2, sub { $_[0]->{response_type} == MAP_NOTIFY }; } my $root = $x->get_root_window(); @@ -360,7 +358,7 @@ sub sync_with_i3 { $x->send_event(0, $root, EVENT_MASK_SUBSTRUCTURE_REDIRECT, $msg); # now wait until the reply is here - return wait_for_event $x, 2, sub { + return wait_for_event 2, sub { my ($event) = @_; # TODO: const return 0 unless $event->{response_type} == 161; diff --git a/testcases/t/158-wm_take_focus.t b/testcases/t/158-wm_take_focus.t index 3da8d907..0580b9c9 100644 --- a/testcases/t/158-wm_take_focus.t +++ b/testcases/t/158-wm_take_focus.t @@ -10,7 +10,7 @@ subtest 'Window without WM_TAKE_FOCUS', sub { my $window = open_window($x); - ok(!wait_for_event($x, 1, sub { $_[0]->{response_type} == 161 }), 'did not receive ClientMessage'); + ok(!wait_for_event(1, sub { $_[0]->{response_type} == 161 }), 'did not receive ClientMessage'); done_testing; }; @@ -27,7 +27,7 @@ subtest 'Window with WM_TAKE_FOCUS', sub { $window->map; - ok(wait_for_event($x, 1, sub { + ok(wait_for_event(1, sub { return 0 unless $_[0]->{response_type} == 161; my ($data, $time) = unpack("L2", $_[0]->{data}); return ($data == $take_focus->id); From ea2aba4319c11b3417c88feb7080106c2ee58c74 Mon Sep 17 00:00:00 2001 From: Maik Fischer Date: Mon, 21 Nov 2011 23:39:58 +0100 Subject: [PATCH 06/10] testcases: undo 0f386a96 t/144-regress-floating-resize.t wait_for_map can't be used, since we don't set structure_notify on the urxvts windows --- testcases/t/144-regress-floating-resize.t | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/testcases/t/144-regress-floating-resize.t b/testcases/t/144-regress-floating-resize.t index fa1edda5..de33eeb3 100644 --- a/testcases/t/144-regress-floating-resize.t +++ b/testcases/t/144-regress-floating-resize.t @@ -12,10 +12,9 @@ use List::Util qw(sum); my $tmp = fresh_workspace; cmd 'exec /usr/bin/urxvt'; -wait_for_map $x; +sleep 0.5; cmd 'exec /usr/bin/urxvt'; -wait_for_map $x; - +sleep 0.5; my ($nodes, $focus) = get_ws_content($tmp); my $old_sum = sum map { $_->{rect}->{width} } @{$nodes}; #cmd 'open'; @@ -23,13 +22,12 @@ cmd 'resize grow left 10 px or 25 ppt'; cmd 'split v'; #cmd 'open'; cmd 'exec /usr/bin/urxvt'; -wait_for_map $x; - +sleep 0.5; cmd 'mode toggle'; -sync_with_i3 $x; - +sleep 0.5; cmd 'kill'; -wait_for_unmap $x; + +sleep 0.5; ($nodes, $focus) = get_ws_content($tmp); my $new_sum = sum map { $_->{rect}->{width} } @{$nodes}; From 65471a6b18f62db4801af281d30059a660491df4 Mon Sep 17 00:00:00 2001 From: Maik Fischer Date: Mon, 21 Nov 2011 23:42:54 +0100 Subject: [PATCH 07/10] testcases: only export eq_deeply, cmp_deeply from Test::Deep --- testcases/lib/i3test.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testcases/lib/i3test.pm b/testcases/lib/i3test.pm index 304e0738..98d27e90 100644 --- a/testcases/lib/i3test.pm +++ b/testcases/lib/i3test.pm @@ -68,7 +68,7 @@ use Test::Most $test_most_args; use Data::Dumper; use AnyEvent::I3; use Time::HiRes qw(sleep); -use Test::Deep qw(eq_deeply cmp_deeply cmp_set cmp_bag cmp_methods useclass noclass set bag subbagof superbagof subsetof supersetof superhashof subhashof bool str arraylength Isa ignore methods regexprefonly regexpmatches num regexponly scalref reftype hashkeysonly blessed array re hash regexpref hash_each shallow array_each code arrayelementsonly arraylengthonly scalarrefonly listmethods any hashkeys isa); +use Test::Deep qw(eq_deeply cmp_deeply); __ $tester->bail_out("$@") if $@; feature->import(":5.10"); From da403b3667b0b48f5e1da2ac1e884f2b1bddd4a3 Mon Sep 17 00:00:00 2001 From: Maik Fischer Date: Mon, 21 Nov 2011 23:44:20 +0100 Subject: [PATCH 08/10] testcases: use $x in wait_for_(un)map change to wait_for_(un)map($win) wait_for_unmap currently ignores its $window parameter, since X11::XCB doesn't provide $event->{window} for unmap events yet. --- testcases/lib/i3test.pm | 15 ++++++++++--- testcases/t/005-floating.t | 7 +++--- testcases/t/100-fullscreen.t | 4 ++-- testcases/t/102-dock.t | 12 +++++------ testcases/t/104-focus-stack.t | 2 +- testcases/t/114-client-leader.t | 10 ++++----- testcases/t/117-workspace.t | 2 +- testcases/t/119-match.t | 14 ++++++------ testcases/t/133-size-hints.t | 2 +- testcases/t/135-floating-focus.t | 10 ++++----- testcases/t/150-regress-dock-restart.t | 2 +- testcases/t/163-wm-state.t | 2 +- testcases/t/165-for_window.t | 30 +++++++++++++------------- testcases/t/166-assign.t | 10 ++++----- 14 files changed, 66 insertions(+), 56 deletions(-) diff --git a/testcases/lib/i3test.pm b/testcases/lib/i3test.pm index 98d27e90..c94101e1 100644 --- a/testcases/lib/i3test.pm +++ b/testcases/lib/i3test.pm @@ -12,6 +12,7 @@ use EV; use List::Util qw(first); use Time::HiRes qw(sleep); use Cwd qw(abs_path); +use Scalar::Util qw(blessed); use SocketActivation; use v5.10; @@ -122,14 +123,22 @@ sub wait_for_event { # thin wrapper around wait_for_event which waits for MAP_NOTIFY # make sure to include 'structure_notify' in the window’s event_mask attribute sub wait_for_map { - wait_for_event 2, sub { $_[0]->{response_type} == MAP_NOTIFY }; + my ($win) = @_; + my $id = (blessed($win) && $win->isa('X11::XCB::Window')) ? $win->id : $win; + wait_for_event 2, sub { + $_[0]->{response_type} == MAP_NOTIFY and $_[0]->{window} == $id + }; } # Wrapper around wait_for_event which waits for UNMAP_NOTIFY. Also calls # sync_with_i3 to make sure i3 also picked up and processed the UnmapNotify # event. sub wait_for_unmap { - wait_for_event 2, sub { $_[0]->{response_type} == UNMAP_NOTIFY }; + my ($win) = @_; + # my $id = (blessed($win) && $win->isa('X11::XCB::Window')) ? $win->id : $win; + wait_for_event 2, sub { + $_[0]->{response_type} == UNMAP_NOTIFY # and $_[0]->{window} == $id + }; sync_with_i3($x); } @@ -163,7 +172,7 @@ sub open_window { return $window if $dont_map; $window->map; - wait_for_map($x); + wait_for_map($window); # We sync with i3 here to make sure $x->input_focus is updated. sync_with_i3($x); return $window; diff --git a/testcases/t/005-floating.t b/testcases/t/005-floating.t index 7e6b8922..d62a0366 100644 --- a/testcases/t/005-floating.t +++ b/testcases/t/005-floating.t @@ -18,7 +18,7 @@ isa_ok($window, 'X11::XCB::Window'); $window->map; -wait_for_map $x; +wait_for_map $window; my ($absolute, $top) = $window->rect; @@ -42,7 +42,7 @@ isa_ok($window, 'X11::XCB::Window'); $window->map; -wait_for_map $x; +wait_for_map $window; ($absolute, $top) = $window->rect; @@ -73,10 +73,11 @@ isa_ok($window, 'X11::XCB::Window'); $window->map; -wait_for_map $x; +wait_for_map $window; cmd 'floating enable'; +# XXX potentionally racy ($absolute, $top) = $window->rect; cmp_ok($absolute->{width}, '==', 80, "i3 let the width at 80"); diff --git a/testcases/t/100-fullscreen.t b/testcases/t/100-fullscreen.t index e014da48..f5fb6693 100644 --- a/testcases/t/100-fullscreen.t +++ b/testcases/t/100-fullscreen.t @@ -45,7 +45,7 @@ is_deeply($window->rect, $original_rect, "rect unmodified before mapping"); $window->map; -wait_for_map $x; +wait_for_map $window; # open another container to make the window get only half of the screen cmd 'open'; @@ -95,7 +95,7 @@ is_deeply($window->rect, $original_rect, "rect unmodified before mapping"); $window->fullscreen(1); $window->map; -wait_for_map $x; +wait_for_map $window; $new_rect = $window->rect; ok(!eq_deeply($new_rect, $original_rect), "Window got repositioned after fullscreen"); diff --git a/testcases/t/102-dock.t b/testcases/t/102-dock.t index 213052f5..f97fa21c 100644 --- a/testcases/t/102-dock.t +++ b/testcases/t/102-dock.t @@ -67,7 +67,7 @@ is($docknode->{rect}->{height}, 40, 'dock height changed'); $window->destroy; -wait_for_unmap $x; +wait_for_unmap $window; @docked = get_dock_clients(); is(@docked, 0, 'no more dock clients'); @@ -91,7 +91,7 @@ is(@docked, 1, 'dock client on bottom'); $window->destroy; -wait_for_unmap $x; +wait_for_unmap $window; @docked = get_dock_clients(); is(@docked, 0, 'no more dock clients'); @@ -125,14 +125,14 @@ $x->change_property( $window->map; -wait_for_map $x; +wait_for_map $window; @docked = get_dock_clients('top'); is(@docked, 1, 'dock client on top'); $window->destroy; -wait_for_unmap $x; +wait_for_unmap $window; @docked = get_dock_clients(); is(@docked, 0, 'no more dock clients'); @@ -162,7 +162,7 @@ $x->change_property( $window->map; -wait_for_map $x; +wait_for_map $window; @docked = get_dock_clients('bottom'); is(@docked, 1, 'dock client on bottom'); @@ -183,7 +183,7 @@ my $fwindow = open_window($x, { $fwindow->transient_for($window); $fwindow->map; -wait_for_map $x; +wait_for_map $fwindow; does_i3_live; diff --git a/testcases/t/104-focus-stack.t b/testcases/t/104-focus-stack.t index 8807d015..1128e16a 100644 --- a/testcases/t/104-focus-stack.t +++ b/testcases/t/104-focus-stack.t @@ -21,7 +21,7 @@ is($x->input_focus, $window->id, 'floating window focused'); $window->unmap; -wait_for_unmap($x); +wait_for_unmap $window; is($x->input_focus, $focus, 'Focus correctly restored'); diff --git a/testcases/t/114-client-leader.t b/testcases/t/114-client-leader.t index d2fd16a0..4d6ecc51 100644 --- a/testcases/t/114-client-leader.t +++ b/testcases/t/114-client-leader.t @@ -25,7 +25,7 @@ my $child = open_floating_window($x, { $child->client_leader($right); $child->map; -ok(wait_for_map($x), 'child window mapped'); +ok(wait_for_map($child), 'child window mapped'); my $cgeom; ($abs, $cgeom) = $child->rect; @@ -38,7 +38,7 @@ my $child2 = open_floating_window($x, { $child2->client_leader($left); $child2->map; -ok(wait_for_map($x), 'second child window mapped'); +ok(wait_for_map($child2), 'second child window mapped'); ($abs, $cgeom) = $child2->rect; cmp_ok(($cgeom->x + $cgeom->width), '<', $rgeom->x, 'child above left window'); @@ -48,7 +48,7 @@ my $fwindow = open_window($x, { dont_map => 1 }); $fwindow->transient_for($right); $fwindow->map; -ok(wait_for_map($x), 'transient window mapped'); +ok(wait_for_map($fwindow), 'transient window mapped'); my ($absolute, $top) = $fwindow->rect; ok($absolute->{x} != 0 && $absolute->{y} != 0, 'i3 did not map it to (0x0)'); @@ -63,7 +63,7 @@ SKIP: { my $window = open_window($x, { dont_map => 1, name => 'Parent window' }); $window->map; -ok(wait_for_map($x), 'parent window mapped'); +ok(wait_for_map($window), 'parent window mapped'); ######################################################################### # Switch to a different workspace and open a child window. It should be opened @@ -75,7 +75,7 @@ my $child = open_window($x, { dont_map => 1, name => 'Child window' }); $child->client_leader($window); $child->map; -ok(wait_for_map($x), 'child window mapped'); +ok(wait_for_map($child), 'child window mapped'); isnt($x->input_focus, $child->id, "Child window focused"); diff --git a/testcases/t/117-workspace.t b/testcases/t/117-workspace.t index a88c669c..3c52e31e 100644 --- a/testcases/t/117-workspace.t +++ b/testcases/t/117-workspace.t @@ -113,7 +113,7 @@ ok(defined($ws), "workspace 0: $tmp was created"); is($ws->{num}, 0, 'workspace number is 0'); cmd "workspace aa: $tmp"; -my $ws = get_ws("aa: $tmp"); +$ws = get_ws("aa: $tmp"); ok(defined($ws), "workspace aa: $tmp was created"); is($ws->{num}, -1, 'workspace number is -1'); diff --git a/testcases/t/119-match.t b/testcases/t/119-match.t index 80c94ab1..cad8163f 100644 --- a/testcases/t/119-match.t +++ b/testcases/t/119-match.t @@ -34,7 +34,7 @@ cmd 'nop now killing the window'; my $id = $win->{id}; cmd qq|[con_id="$id"] kill|; -wait_for_unmap $x; +wait_for_unmap $window; cmd 'nop checking if its gone'; $content = get_ws_content($tmp); @@ -80,7 +80,7 @@ $left->_create; set_wm_class($left->id, 'special', 'special'); $left->name('left'); $left->map; -ok(wait_for_map($x), 'left window mapped'); +ok(wait_for_map($left), 'left window mapped'); my $right = $x->root->create_child( class => WINDOW_CLASS_INPUT_OUTPUT, @@ -93,7 +93,7 @@ $right->_create; set_wm_class($right->id, 'special', 'special'); $right->name('right'); $right->map; -ok(wait_for_map($x), 'right window mapped'); +ok(wait_for_map($right), 'right window mapped'); # two windows should be here $content = get_ws_content($tmp); @@ -123,7 +123,7 @@ $left->_create; set_wm_class($left->id, 'special7', 'special7'); $left->name('left'); $left->map; -ok(wait_for_map($x), 'left window mapped'); +ok(wait_for_map($left), 'left window mapped'); # two windows should be here $content = get_ws_content($tmp); @@ -131,7 +131,7 @@ ok(@{$content} == 1, 'window opened'); cmd '[class="^special[0-9]$"] kill'; -wait_for_unmap $x; +wait_for_unmap $left; $content = get_ws_content($tmp); is(@{$content}, 0, 'window killed'); @@ -153,7 +153,7 @@ $left->_create; set_wm_class($left->id, 'special7', 'special7'); $left->name('ä 3'); $left->map; -ok(wait_for_map($x), 'left window mapped'); +ok(wait_for_map($left), 'left window mapped'); # two windows should be here $content = get_ws_content($tmp); @@ -161,7 +161,7 @@ ok(@{$content} == 1, 'window opened'); cmd '[title="^\w [3]$"] kill'; -wait_for_unmap $x; +wait_for_unmap $left; $content = get_ws_content($tmp); is(@{$content}, 0, 'window killed'); diff --git a/testcases/t/133-size-hints.t b/testcases/t/133-size-hints.t index 90ecf62e..cad6bb71 100644 --- a/testcases/t/133-size-hints.t +++ b/testcases/t/133-size-hints.t @@ -19,7 +19,7 @@ $aspect->max_num(600); $aspect->max_den(300); $win->_create; $win->map; -wait_for_map $x; +wait_for_map $win; $win->hints->aspect($aspect); $x->flush; diff --git a/testcases/t/135-floating-focus.t b/testcases/t/135-floating-focus.t index bae983e7..d5b70008 100644 --- a/testcases/t/135-floating-focus.t +++ b/testcases/t/135-floating-focus.t @@ -45,7 +45,7 @@ cmd 'floating enable'; # now kill the third one (it's floating). focus should stay unchanged cmd '[id="' . $third->id . '"] kill'; -wait_for_unmap($x); +wait_for_unmap($third); is($x->input_focus, $second->id, 'second con still focused after killing third'); @@ -76,12 +76,12 @@ cmd 'floating enable'; # now kill the second one. focus should fall back to the third one, which is # also floating cmd 'kill'; -wait_for_unmap($x); +wait_for_unmap($second); is($x->input_focus, $third->id, 'third con focused'); cmd 'kill'; -wait_for_unmap($x); +wait_for_unmap($third); is($x->input_focus, $first->id, 'first con focused after killing all floating cons'); @@ -114,12 +114,12 @@ sync_with_i3($x); # now kill the second one. focus should fall back to the third one, which is # also floating cmd 'kill'; -wait_for_unmap($x); +wait_for_unmap($second); is($x->input_focus, $third->id, 'third con focused'); cmd 'kill'; -wait_for_unmap($x); +wait_for_unmap($third); is($x->input_focus, $first->id, 'first con focused after killing all floating cons'); diff --git a/testcases/t/150-regress-dock-restart.t b/testcases/t/150-regress-dock-restart.t index a28e0730..5317eef3 100644 --- a/testcases/t/150-regress-dock-restart.t +++ b/testcases/t/150-regress-dock-restart.t @@ -55,7 +55,7 @@ is($docknode->{rect}->{height}, 30, 'dock node has unchanged height after restar $window->destroy; -wait_for_unmap $x; +wait_for_unmap $window; @docked = get_dock_clients; is(@docked, 0, 'no dock clients found'); diff --git a/testcases/t/163-wm-state.t b/testcases/t/163-wm-state.t index e5b42df4..f3e7e2d1 100644 --- a/testcases/t/163-wm-state.t +++ b/testcases/t/163-wm-state.t @@ -15,7 +15,7 @@ is($window->state, ICCCM_WM_STATE_NORMAL, 'WM_STATE normal'); $window->unmap; -wait_for_unmap $x; +wait_for_unmap $window; is($window->state, ICCCM_WM_STATE_WITHDRAWN, 'WM_STATE withdrawn'); diff --git a/testcases/t/165-for_window.t b/testcases/t/165-for_window.t index 88c542eb..80649771 100644 --- a/testcases/t/165-for_window.t +++ b/testcases/t/165-for_window.t @@ -34,14 +34,14 @@ my $window = $x->root->create_child( $window->name('Border window'); $window->map; -wait_for_map $x; +wait_for_map $window; my @content = @{get_ws_content($tmp)}; cmp_ok(@content, '==', 1, 'one node on this workspace now'); is($content[0]->{border}, 'normal', 'normal border'); $window->unmap; -wait_for_unmap $x; +wait_for_unmap $window; @content = @{get_ws_content($tmp)}; cmp_ok(@content, '==', 0, 'no more nodes'); @@ -78,14 +78,14 @@ sub set_wm_class { set_wm_class($window->id, 'borderless', 'borderless'); $window->name('Borderless window'); $window->map; -wait_for_map $x; +wait_for_map $window; @content = @{get_ws_content($tmp)}; cmp_ok(@content, '==', 1, 'one node on this workspace now'); is($content[0]->{border}, 'none', 'no border'); $window->unmap; -wait_for_unmap $x; +wait_for_unmap $window; @content = @{get_ws_content($tmp)}; cmp_ok(@content, '==', 0, 'no more nodes'); @@ -117,7 +117,7 @@ $window = $x->root->create_child( $window->name('special title'); $window->map; -wait_for_map $x; +wait_for_map $window; @content = @{get_ws_content($tmp)}; cmp_ok(@content, '==', 1, 'one node on this workspace now'); @@ -144,7 +144,7 @@ sync_with_i3 $x; is($content[0]->{border}, 'normal', 'still normal border'); $window->unmap; -wait_for_unmap $x; +wait_for_unmap $window; @content = @{get_ws_content($tmp)}; cmp_ok(@content, '==', 0, 'no more nodes'); @@ -177,7 +177,7 @@ $window = $x->root->create_child( $window->name('special mark title'); $window->map; -wait_for_map $x; +wait_for_map $window; @content = @{get_ws_content($tmp)}; cmp_ok(@content, '==', 1, 'one node on this workspace now'); @@ -224,14 +224,14 @@ $window->_create; set_wm_class($window->id, 'borderless', 'borderless'); $window->name('usethis'); $window->map; -wait_for_map $x; +wait_for_map $window; @content = @{get_ws_content($tmp)}; cmp_ok(@content, '==', 1, 'one node on this workspace now'); is($content[0]->{border}, 'none', 'no border'); cmd 'kill'; -wait_for_unmap $x; +wait_for_unmap $window; $window->destroy; # give i3 a chance to delete the window from its tree @@ -245,7 +245,7 @@ $window->_create; set_wm_class($window->id, 'borderless', 'borderless'); $window->name('notthis'); $window->map; -wait_for_map $x; +wait_for_map $window; @content = @{get_ws_content($tmp)}; cmp_ok(@content, '==', 1, 'one node on this workspace now'); @@ -280,7 +280,7 @@ $window->_create; set_wm_class($window->id, 'bar', 'foo'); $window->name('usethis'); $window->map; -wait_for_map $x; +wait_for_map $window; @content = @{get_ws_content($tmp)}; cmp_ok(@content, '==', 1, 'one node on this workspace now'); @@ -315,7 +315,7 @@ $window->_create; set_wm_class($window->id, 'bar', 'foo'); $window->name('usethis'); $window->map; -wait_for_map $x; +wait_for_map $window; @content = @{get_ws_content($tmp)}; cmp_ok(@content, '==', 1, 'one node on this workspace now'); @@ -352,7 +352,7 @@ $window->_create; set_wm_class($window->id, 'bar', 'foo'); $window->name('usethis'); $window->map; -wait_for_map $x; +wait_for_map $window; @content = @{get_ws_content($tmp)}; cmp_ok(@content, '==', 1, 'one node on this workspace now'); @@ -400,7 +400,7 @@ $x->change_property( $window->name('usethis'); $window->map; -wait_for_map $x; +wait_for_map $window; @content = @{get_ws_content($tmp)}; cmp_ok(@content, '==', 1, 'one node on this workspace now'); @@ -437,7 +437,7 @@ $window->_create; $window->name('usethis'); $window->map; -wait_for_map $x; +wait_for_map $window; @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 d2bb9fa7..f42962f3 100644 --- a/testcases/t/166-assign.t +++ b/testcases/t/166-assign.t @@ -53,7 +53,7 @@ $window->_create; set_wm_class($window->id, 'special', 'special'); $window->name('special window'); $window->map; -wait_for_map $x; +wait_for_map $window; ok(@{get_ws_content($tmp)} == 1, 'special window got managed to current (random) workspace'); @@ -91,7 +91,7 @@ $window->_create; set_wm_class($window->id, 'special', 'special'); $window->name('special window'); $window->map; -wait_for_map $x; +wait_for_map $window; ok(@{get_ws_content($tmp)} == 0, 'still no containers'); ok("targetws" ~~ @{get_workspace_names()}, 'targetws exists'); @@ -172,7 +172,7 @@ $window->_create; set_wm_class($window->id, 'special', 'special'); $window->name('special window'); $window->map; -wait_for_map $x; +wait_for_map $window; my $content = get_ws($tmp); ok(@{$content->{nodes}} == 0, 'no tiling cons'); @@ -213,7 +213,7 @@ $window->_create; set_wm_class($window->id, 'SPEcial', 'SPEcial'); $window->name('special window'); $window->map; -wait_for_map $x; +wait_for_map $window; $content = get_ws($tmp); ok(@{$content->{nodes}} == 0, 'no tiling cons'); @@ -263,7 +263,7 @@ $window->_create; set_wm_class($window->id, 'special', 'special'); $window->name('special window'); $window->map; -wait_for_map $x; +wait_for_map $window; $content = get_ws($tmp); ok(@{$content->{nodes}} == 0, 'no tiling cons'); From e9acd36ce438624751e14b56fee5bd79318cbad0 Mon Sep 17 00:00:00 2001 From: Maik Fischer Date: Tue, 22 Nov 2011 00:42:26 +0100 Subject: [PATCH 09/10] t/005-floating.t: fix potentional race condition --- testcases/t/005-floating.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testcases/t/005-floating.t b/testcases/t/005-floating.t index d62a0366..ac6623f2 100644 --- a/testcases/t/005-floating.t +++ b/testcases/t/005-floating.t @@ -76,8 +76,8 @@ $window->map; wait_for_map $window; cmd 'floating enable'; +sync_with_i3($x); -# XXX potentionally racy ($absolute, $top) = $window->rect; cmp_ok($absolute->{width}, '==', 80, "i3 let the width at 80"); From fce7570f961bcb373e1ac0965bb3ed41747e0d3b Mon Sep 17 00:00:00 2001 From: Maik Fischer Date: Tue, 22 Nov 2011 00:47:32 +0100 Subject: [PATCH 10/10] testcases: drop open_window()s $x parameter, use global one instead --- testcases/lib/i3test.pm | 4 +-- testcases/t/003-ipc.t | 2 +- testcases/t/101-focus.t | 6 ++--- testcases/t/102-dock.t | 10 +++---- testcases/t/104-focus-stack.t | 4 +-- testcases/t/111-goto.t | 6 ++--- testcases/t/113-urgent.t | 4 +-- testcases/t/114-client-leader.t | 10 +++---- testcases/t/119-match.t | 2 +- testcases/t/129-focus-after-close.t | 2 +- testcases/t/133-size-hints.t | 2 +- testcases/t/135-floating-focus.t | 26 +++++++++---------- testcases/t/138-floating-attach.t | 8 +++--- testcases/t/139-ws-numbers.t | 12 ++++----- testcases/t/140-focus-lost.t | 6 ++--- testcases/t/141-resize.t | 10 +++---- testcases/t/145-flattening.t | 6 ++--- testcases/t/146-floating-reinsert.t | 6 ++--- testcases/t/147-regress-floatingmove.t | 6 ++--- testcases/t/148-regress-floatingmovews.t | 4 +-- testcases/t/150-regress-dock-restart.t | 4 +-- testcases/t/153-floating-originalsize.t | 2 +- testcases/t/154-regress-multiple-dock.t | 4 +-- testcases/t/155-floating-split-size.t | 4 +-- testcases/t/156-fullscreen-focus.t | 6 ++--- testcases/t/157-regress-fullscreen-level-up.t | 2 +- testcases/t/158-wm_take_focus.t | 4 +-- testcases/t/161-regress-borders-restart.t | 2 +- testcases/t/163-wm-state.t | 2 +- testcases/t/164-kill-win-vs-client.t | 4 +-- testcases/t/165-for_window.t | 2 +- testcases/t/167-workspace_layout.t | 12 ++++----- testcases/t/168-regress-fullscreen-restart.t | 4 +-- testcases/t/170-force_focus_wrapping.t | 12 ++++----- testcases/t/174-border-config.t | 4 +-- testcases/t/175-startup-notification.t | 8 +++--- 36 files changed, 106 insertions(+), 106 deletions(-) diff --git a/testcases/lib/i3test.pm b/testcases/lib/i3test.pm index c94101e1..1ddaa52b 100644 --- a/testcases/lib/i3test.pm +++ b/testcases/lib/i3test.pm @@ -156,7 +156,7 @@ sub wait_for_unmap { # name => 'Window ' # sub open_window { - my ($x, $args) = @_; + my ($args) = @_; my %args = ($args ? %$args : ()); my $dont_map = delete $args{dont_map}; @@ -186,7 +186,7 @@ sub open_floating_window { $args{window_type} = $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY'); - return open_window($x, \%args); + return open_window(\%args); } sub open_empty_con { diff --git a/testcases/t/003-ipc.t b/testcases/t/003-ipc.t index 296375ab..477b7163 100644 --- a/testcases/t/003-ipc.t +++ b/testcases/t/003-ipc.t @@ -10,7 +10,7 @@ fresh_workspace; ##################################################################### # Create a window so we can get a focus different from NULL -my $window = open_window($x); +my $window = open_window; my $focus = $x->input_focus; diff --git a/testcases/t/101-focus.t b/testcases/t/101-focus.t index 070d1385..545b9dd0 100644 --- a/testcases/t/101-focus.t +++ b/testcases/t/101-focus.t @@ -13,9 +13,9 @@ my $tmp = fresh_workspace; cmd 'layout default'; cmd 'split v'; -my $top = open_window($x); -my $mid = open_window($x); -my $bottom = open_window($x); +my $top = open_window; +my $mid = open_window; +my $bottom = open_window; # # Returns the input focus after sending the given command to i3 via IPC diff --git a/testcases/t/102-dock.t b/testcases/t/102-dock.t index f97fa21c..ce33f052 100644 --- a/testcases/t/102-dock.t +++ b/testcases/t/102-dock.t @@ -23,7 +23,7 @@ my $screens = $x->screens; my $primary = first { $_->primary } @{$screens}; # TODO: focus the primary screen before -my $window = open_window($x, { +my $window = open_window({ window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'), }); @@ -76,7 +76,7 @@ is(@docked, 0, 'no more dock clients'); # check if it gets placed on bottom (by coordinates) ##################################################################### -$window = open_window($x, { +$window = open_window({ rect => [ 0, 1000, 30, 30 ], background_color => '#FF0000', window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'), @@ -100,7 +100,7 @@ is(@docked, 0, 'no more dock clients'); # check if it gets placed on bottom (by hint) ##################################################################### -$window = open_window($x, { +$window = open_window({ dont_map => 1, rect => [ 0, 1000, 30, 30 ], background_color => '#FF0000', @@ -137,7 +137,7 @@ wait_for_unmap $window; @docked = get_dock_clients(); is(@docked, 0, 'no more dock clients'); -$window = open_window($x, { +$window = open_window({ dont_map => 1, rect => [ 0, 1000, 30, 30 ], background_color => '#FF0000', @@ -174,7 +174,7 @@ $window->destroy; # regression test: transient dock client ##################################################################### -my $fwindow = open_window($x, { +my $fwindow = open_window({ dont_map => 1, background_color => '#FF0000', window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'), diff --git a/testcases/t/104-focus-stack.t b/testcases/t/104-focus-stack.t index 1128e16a..f72cd75f 100644 --- a/testcases/t/104-focus-stack.t +++ b/testcases/t/104-focus-stack.t @@ -8,8 +8,8 @@ use i3test; fresh_workspace; cmd 'split h'; -my $tiled_left = open_window($x); -my $tiled_right = open_window($x); +my $tiled_left = open_window; +my $tiled_right = open_window; # Get input focus before creating the floating window my $focus = $x->input_focus; diff --git a/testcases/t/111-goto.t b/testcases/t/111-goto.t index 0da9e8e0..5f4d7762 100644 --- a/testcases/t/111-goto.t +++ b/testcases/t/111-goto.t @@ -12,9 +12,9 @@ cmd 'split h'; # Create two windows and make sure focus switching works ##################################################################### -my $top = open_window($x); -my $mid = open_window($x); -my $bottom = open_window($x); +my $top = open_window; +my $mid = open_window; +my $bottom = open_window; # # Returns the input focus after sending the given command to i3 via IPC diff --git a/testcases/t/113-urgent.t b/testcases/t/113-urgent.t index 2b78b882..fcfd11e7 100644 --- a/testcases/t/113-urgent.t +++ b/testcases/t/113-urgent.t @@ -12,8 +12,8 @@ my $tmp = fresh_workspace; cmd 'split v'; -my $top = open_window($x); -my $bottom = open_window($x); +my $top = open_window; +my $bottom = open_window; my @urgent = grep { $_->{urgent} } @{get_ws_content($tmp)}; is(@urgent, 0, 'no window got the urgent flag'); diff --git a/testcases/t/114-client-leader.t b/testcases/t/114-client-leader.t index 4d6ecc51..3b0bddc0 100644 --- a/testcases/t/114-client-leader.t +++ b/testcases/t/114-client-leader.t @@ -13,8 +13,8 @@ my $tmp = fresh_workspace; # one of both (depending on your screen resolution) will be positioned wrong. #################################################################################### -my $left = open_window($x, { name => 'Left' }); -my $right = open_window($x, { name => 'Right' }); +my $left = open_window({ name => 'Left' }); +my $right = open_window({ name => 'Right' }); my ($abs, $rgeom) = $right->rect; @@ -44,7 +44,7 @@ ok(wait_for_map($child2), 'second child window mapped'); cmp_ok(($cgeom->x + $cgeom->width), '<', $rgeom->x, 'child above left window'); # check wm_transient_for -my $fwindow = open_window($x, { dont_map => 1 }); +my $fwindow = open_window({ dont_map => 1 }); $fwindow->transient_for($right); $fwindow->map; @@ -60,7 +60,7 @@ SKIP: { # Create a parent window ##################################################################### -my $window = open_window($x, { dont_map => 1, name => 'Parent window' }); +my $window = open_window({ dont_map => 1, name => 'Parent window' }); $window->map; ok(wait_for_map($window), 'parent window mapped'); @@ -71,7 +71,7 @@ ok(wait_for_map($window), 'parent window mapped'); ######################################################################### fresh_workspace; -my $child = open_window($x, { dont_map => 1, name => 'Child window' }); +my $child = open_window({ dont_map => 1, name => 'Child window' }); $child->client_leader($window); $child->map; diff --git a/testcases/t/119-match.t b/testcases/t/119-match.t index cad8163f..e2e553f4 100644 --- a/testcases/t/119-match.t +++ b/testcases/t/119-match.t @@ -11,7 +11,7 @@ my $tmp = fresh_workspace; ok(@{get_ws_content($tmp)} == 0, 'no containers yet'); # Open a new window -my $window = open_window($x); +my $window = open_window; my $content = get_ws_content($tmp); ok(@{$content} == 1, 'window mapped'); my $win = $content->[0]; diff --git a/testcases/t/129-focus-after-close.t b/testcases/t/129-focus-after-close.t index 1bb2eedc..3913f4c6 100644 --- a/testcases/t/129-focus-after-close.t +++ b/testcases/t/129-focus-after-close.t @@ -99,7 +99,7 @@ $first = open_empty_con($i3); $middle = open_empty_con($i3); # XXX: the $right empty con will be filled with the x11 window we are creating afterwards $right = open_empty_con($i3); -my $win = open_window($x, { background_color => '#00ff00' }); +my $win = open_window({ background_color => '#00ff00' }); cmd qq|[con_id="$middle"] focus|; $win->destroy; diff --git a/testcases/t/133-size-hints.t b/testcases/t/133-size-hints.t index cad6bb71..34b5e4a5 100644 --- a/testcases/t/133-size-hints.t +++ b/testcases/t/133-size-hints.t @@ -9,7 +9,7 @@ my $tmp = fresh_workspace; ok(@{get_ws_content($tmp)} == 0, 'no containers yet'); -my $win = open_window($x, { dont_map => 1 }); +my $win = open_window({ dont_map => 1 }); # XXX: we should check screen size. in screens with an AR of 2.0, # this is not a good idea. my $aspect = X11::XCB::Sizehints::Aspect->new; diff --git a/testcases/t/135-floating-focus.t b/testcases/t/135-floating-focus.t index d5b70008..37d141b1 100644 --- a/testcases/t/135-floating-focus.t +++ b/testcases/t/135-floating-focus.t @@ -9,8 +9,8 @@ my $tmp = fresh_workspace; # 1: see if focus stays the same when toggling tiling/floating mode ############################################################################# -my $first = open_window($x); -my $second = open_window($x); +my $first = open_window; +my $second = open_window; is($x->input_focus, $second->id, 'second window focused'); @@ -26,9 +26,9 @@ is($x->input_focus, $second->id, 'second window still focused after mode toggle' $tmp = fresh_workspace; -$first = open_window($x); # window 2 -$second = open_window($x); # window 3 -my $third = open_window($x); # window 4 +$first = open_window; # window 2 +$second = open_window; # window 3 +my $third = open_window; # window 4 is($x->input_focus, $third->id, 'last container focused'); @@ -57,9 +57,9 @@ is($x->input_focus, $second->id, 'second con still focused after killing third') $tmp = fresh_workspace; -$first = open_window($x, { background_color => '#ff0000' }); # window 5 -$second = open_window($x, { background_color => '#00ff00' }); # window 6 -$third = open_window($x, { background_color => '#0000ff' }); # window 7 +$first = open_window({ background_color => '#ff0000' }); # window 5 +$second = open_window({ background_color => '#00ff00' }); # window 6 +$third = open_window({ background_color => '#0000ff' }); # window 7 is($x->input_focus, $third->id, 'last container focused'); @@ -91,11 +91,11 @@ is($x->input_focus, $first->id, 'first con focused after killing all floating co $tmp = fresh_workspace; -$first = open_window($x, { background_color => '#ff0000' }); # window 5 +$first = open_window({ background_color => '#ff0000' }); # window 5 cmd 'split v'; cmd 'layout stacked'; -$second = open_window($x, { background_color => '#00ff00' }); # window 6 -$third = open_window($x, { background_color => '#0000ff' }); # window 7 +$second = open_window({ background_color => '#00ff00' }); # window 6 +$third = open_window({ background_color => '#0000ff' }); # window 7 is($x->input_focus, $third->id, 'last container focused'); @@ -129,8 +129,8 @@ is($x->input_focus, $first->id, 'first con focused after killing all floating co $tmp = fresh_workspace; -$first = open_window($x, { background_color => '#ff0000' }); # window 8 -$second = open_window($x, { background_color => '#00ff00' }); # window 9 +$first = open_window({ background_color => '#ff0000' }); # window 8 +$second = open_window({ background_color => '#00ff00' }); # window 9 sync_with_i3($x); diff --git a/testcases/t/138-floating-attach.t b/testcases/t/138-floating-attach.t index 9a7996b1..71f10ef5 100644 --- a/testcases/t/138-floating-attach.t +++ b/testcases/t/138-floating-attach.t @@ -24,7 +24,7 @@ is(@{$ws->{floating_nodes}}, 1, 'one floating node'); is(@{$nodes}, 0, 'no tiling nodes'); # Create a tiling window -my $twindow = open_window($x); +my $twindow = open_window; ($nodes, $focus) = get_ws_content($tmp); @@ -37,8 +37,8 @@ is(@{$nodes}, 1, 'one tiling node'); $tmp = fresh_workspace; -my $first = open_window($x); -my $second = open_window($x); +my $first = open_window; +my $second = open_window; cmd 'layout stacked'; @@ -54,7 +54,7 @@ $ws = get_ws($tmp); is(@{$ws->{floating_nodes}}, 1, 'one floating nodes'); is(@{$ws->{nodes}}, 1, 'one tiling node (stacked con)'); -my $third = open_window($x); +my $third = open_window; $ws = get_ws($tmp); diff --git a/testcases/t/139-ws-numbers.t b/testcases/t/139-ws-numbers.t index 9d73ad1c..aac1debf 100644 --- a/testcases/t/139-ws-numbers.t +++ b/testcases/t/139-ws-numbers.t @@ -24,7 +24,7 @@ check_order('workspace order alright before testing'); cmd "workspace 93"; -open_window($x); +open_window; my @ws = @{$i3->get_workspaces->recv}; my @f = grep { defined($_->{num}) && $_->{num} == 93 } @ws; @@ -32,23 +32,23 @@ is(@f, 1, 'ws 93 found by num'); check_order('workspace order alright after opening 93'); cmd "workspace 92"; -open_window($x); +open_window; check_order('workspace order alright after opening 92'); cmd "workspace 94"; -open_window($x); +open_window; check_order('workspace order alright after opening 94'); cmd "workspace 96"; -open_window($x); +open_window; check_order('workspace order alright after opening 96'); cmd "workspace foo"; -open_window($x); +open_window; check_order('workspace order alright after opening foo'); cmd "workspace 91"; -open_window($x); +open_window; check_order('workspace order alright after opening 91'); done_testing; diff --git a/testcases/t/140-focus-lost.t b/testcases/t/140-focus-lost.t index cd6eee38..042afcfe 100644 --- a/testcases/t/140-focus-lost.t +++ b/testcases/t/140-focus-lost.t @@ -18,9 +18,9 @@ sub check_order { my $tmp = fresh_workspace; -my $left = open_window($x); -my $mid = open_window($x); -my $right = open_window($x); +my $left = open_window; +my $mid = open_window; +my $right = open_window; sync_with_i3($x); diff --git a/testcases/t/141-resize.t b/testcases/t/141-resize.t index 18e28ccb..b2c7d0f3 100644 --- a/testcases/t/141-resize.t +++ b/testcases/t/141-resize.t @@ -7,8 +7,8 @@ my $tmp = fresh_workspace; cmd 'split v'; -my $top = open_window($x); -my $bottom = open_window($x); +my $top = open_window; +my $bottom = open_window; sync_with_i3($x); @@ -47,8 +47,8 @@ $tmp = fresh_workspace; cmd 'split v'; -$top = open_window($x); -$bottom = open_window($x); +$top = open_window; +$bottom = open_window; cmd 'split h'; cmd 'layout stacked'; @@ -69,7 +69,7 @@ is($nodes->[1]->{percent}, 0.75, 'bottom window got 75%'); $tmp = fresh_workspace; -$top = open_window($x); +$top = open_window; cmd 'floating enable'; diff --git a/testcases/t/145-flattening.t b/testcases/t/145-flattening.t index 8baf9217..9d22afc3 100644 --- a/testcases/t/145-flattening.t +++ b/testcases/t/145-flattening.t @@ -14,9 +14,9 @@ use i3test; my $tmp = fresh_workspace; -my $left = open_window($x); -my $mid = open_window($x); -my $right = open_window($x); +my $left = open_window; +my $mid = open_window; +my $right = open_window; cmd 'move up'; cmd 'move right'; diff --git a/testcases/t/146-floating-reinsert.t b/testcases/t/146-floating-reinsert.t index 1015f8f8..c3a4512a 100644 --- a/testcases/t/146-floating-reinsert.t +++ b/testcases/t/146-floating-reinsert.t @@ -5,11 +5,11 @@ use i3test; my $tmp = fresh_workspace; -my $left = open_window($x); -my $mid = open_window($x); +my $left = open_window; +my $mid = open_window; cmd 'split v'; -my $bottom = open_window($x); +my $bottom = open_window; my ($nodes, $focus) = get_ws_content($tmp); diff --git a/testcases/t/147-regress-floatingmove.t b/testcases/t/147-regress-floatingmove.t index 74adef69..ed85b57b 100644 --- a/testcases/t/147-regress-floatingmove.t +++ b/testcases/t/147-regress-floatingmove.t @@ -8,9 +8,9 @@ use i3test; my $tmp = fresh_workspace; -my $left = open_window($x); -my $mid = open_window($x); -my $right = open_window($x); +my $left = open_window; +my $mid = open_window; +my $right = open_window; # go to workspace level cmd 'level up'; diff --git a/testcases/t/148-regress-floatingmovews.t b/testcases/t/148-regress-floatingmovews.t index 0e6345b2..44d5a445 100644 --- a/testcases/t/148-regress-floatingmovews.t +++ b/testcases/t/148-regress-floatingmovews.t @@ -9,13 +9,13 @@ use i3test; my $tmp = fresh_workspace; # open a tiling window on the first workspace -open_window($x); +open_window; #sleep 0.25; my $first = get_focused($tmp); # on a different ws, open a floating window my $otmp = fresh_workspace; -open_window($x); +open_window; #sleep 0.25; my $float = get_focused($otmp); cmd 'mode toggle'; diff --git a/testcases/t/150-regress-dock-restart.t b/testcases/t/150-regress-dock-restart.t index 5317eef3..7e5a5520 100644 --- a/testcases/t/150-regress-dock-restart.t +++ b/testcases/t/150-regress-dock-restart.t @@ -18,7 +18,7 @@ is(@docked, 0, 'no dock clients yet'); # open a dock client -my $window = open_window($x, { +my $window = open_window({ background_color => '#FF0000', window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'), }); @@ -64,7 +64,7 @@ is(@docked, 0, 'no dock clients found'); # create a dock client with a 1px border ##################################################################### -$window = open_window($x, { +$window = open_window({ border => 1, rect => [ 0, 0, 30, 20 ], background_color => '#00FF00', diff --git a/testcases/t/153-floating-originalsize.t b/testcases/t/153-floating-originalsize.t index 2c798cfa..dcd1144e 100644 --- a/testcases/t/153-floating-originalsize.t +++ b/testcases/t/153-floating-originalsize.t @@ -8,7 +8,7 @@ use i3test; my $tmp = fresh_workspace; # Create a floating window which is smaller than the minimum enforced size of i3 -my $window = open_window($x, { rect => [ 0, 0, 400, 150 ] }); +my $window = open_window({ rect => [ 0, 0, 400, 150 ] }); my ($absolute, $top) = $window->rect; diff --git a/testcases/t/154-regress-multiple-dock.t b/testcases/t/154-regress-multiple-dock.t index 52ab4004..76577fb3 100644 --- a/testcases/t/154-regress-multiple-dock.t +++ b/testcases/t/154-regress-multiple-dock.t @@ -20,7 +20,7 @@ is(@docked, 0, 'no dock clients yet'); # open a dock client ##################################################################### -my $first = open_window($x, { +my $first = open_window({ background_color => '#FF0000', window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'), }); @@ -29,7 +29,7 @@ my $first = open_window($x, { # Open a second dock client ##################################################################### -my $second = open_window($x, { +my $second = open_window({ background_color => '#FF0000', window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'), }); diff --git a/testcases/t/155-floating-split-size.t b/testcases/t/155-floating-split-size.t index 618266b6..76c31af6 100644 --- a/testcases/t/155-floating-split-size.t +++ b/testcases/t/155-floating-split-size.t @@ -12,7 +12,7 @@ my $tmp = fresh_workspace; # open a window with 200x80 ##################################################################### -my $first = open_window($x, { +my $first = open_window({ rect => [ 0, 0, 200, 80], background_color => '#FF0000', }); @@ -21,7 +21,7 @@ my $first = open_window($x, { # Open a second window with 300x90 ##################################################################### -my $second = open_window($x, { +my $second = open_window({ rect => [ 0, 0, 300, 90], background_color => '#00FF00', }); diff --git a/testcases/t/156-fullscreen-focus.t b/testcases/t/156-fullscreen-focus.t index e188b375..78323990 100644 --- a/testcases/t/156-fullscreen-focus.t +++ b/testcases/t/156-fullscreen-focus.t @@ -14,7 +14,7 @@ my $tmp = fresh_workspace; # open the left window ##################################################################### -my $left = open_window($x, { background_color => '#ff0000' }); +my $left = open_window({ background_color => '#ff0000' }); is($x->input_focus, $left->id, 'left window focused'); @@ -24,7 +24,7 @@ diag("left = " . $left->id); # Open the right window ##################################################################### -my $right = open_window($x, { background_color => '#00ff00' }); +my $right = open_window({ background_color => '#00ff00' }); diag("right = " . $right->id); @@ -38,7 +38,7 @@ cmd 'fullscreen'; # Open a third window ##################################################################### -my $third = open_window($x, { +my $third = open_window({ background_color => '#0000ff', name => 'Third window', dont_map => 1, diff --git a/testcases/t/157-regress-fullscreen-level-up.t b/testcases/t/157-regress-fullscreen-level-up.t index 2c9c4b17..a861117c 100644 --- a/testcases/t/157-regress-fullscreen-level-up.t +++ b/testcases/t/157-regress-fullscreen-level-up.t @@ -11,7 +11,7 @@ my $tmp = fresh_workspace; # open a window, verify it’s not in fullscreen mode ##################################################################### -my $win = open_window($x); +my $win = open_window; my $nodes = get_ws_content $tmp; is(@$nodes, 1, 'exactly one client'); diff --git a/testcases/t/158-wm_take_focus.t b/testcases/t/158-wm_take_focus.t index 0580b9c9..94476bbd 100644 --- a/testcases/t/158-wm_take_focus.t +++ b/testcases/t/158-wm_take_focus.t @@ -8,7 +8,7 @@ use i3test; subtest 'Window without WM_TAKE_FOCUS', sub { fresh_workspace; - my $window = open_window($x); + my $window = open_window; ok(!wait_for_event(1, sub { $_[0]->{response_type} == 161 }), 'did not receive ClientMessage'); @@ -20,7 +20,7 @@ subtest 'Window with WM_TAKE_FOCUS', sub { my $take_focus = $x->atom(name => 'WM_TAKE_FOCUS'); - my $window = open_window($x, { + my $window = open_window({ dont_map => 1, protocols => [ $take_focus ], }); diff --git a/testcases/t/161-regress-borders-restart.t b/testcases/t/161-regress-borders-restart.t index ce53b002..6e1f64f0 100644 --- a/testcases/t/161-regress-borders-restart.t +++ b/testcases/t/161-regress-borders-restart.t @@ -10,7 +10,7 @@ use i3test; my $i3 = i3(get_socket_path()); my $tmp = fresh_workspace; -my $window = open_window($x); +my $window = open_window; sub get_border_style { my @content = @{get_ws_content($tmp)}; diff --git a/testcases/t/163-wm-state.t b/testcases/t/163-wm-state.t index f3e7e2d1..468499d5 100644 --- a/testcases/t/163-wm-state.t +++ b/testcases/t/163-wm-state.t @@ -7,7 +7,7 @@ use i3test; use X11::XCB qw(ICCCM_WM_STATE_NORMAL ICCCM_WM_STATE_WITHDRAWN); -my $window = open_window($x); +my $window = open_window; sync_with_i3($x); diff --git a/testcases/t/164-kill-win-vs-client.t b/testcases/t/164-kill-win-vs-client.t index df9b7fd8..20dd50ca 100644 --- a/testcases/t/164-kill-win-vs-client.t +++ b/testcases/t/164-kill-win-vs-client.t @@ -11,8 +11,8 @@ sub two_windows { ok(@{get_ws_content($tmp)} == 0, 'no containers yet'); - my $first = open_window($x); - my $second = open_window($x); + my $first = open_window; + my $second = open_window; sync_with_i3 $x; diff --git a/testcases/t/165-for_window.t b/testcases/t/165-for_window.t index 80649771..281f840f 100644 --- a/testcases/t/165-for_window.t +++ b/testcases/t/165-for_window.t @@ -183,7 +183,7 @@ wait_for_map $window; cmp_ok(@content, '==', 1, 'one node on this workspace now'); is($content[0]->{border}, 'none', 'no border'); -my $other = open_window($x); +my $other = open_window; @content = @{get_ws_content($tmp)}; cmp_ok(@content, '==', 2, 'two nodes'); diff --git a/testcases/t/167-workspace_layout.t b/testcases/t/167-workspace_layout.t index 2744c9ba..d5a02ca6 100644 --- a/testcases/t/167-workspace_layout.t +++ b/testcases/t/167-workspace_layout.t @@ -23,8 +23,8 @@ my $tmp = fresh_workspace; ok(@{get_ws_content($tmp)} == 0, 'no containers yet'); -my $first = open_window($x); -my $second = open_window($x); +my $first = open_window; +my $second = open_window; sync_with_i3($x); @@ -53,8 +53,8 @@ $tmp = fresh_workspace; ok(@{get_ws_content($tmp)} == 0, 'no containers yet'); -$first = open_window($x); -$second = open_window($x); +$first = open_window; +$second = open_window; sync_with_i3($x); @@ -69,8 +69,8 @@ is($content[0]->{layout}, 'stacked', 'layout stacked'); ##################################################################### cmd 'focus parent'; -my $right_top = open_window($x); -my $right_bot = open_window($x); +my $right_top = open_window; +my $right_bot = open_window; @content = @{get_ws_content($tmp)}; is(@content, 2, 'two cons at workspace level after focus parent'); diff --git a/testcases/t/168-regress-fullscreen-restart.t b/testcases/t/168-regress-fullscreen-restart.t index 70bddd8e..74d284db 100644 --- a/testcases/t/168-regress-fullscreen-restart.t +++ b/testcases/t/168-regress-fullscreen-restart.t @@ -7,8 +7,8 @@ use i3test; fresh_workspace; -open_window($x); -open_window($x); +open_window; +open_window; cmd 'layout stacking'; sleep 1; diff --git a/testcases/t/170-force_focus_wrapping.t b/testcases/t/170-force_focus_wrapping.t index b8920c2d..bf66c44e 100644 --- a/testcases/t/170-force_focus_wrapping.t +++ b/testcases/t/170-force_focus_wrapping.t @@ -21,13 +21,13 @@ my $tmp = fresh_workspace; ok(@{get_ws_content($tmp)} == 0, 'no containers yet'); -my $first = open_window($x); -my $second = open_window($x); +my $first = open_window; +my $second = open_window; cmd 'layout tabbed'; cmd 'focus parent'; -my $third = open_window($x); +my $third = open_window; is($x->input_focus, $third->id, 'third window focused'); cmd 'focus left'; @@ -62,13 +62,13 @@ $tmp = fresh_workspace; ok(@{get_ws_content($tmp)} == 0, 'no containers yet'); -$first = open_window($x); -$second = open_window($x); +$first = open_window; +$second = open_window; cmd 'layout tabbed'; cmd 'focus parent'; -$third = open_window($x); +$third = open_window; sync_with_i3($x); diff --git a/testcases/t/174-border-config.t b/testcases/t/174-border-config.t index a27126cb..6196b684 100644 --- a/testcases/t/174-border-config.t +++ b/testcases/t/174-border-config.t @@ -23,7 +23,7 @@ my $tmp = fresh_workspace; ok(@{get_ws_content($tmp)} == 0, 'no containers yet'); -my $first = open_window($x); +my $first = open_window; my @content = @{get_ws_content($tmp)}; ok(@content == 1, 'one container opened'); @@ -49,7 +49,7 @@ $tmp = fresh_workspace; ok(@{get_ws_content($tmp)} == 0, 'no containers yet'); -$first = open_window($x); +$first = open_window; @content = @{get_ws_content($tmp)}; ok(@content == 1, 'one container opened'); diff --git a/testcases/t/175-startup-notification.t b/testcases/t/175-startup-notification.t index b624508b..a794f70a 100644 --- a/testcases/t/175-startup-notification.t +++ b/testcases/t/175-startup-notification.t @@ -97,7 +97,7 @@ my $second_ws = fresh_workspace; is(@{get_ws_content($second_ws)}, 0, 'no containers on the second workspace yet'); -my $win = open_window($x, { dont_map => 1 }); +my $win = open_window({ dont_map => 1 }); mark_window($win->id); $win->map; # We don’t use wait_for_map because the window will not get mapped -- it is on @@ -112,10 +112,10 @@ is(@{get_ws_content($first_ws)}, 1, 'one container on the first workspace'); # same thing, but with _NET_STARTUP_ID set on the leader ###################################################################### -my $leader = open_window($x, { dont_map => 1 }); +my $leader = open_window({ dont_map => 1 }); mark_window($leader->id); -$win = open_window($x, { dont_map => 1, client_leader => $leader }); +$win = open_window({ dont_map => 1, client_leader => $leader }); $win->map; sync_with_i3($x); @@ -130,7 +130,7 @@ is(@{get_ws_content($first_ws)}, 2, 'two containers on the first workspace'); complete_startup(); sync_with_i3($x); -my $otherwin = open_window($x); +my $otherwin = open_window; is(@{get_ws_content($second_ws)}, 1, 'one container on the second workspace'); ######################################################################