From 30ea33decb9bb2adb99d6fefe5ab74b7aaa6e203 Mon Sep 17 00:00:00 2001 From: Maik Fischer Date: Mon, 21 Nov 2011 21:39:50 +0100 Subject: [PATCH] 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 = <