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.
This commit is contained in:
parent
0a65b770e8
commit
1b1d7941ec
|
@ -66,11 +66,11 @@ use Data::Dumper;
|
||||||
use AnyEvent::I3;
|
use AnyEvent::I3;
|
||||||
use Time::HiRes qw(sleep);
|
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 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 $@;
|
$tester->bail_out("$@") if $@;
|
||||||
|
feature->import(":5.10");
|
||||||
|
strict->import;
|
||||||
|
warnings->import;
|
||||||
|
|
||||||
@_ = ($class);
|
@_ = ($class);
|
||||||
goto \&Exporter::import;
|
goto \&Exporter::import;
|
||||||
|
|
|
@ -31,7 +31,7 @@ sub focus_after {
|
||||||
return $x->input_focus;
|
return $x->input_focus;
|
||||||
}
|
}
|
||||||
|
|
||||||
$focus = $x->input_focus;
|
my $focus = $x->input_focus;
|
||||||
is($focus, $bottom->id, "Latest window focused");
|
is($focus, $bottom->id, "Latest window focused");
|
||||||
|
|
||||||
$focus = focus_after('focus up');
|
$focus = focus_after('focus up');
|
||||||
|
|
|
@ -88,7 +88,7 @@ $window = open_window($x, {
|
||||||
window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'),
|
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->width, $primary->rect->width, 'dock client is as wide as the screen');
|
||||||
is($rect->height, 30, 'height is unchanged');
|
is($rect->height, 30, 'height is unchanged');
|
||||||
|
|
||||||
|
@ -153,8 +153,8 @@ $window = open_window($x, {
|
||||||
$window->_create();
|
$window->_create();
|
||||||
|
|
||||||
# Add a _NET_WM_STRUT_PARTIAL hint
|
# Add a _NET_WM_STRUT_PARTIAL hint
|
||||||
my $atomname = $x->atom(name => '_NET_WM_STRUT_PARTIAL');
|
$atomname = $x->atom(name => '_NET_WM_STRUT_PARTIAL');
|
||||||
my $atomtype = $x->atom(name => 'CARDINAL');
|
$atomtype = $x->atom(name => 'CARDINAL');
|
||||||
|
|
||||||
$x->change_property(
|
$x->change_property(
|
||||||
PROP_MODE_REPLACE,
|
PROP_MODE_REPLACE,
|
||||||
|
@ -180,7 +180,7 @@ $window->destroy;
|
||||||
# regression test: transient dock client
|
# regression test: transient dock client
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
$fwindow = open_window($x, {
|
my $fwindow = open_window($x, {
|
||||||
dont_map => 1,
|
dont_map => 1,
|
||||||
background_color => '#FF0000',
|
background_color => '#FF0000',
|
||||||
window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'),
|
window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK'),
|
||||||
|
|
|
@ -48,7 +48,7 @@ sub focus_after {
|
||||||
return $x->input_focus;
|
return $x->input_focus;
|
||||||
}
|
}
|
||||||
|
|
||||||
$focus = $x->input_focus;
|
my $focus = $x->input_focus;
|
||||||
is($focus, $bottom->id, "Latest window focused");
|
is($focus, $bottom->id, "Latest window focused");
|
||||||
|
|
||||||
$focus = focus_after("ml");
|
$focus = focus_after("ml");
|
||||||
|
|
|
@ -46,7 +46,7 @@ sub focus_after {
|
||||||
return $x->input_focus;
|
return $x->input_focus;
|
||||||
}
|
}
|
||||||
|
|
||||||
$focus = $x->input_focus;
|
my $focus = $x->input_focus;
|
||||||
is($focus, $bottom->id, "Latest window focused");
|
is($focus, $bottom->id, "Latest window focused");
|
||||||
|
|
||||||
$focus = focus_after("s");
|
$focus = focus_after("s");
|
||||||
|
|
|
@ -30,7 +30,7 @@ sub focus_after {
|
||||||
return $x->input_focus;
|
return $x->input_focus;
|
||||||
}
|
}
|
||||||
|
|
||||||
$focus = $x->input_focus;
|
my $focus = $x->input_focus;
|
||||||
is($focus, $bottom->id, "Latest window focused");
|
is($focus, $bottom->id, "Latest window focused");
|
||||||
|
|
||||||
$focus = focus_after('focus left');
|
$focus = focus_after('focus left');
|
||||||
|
|
|
@ -33,10 +33,10 @@ is(@urgent, 0, 'no window got the urgent flag');
|
||||||
$top->add_hint('urgency');
|
$top->add_hint('urgency');
|
||||||
sync_with_i3($x);
|
sync_with_i3($x);
|
||||||
|
|
||||||
@content = @{get_ws_content($tmp)};
|
my @content = @{get_ws_content($tmp)};
|
||||||
@urgent = grep { $_->{urgent} } @content;
|
@urgent = grep { $_->{urgent} } @content;
|
||||||
$top_info = first { $_->{window} == $top->id } @content;
|
my $top_info = first { $_->{window} == $top->id } @content;
|
||||||
$bottom_info = first { $_->{window} == $bottom->id } @content;
|
my $bottom_info = first { $_->{window} == $bottom->id } @content;
|
||||||
|
|
||||||
ok($top_info->{urgent}, 'top window is marked urgent');
|
ok($top_info->{urgent}, 'top window is marked urgent');
|
||||||
ok(!$bottom_info->{urgent}, 'bottom window is not marked urgent');
|
ok(!$bottom_info->{urgent}, 'bottom window is not marked urgent');
|
||||||
|
|
|
@ -108,7 +108,7 @@ ok(defined($ws), "workspace 3: $tmp was created");
|
||||||
is($ws->{num}, 3, 'workspace number is 3');
|
is($ws->{num}, 3, 'workspace number is 3');
|
||||||
|
|
||||||
cmd "workspace 0: $tmp";
|
cmd "workspace 0: $tmp";
|
||||||
my $ws = get_ws("0: $tmp");
|
$ws = get_ws("0: $tmp");
|
||||||
ok(defined($ws), "workspace 0: $tmp was created");
|
ok(defined($ws), "workspace 0: $tmp was created");
|
||||||
is($ws->{num}, 0, 'workspace number is 0');
|
is($ws->{num}, 0, 'workspace number is 0');
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ isnt($first, $second, 'different container focused');
|
||||||
|
|
||||||
cmd qq|[con_id="$first"] focus|;
|
cmd qq|[con_id="$first"] focus|;
|
||||||
cmd 'open';
|
cmd 'open';
|
||||||
$content = get_ws_content($tmp);
|
my $content = get_ws_content($tmp);
|
||||||
ok(@{$content} == 3, 'three containers opened');
|
ok(@{$content} == 3, 'three containers opened');
|
||||||
|
|
||||||
is($content->[0]->{id}, $first, 'first container unmodified');
|
is($content->[0]->{id}, $first, 'first container unmodified');
|
||||||
|
|
|
@ -17,7 +17,7 @@ cmd qq|[con_id="$first"] focus|;
|
||||||
|
|
||||||
cmd 'split v';
|
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');
|
is($nodes->[0]->{focused}, 0, 'split container not focused');
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ cmd 'level up';
|
||||||
my $split = $focus->[0];
|
my $split = $focus->[0];
|
||||||
cmd 'level down';
|
cmd 'level down';
|
||||||
|
|
||||||
my $second = open_empty_con($i3);
|
$second = open_empty_con($i3);
|
||||||
|
|
||||||
isnt($first, $second, 'different container focused');
|
isnt($first, $second, 'different container focused');
|
||||||
|
|
||||||
|
@ -62,10 +62,10 @@ is($nodes->[0]->{focused}, 0, 'split container not focused');
|
||||||
# focus the split container
|
# focus the split container
|
||||||
cmd 'level up';
|
cmd 'level up';
|
||||||
($nodes, $focus) = get_ws_content($tmp);
|
($nodes, $focus) = get_ws_content($tmp);
|
||||||
my $split = $focus->[0];
|
$split = $focus->[0];
|
||||||
cmd 'level down';
|
cmd 'level down';
|
||||||
|
|
||||||
my $second = open_empty_con($i3);
|
$second = open_empty_con($i3);
|
||||||
|
|
||||||
isnt($first, $second, 'different container focused');
|
isnt($first, $second, 'different container focused');
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ $tmp = fresh_workspace;
|
||||||
|
|
||||||
$first = open_window($x, { background_color => '#ff0000' }); # window 5
|
$first = open_window($x, { background_color => '#ff0000' }); # window 5
|
||||||
$second = open_window($x, { background_color => '#00ff00' }); # window 6
|
$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');
|
is($x->input_focus, $third->id, 'last container focused');
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ is(@{$ws->{floating_nodes}}, 0, 'no floating nodes so far');
|
||||||
is(@{$ws->{nodes}}, 1, 'one tiling node (stacked con)');
|
is(@{$ws->{nodes}}, 1, 'one tiling node (stacked con)');
|
||||||
|
|
||||||
# Create a floating window
|
# Create a floating window
|
||||||
my $window = open_floating_window($x);
|
$window = open_floating_window($x);
|
||||||
ok($window->mapped, 'Window is mapped');
|
ok($window->mapped, 'Window is mapped');
|
||||||
|
|
||||||
$ws = get_ws($tmp);
|
$ws = get_ws($tmp);
|
||||||
|
|
|
@ -37,7 +37,7 @@ is(@{$nodes->[1]->{nodes}}, 2, 'two windows in split con');
|
||||||
|
|
||||||
cmd 'floating toggle';
|
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');
|
is(@{$nodes->[1]->{nodes}}, 3, 'three windows in split con after floating toggle');
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ is($nodes->[0]->{fullscreen_mode}, 0, 'client not fullscreen');
|
||||||
cmd 'nop making fullscreen';
|
cmd 'nop making fullscreen';
|
||||||
cmd 'fullscreen';
|
cmd 'fullscreen';
|
||||||
|
|
||||||
my $nodes = get_ws_content $tmp;
|
$nodes = get_ws_content $tmp;
|
||||||
is($nodes->[0]->{fullscreen_mode}, 1, 'client fullscreen now');
|
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 'level up';
|
||||||
cmd 'fullscreen';
|
cmd 'fullscreen';
|
||||||
|
|
||||||
my $nodes = get_ws_content $tmp;
|
$nodes = get_ws_content $tmp;
|
||||||
is($nodes->[0]->{fullscreen_mode}, 0, 'client not fullscreen any longer');
|
is($nodes->[0]->{fullscreen_mode}, 0, 'client not fullscreen any longer');
|
||||||
|
|
||||||
does_i3_live;
|
does_i3_live;
|
||||||
|
|
|
@ -42,7 +42,7 @@ ok(@{get_ws_content($tmp)} == 1, 'one container left after killing');
|
||||||
# 'kill window'
|
# 'kill window'
|
||||||
##############################################################
|
##############################################################
|
||||||
|
|
||||||
my $tmp = two_windows;
|
$tmp = two_windows;
|
||||||
|
|
||||||
cmd 'kill window';
|
cmd 'kill window';
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ ok(@{get_ws_content($tmp)} == 1, 'one container left after killing');
|
||||||
# and check if both are gone
|
# and check if both are gone
|
||||||
##############################################################
|
##############################################################
|
||||||
|
|
||||||
my $tmp = two_windows;
|
$tmp = two_windows;
|
||||||
|
|
||||||
cmd 'kill client';
|
cmd 'kill client';
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ is($content[0]->{border}, 'normal', 'normal border');
|
||||||
$window->unmap;
|
$window->unmap;
|
||||||
wait_for_unmap $x;
|
wait_for_unmap $x;
|
||||||
|
|
||||||
my @content = @{get_ws_content($tmp)};
|
@content = @{get_ws_content($tmp)};
|
||||||
cmp_ok(@content, '==', 0, 'no more nodes');
|
cmp_ok(@content, '==', 0, 'no more nodes');
|
||||||
diag('content = '. Dumper(\@content));
|
diag('content = '. Dumper(\@content));
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
|
||||||
my $workspaces = get_workspace_names;
|
my $workspaces = get_workspace_names;
|
||||||
ok(!("targetws" ~~ @{$workspaces}), 'targetws does not exist yet');
|
ok(!("targetws" ~~ @{$workspaces}), 'targetws does not exist yet');
|
||||||
|
|
||||||
my $window = $x->root->create_child(
|
$window = $x->root->create_child(
|
||||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
class => WINDOW_CLASS_INPUT_OUTPUT,
|
||||||
rect => [ 0, 0, 30, 30 ],
|
rect => [ 0, 0, 30, 30 ],
|
||||||
background_color => '#0000ff',
|
background_color => '#0000ff',
|
||||||
|
@ -124,7 +124,7 @@ $tmp = fresh_workspace;
|
||||||
ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
|
ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
|
||||||
ok("targetws" ~~ @{get_workspace_names()}, 'targetws does not exist 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,
|
class => WINDOW_CLASS_INPUT_OUTPUT,
|
||||||
rect => [ 0, 0, 30, 30 ],
|
rect => [ 0, 0, 30, 30 ],
|
||||||
background_color => '#0000ff',
|
background_color => '#0000ff',
|
||||||
|
@ -162,10 +162,10 @@ $pid = launch_with_config($config);
|
||||||
$tmp = fresh_workspace;
|
$tmp = fresh_workspace;
|
||||||
|
|
||||||
ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
|
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');
|
ok(!("targetws" ~~ @{$workspaces}), 'targetws does not exist yet');
|
||||||
|
|
||||||
my $window = $x->root->create_child(
|
$window = $x->root->create_child(
|
||||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
class => WINDOW_CLASS_INPUT_OUTPUT,
|
||||||
rect => [ 0, 0, 30, 30 ],
|
rect => [ 0, 0, 30, 30 ],
|
||||||
background_color => '#0000ff',
|
background_color => '#0000ff',
|
||||||
|
@ -203,10 +203,10 @@ $pid = launch_with_config($config);
|
||||||
$tmp = fresh_workspace;
|
$tmp = fresh_workspace;
|
||||||
|
|
||||||
ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
|
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');
|
ok(!("targetws" ~~ @{$workspaces}), 'targetws does not exist yet');
|
||||||
|
|
||||||
my $window = $x->root->create_child(
|
$window = $x->root->create_child(
|
||||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
class => WINDOW_CLASS_INPUT_OUTPUT,
|
||||||
rect => [ 0, 0, 30, 30 ],
|
rect => [ 0, 0, 30, 30 ],
|
||||||
background_color => '#0000ff',
|
background_color => '#0000ff',
|
||||||
|
@ -219,7 +219,7 @@ $window->name('special window');
|
||||||
$window->map;
|
$window->map;
|
||||||
wait_for_map $x;
|
wait_for_map $x;
|
||||||
|
|
||||||
my $content = get_ws($tmp);
|
$content = get_ws($tmp);
|
||||||
ok(@{$content->{nodes}} == 0, 'no tiling cons');
|
ok(@{$content->{nodes}} == 0, 'no tiling cons');
|
||||||
ok(@{$content->{floating_nodes}} == 1, 'one floating con');
|
ok(@{$content->{floating_nodes}} == 1, 'one floating con');
|
||||||
|
|
||||||
|
@ -255,7 +255,7 @@ my @docked = get_dock_clients;
|
||||||
# syntax
|
# syntax
|
||||||
is(@docked, 1, 'one dock client yet');
|
is(@docked, 1, 'one dock client yet');
|
||||||
|
|
||||||
my $window = $x->root->create_child(
|
$window = $x->root->create_child(
|
||||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
class => WINDOW_CLASS_INPUT_OUTPUT,
|
||||||
rect => [ 0, 0, 30, 30 ],
|
rect => [ 0, 0, 30, 30 ],
|
||||||
background_color => '#0000ff',
|
background_color => '#0000ff',
|
||||||
|
@ -269,7 +269,7 @@ $window->name('special window');
|
||||||
$window->map;
|
$window->map;
|
||||||
wait_for_map $x;
|
wait_for_map $x;
|
||||||
|
|
||||||
my $content = get_ws($tmp);
|
$content = get_ws($tmp);
|
||||||
ok(@{$content->{nodes}} == 0, 'no tiling cons');
|
ok(@{$content->{nodes}} == 0, 'no tiling cons');
|
||||||
ok(@{$content->{floating_nodes}} == 0, 'one floating con');
|
ok(@{$content->{floating_nodes}} == 0, 'one floating con');
|
||||||
@docked = get_dock_clients;
|
@docked = get_dock_clients;
|
||||||
|
|
|
@ -33,7 +33,8 @@ my $second = open_window($x);
|
||||||
sync_with_i3($x);
|
sync_with_i3($x);
|
||||||
|
|
||||||
is($x->input_focus, $second->id, 'second window focused');
|
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[0]->{layout}, 'stacked', 'layout not stacked');
|
||||||
isnt($content[1]->{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);
|
sync_with_i3($x);
|
||||||
|
|
||||||
is($x->input_focus, $second->id, 'second window focused');
|
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');
|
ok(@content == 1, 'one con at workspace level');
|
||||||
is($content[0]->{layout}, 'stacked', 'layout stacked');
|
is($content[0]->{layout}, 'stacked', 'layout stacked');
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ EOT
|
||||||
|
|
||||||
$pid = launch_with_config($config);
|
$pid = launch_with_config($config);
|
||||||
|
|
||||||
my @names = @{get_workspace_names()};
|
@names = @{get_workspace_names()};
|
||||||
cmp_deeply(\@names, [ 'foobar' ], 'i3 starts on named workspace foobar');
|
cmp_deeply(\@names, [ 'foobar' ], 'i3 starts on named workspace foobar');
|
||||||
|
|
||||||
exit_gracefully($pid);
|
exit_gracefully($pid);
|
||||||
|
@ -57,7 +57,7 @@ EOT
|
||||||
|
|
||||||
$pid = launch_with_config($config);
|
$pid = launch_with_config($config);
|
||||||
|
|
||||||
my @names = @{get_workspace_names()};
|
@names = @{get_workspace_names()};
|
||||||
cmp_deeply(\@names, [ 'foobar' ], 'i3 starts on named workspace foobar');
|
cmp_deeply(\@names, [ 'foobar' ], 'i3 starts on named workspace foobar');
|
||||||
|
|
||||||
exit_gracefully($pid);
|
exit_gracefully($pid);
|
||||||
|
|
Loading…
Reference in New Issue