testcases: drop open_window()s $x parameter, use global one instead

This commit is contained in:
Maik Fischer 2011-11-22 00:47:32 +01:00 committed by Michael Stapelberg
parent e9acd36ce4
commit fce7570f96
36 changed files with 106 additions and 106 deletions

View File

@ -156,7 +156,7 @@ sub wait_for_unmap {
# name => 'Window <n>'
#
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 {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -11,7 +11,7 @@ my $tmp = fresh_workspace;
# open a window, verify its 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');

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -7,8 +7,8 @@ use i3test;
fresh_workspace;
open_window($x);
open_window($x);
open_window;
open_window;
cmd 'layout stacking';
sleep 1;

View File

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

View File

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

View File

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