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;
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');
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');
$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,
# 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'),
return $x->input_focus;
}
-$focus = $x->input_focus;
+my $focus = $x->input_focus;
is($focus, $bottom->id, "Latest window focused");
$focus = focus_after("ml");
return $x->input_focus;
}
-$focus = $x->input_focus;
+my $focus = $x->input_focus;
is($focus, $bottom->id, "Latest window focused");
$focus = focus_after("s");
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');
$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');
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');
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');
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');
my $split = $focus->[0];
cmd 'level down';
-my $second = open_empty_con($i3);
+$second = open_empty_con($i3);
isnt($first, $second, 'different container 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');
$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');
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);
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');
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');
#####################################################################
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;
# 'kill window'
##############################################################
-my $tmp = two_windows;
+$tmp = two_windows;
cmd 'kill window';
# and check if both are gone
##############################################################
-my $tmp = two_windows;
+$tmp = two_windows;
cmd 'kill client';
$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));
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',
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',
$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',
$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',
$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');
# 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',
$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;
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');
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');
$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);
$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);