testcases: let i3test.pm export $x, adapt testcases

This commit is contained in:
Maik Fischer 2011-11-21 21:39:50 +01:00 committed by Michael Stapelberg
parent 1b1d7941ec
commit 30ea33decb
52 changed files with 15 additions and 239 deletions

View File

@ -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});

View File

@ -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);

View File

@ -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');

View File

@ -3,8 +3,6 @@
use i3test;
my $x = X11::XCB::Connection->new;
fresh_workspace;
#####################################################################

View File

@ -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);

View File

@ -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(

View File

@ -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
##################################

View File

@ -3,8 +3,6 @@
use i3test;
my $x = X11::XCB::Connection->new;
my $tmp = fresh_workspace;
#####################################################################

View File

@ -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
#####################################################################

View File

@ -5,8 +5,6 @@
use i3test;
my $x = X11::XCB::Connection->new;
fresh_workspace;
cmd 'split h';

View File

@ -4,8 +4,6 @@
use i3test;
use File::Temp;
my $x = X11::XCB::Connection->new;
my $tmp = fresh_workspace;
cmd 'split h';

View File

@ -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;

View File

@ -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;
#####################################################################

View File

@ -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;

View File

@ -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');

View File

@ -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;

View File

@ -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;

View File

@ -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();

View File

@ -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');

View File

@ -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;

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -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) = @_;

View File

@ -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) = @_;

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -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;
#####################################################################

View File

@ -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 ] });

View File

@ -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;
#####################################################################

View File

@ -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;
#####################################################################

View File

@ -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;

View File

@ -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;
#####################################################################

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -6,8 +6,6 @@
#
use i3test;
my $x = X11::XCB::Connection->new;
sub two_windows {
my $tmp = fresh_workspace;

View File

@ -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:

View File

@ -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 {

View File

@ -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

View File

@ -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;

View File

@ -6,8 +6,6 @@
#
use i3test;
my $x = i3test::X11->new;
#####################################################################
# 1: test the wrapping behaviour without force_focus_wrapping
#####################################################################

View File

@ -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'
##############################################################

View File

@ -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 {

View File

@ -7,8 +7,6 @@
use i3test;
my $x = X11::XCB::Connection->new;
#####################################################################
# 1: check that new windows start with 'normal' border unless configured
# otherwise

View File

@ -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

View File

@ -7,9 +7,6 @@
#
use i3test;
use X11::XCB::Connection;
my $x = X11::XCB::Connection->new;
my $config = <<EOT;
# i3 config file (v4)