#!perl
+# vim:ts=4:sw=4:expandtab
-use i3test tests => 4;
+use i3test;
use X11::XCB qw(:all);
-use Time::HiRes qw(sleep);
BEGIN {
- use_ok('X11::XCB::Window');
+ use_ok('X11::XCB::Window');
}
my $x = X11::XCB::Connection->new;
my $original_rect = X11::XCB::Rect->new(x => 0, y => 0, width => 30, height => 30);
my $window = $x->root->create_child(
- class => WINDOW_CLASS_INPUT_OUTPUT,
- rect => $original_rect,
- background_color => '#C0C0C0',
+ class => WINDOW_CLASS_INPUT_OUTPUT,
+ rect => $original_rect,
+ background_color => '#C0C0C0',
);
isa_ok($window, 'X11::XCB::Window');
my $new_rect = $window->rect;
ok(!eq_deeply($new_rect, $original_rect), "Window got repositioned");
-diag( "Testing i3, Perl $], $^X" );
+done_testing;
#!perl
# vim:ts=4:sw=4:expandtab
-use i3test tests => 24;
+use i3test;
use X11::XCB qw(:all);
use List::Util qw(first);
-use Time::HiRes qw(sleep);
my $i3 = i3("/tmp/nestedcons");
-my $tmp = get_unused_workspace();
-$i3->command("workspace $tmp")->recv;
+my $tmp = fresh_workspace;
sub fullscreen_windows {
scalar grep { $_->{fullscreen_mode} != 0 } @{get_ws_content($tmp)}
$window->map;
-sleep(0.25);
+sleep 0.25;
# open another container to make the window get only half of the screen
-$i3->command('open')->recv;
+cmd 'open';
my $new_rect = $window->rect;
ok(!eq_deeply($new_rect, $original_rect), "Window got repositioned");
$original_rect = $new_rect;
-sleep(0.25);
+sleep 0.25;
$window->fullscreen(1);
-sleep(0.25);
+sleep 0.25;
$new_rect = $window->rect;
ok(!eq_deeply($new_rect, $original_rect), "Window got repositioned after fullscreen");
# open another container because the empty one will swallow the window we
# map in a second
-$i3->command('open')->recv;
+cmd 'open';
$original_rect = X11::XCB::Rect->new(x => 0, y => 0, width => 30, height => 30);
$window = $x->root->create_child(
);
$swindow->map;
-sleep(0.25);
+sleep 0.25;
ok(!$swindow->mapped, 'window not mapped while fullscreen window active');
is(fullscreen_windows(), 0, 'amount of fullscreen windows after disabling');
-$i3->command('fullscreen')->recv;
+cmd 'fullscreen';
is(fullscreen_windows(), 1, 'amount of fullscreen windows after fullscreen command');
-$i3->command('fullscreen')->recv;
+cmd 'fullscreen';
is(fullscreen_windows(), 0, 'amount of fullscreen windows after fullscreen command');
# clean up the workspace so that it will be cleaned when switching away
-$i3->command('kill')->recv for (@{get_ws_content($tmp)});
-
+cmd 'kill' for (@{get_ws_content($tmp)});
-diag( "Testing i3, Perl $], $^X" );
+done_testing;
#!perl
# vim:ts=4:sw=4:expandtab
-use i3test tests => 5;
+use i3test;
use X11::XCB qw(:all);
BEGIN {
is_deeply($new_rect, $original_rect, "window untouched");
-diag( "Testing i3, Perl $], $^X" );
+done_testing;
#!perl
# vim:ts=4:sw=4:expandtab
-use i3test tests => 11;
+use i3test;
use X11::XCB qw(:all);
-use Time::HiRes qw(sleep);
BEGIN {
use_ok('X11::XCB::Window');
$window->map;
-sleep(0.25);
+sleep 0.25;
my ($absolute, $top) = $window->rect;
$window->map;
-sleep(0.25);
+sleep 0.25;
($absolute, $top) = $window->rect;
$window->unmap;
-diag( "Testing i3, Perl $], $^X" );
+done_testing;
#!perl
# vim:ts=4:sw=4:expandtab
-use i3test tests => 2;
+use i3test;
use X11::XCB qw(:all);
-use Time::HiRes qw(sleep);
BEGIN {
use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection');
my $x = X11::XCB::Connection->new;
-my $i3 = i3("/tmp/nestedcons");
-my $tmp = get_unused_workspace();
-$i3->command("workspace $tmp")->recv;
+fresh_workspace;
#####################################################################
# Ensure IPC works by switching workspaces
#####################################################################
# Create a window so we can get a focus different from NULL
-my $window = i3test::open_standard_window($x);
+my $window = open_standard_window($x);
diag("window->id = " . $window->id);
-sleep(0.25);
+sleep 0.25;
my $focus = $x->input_focus;
diag("old focus = $focus");
-# Switch to the nineth workspace
-my $otmp = get_unused_workspace();
-$i3->command("workspace $otmp")->recv;
+# Switch to another workspace
+fresh_workspace;
my $new_focus = $x->input_focus;
isnt($focus, $new_focus, "Focus changed");
-diag( "Testing i3, Perl $], $^X" );
+done_testing;
#!perl
# vim:ts=4:sw=4:expandtab
-use i3test tests => 6;
+use i3test;
use X11::XCB qw(:all);
-use Time::HiRes qw(sleep);
BEGIN {
use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection');
my $x = X11::XCB::Connection->new;
my $i3 = i3("/tmp/nestedcons");
-my $tmp = get_unused_workspace();
-$i3->command("workspace $tmp")->recv;
+my $tmp = fresh_workspace;
#####################################################################
# Create two windows and make sure focus switching works
#####################################################################
# Change mode of the container to "default" for following tests
-$i3->command('layout default')->recv;
-$i3->command('split v')->recv;
+cmd 'layout default';
+cmd 'split v';
-my $top = i3test::open_standard_window($x);
-my $mid = i3test::open_standard_window($x);
-my $bottom = i3test::open_standard_window($x);
-sleep(0.25);
+my $top = open_standard_window($x);
+my $mid = open_standard_window($x);
+my $bottom = open_standard_window($x);
+sleep 0.25;
diag("top id = " . $top->id);
diag("mid id = " . $mid->id);
#is($focus, $right->id, "right window focused");
-diag( "Testing i3, Perl $], $^X" );
+done_testing;
# Checks if the focus is correctly restored, when creating a floating client
# over an unfocused tiling client and destroying the floating one again.
-use i3test tests => 4;
+use i3test;
use X11::XCB qw(:all);
-use Time::HiRes qw(sleep);
BEGIN {
use_ok('X11::XCB::Window') or BAIL_OUT('Could not load X11::XCB::Window');
my $x = X11::XCB::Connection->new;
my $i3 = i3("/tmp/nestedcons");
-my $tmp = get_unused_workspace();
-$i3->command("workspace $tmp")->recv;
+fresh_workspace;
-
-$i3->command('split h')->recv;
-my $tiled_left = i3test::open_standard_window($x);
-my $tiled_right = i3test::open_standard_window($x);
+cmd 'split h';
+my $tiled_left = open_standard_window($x);
+my $tiled_right = open_standard_window($x);
sleep 0.25;
is($x->input_focus, $focus, 'Focus correctly restored');
-diag( "Testing i3, Perl $], $^X" );
+done_testing;
use i3test;
use X11::XCB qw(:all);
-use Time::HiRes qw(sleep);
use List::Util qw(first);
BEGIN {
use i3test tests => 6;
use X11::XCB qw(:all);
-use Time::HiRes qw(sleep);
use Digest::SHA1 qw(sha1_base64);
BEGIN {
my $x = X11::XCB::Connection->new;
my $i3 = i3("/tmp/nestedcons");
-my $tmp = get_unused_workspace();
-$i3->command("workspace $tmp")->recv;
+fresh_workspace;
-$i3->command('split h')->recv;
+cmd 'split h';
#####################################################################
# Create two windows and make sure focus switching works
#####################################################################
-my $top = i3test::open_standard_window($x);
+my $top = open_standard_window($x);
sleep 0.25;
-my $mid = i3test::open_standard_window($x);
+my $mid = open_standard_window($x);
sleep 0.25;
-my $bottom = i3test::open_standard_window($x);
+my $bottom = open_standard_window($x);
sleep 0.25;
diag("top id = " . $top->id);
sub focus_after {
my $msg = shift;
- $i3->command($msg)->recv;
+ cmd $msg;
return $x->input_focus;
}
$focus = focus_after(qq|[con_mark="$random_mark"] focus|);
is($focus, $mid->id, "goto worked");
+done_testing;
# the workspace to be empty).
# TODO: skip it by default?
-use i3test tests => 15;
+use i3test;
use X11::XCB qw(:all);
-use Time::HiRes qw(sleep);
BEGIN {
use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection');
my $x = X11::XCB::Connection->new;
-my $i3 = i3("/tmp/nestedcons");
-my $tmp = get_unused_workspace();
-$i3->command("workspace $tmp")->recv;
+fresh_workspace;
#####################################################################
# Create a floating window and see if resizing works
test_resize;
# Test borderless
-$i3->command('border none')->recv;
+cmd 'border none';
test_resize;
# Test with 1-px-border
-$i3->command('border 1pixel')->recv;
+cmd 'border 1pixel';
test_resize;
+
+done_testing;
#!perl
# vim:ts=4:sw=4:expandtab
-use i3test tests => 10;
+use i3test;
use X11::XCB qw(:all);
-use Time::HiRes qw(sleep);
use List::Util qw(first);
BEGIN {
my $x = X11::XCB::Connection->new;
-my $i3 = i3("/tmp/nestedcons");
-my $tmp = get_unused_workspace();
-$i3->command("workspace $tmp")->recv;
+my $tmp = fresh_workspace;
#####################################################################
# Create two windows and put them in stacking mode
#####################################################################
-$i3->command('split v')->recv;
+cmd 'split v';
-my $top = i3test::open_standard_window($x);
-my $bottom = i3test::open_standard_window($x);
+my $top = open_standard_window($x);
+my $bottom = open_standard_window($x);
my @urgent = grep { $_->{urgent} == 1 } @{get_ws_content($tmp)};
is(@urgent, 0, 'no window got the urgent flag');
-#$i3->command('layout stacking')->recv;
+# cmd 'layout stacking';
#####################################################################
# Add the urgency hint, switch to a different workspace and back again
is($bottom_info->{urgent}, 0, 'bottom window is not marked urgent');
is(@urgent, 1, 'exactly one window got the urgent flag');
-$i3->command('[id="' . $top->id . '"] focus')->recv;
+cmd '[id="' . $top->id . '"] focus';
@urgent = grep { $_->{urgent} == 1 } @{get_ws_content($tmp)};
is(@urgent, 0, 'no window got the urgent flag after focusing');
my $ws = get_ws($tmp);
is($ws->{urgent}, 0, 'urgent flag not set on workspace');
-my $otmp = get_unused_workspace();
-$i3->command("workspace $otmp")->recv;
+my $otmp = fresh_workspace;
$top->add_hint('urgency');
sleep 0.5;
$ws = get_ws($tmp);
is($ws->{urgent}, 1, 'urgent flag set on workspace');
-$i3->command("workspace $tmp")->recv;
+cmd "workspace $tmp";
$ws = get_ws($tmp);
is($ws->{urgent}, 0, 'urgent flag not set on workspace after switching');
-diag( "Testing i3, Perl $], $^X" );
+done_testing;
#!perl
# vim:ts=4:sw=4:expandtab
-use i3test tests => 7;
+use i3test;
use X11::XCB qw(:all);
-use Time::HiRes qw(sleep);
BEGIN {
use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection');
my $x = X11::XCB::Connection->new;
my $i3 = i3("/tmp/nestedcons");
-my $tmp = get_unused_workspace();
-$i3->command("workspace $tmp")->recv;
+my $tmp = fresh_workspace;
####################################################################################
# first part: test if a floating window will be correctly positioned above its leader
sleep 0.25;
#########################################################################
-# Switch workspace to 10 and open a child window. It should be positioned
-# on workspace 9.
+# Switch to a different workspace and open a child window. It should be opened
+# on the old workspace.
#########################################################################
-my $otmp = get_unused_workspace();
-$i3->command("workspace $otmp")->recv;
+fresh_workspace;
my $child = $x->root->create_child(
class => WINDOW_CLASS_INPUT_OUTPUT,
isnt($x->input_focus, $child->id, "Child window focused");
# Switch back
-$i3->command("workspace $tmp")->recv;
+cmd "workspace $tmp";
is($x->input_focus, $child->id, "Child window focused");
}
+
+done_testing;
#!perl
# vim:ts=4:sw=4:expandtab
-use i3test tests => 2;
+use i3test;
use List::MoreUtils qw(all);
my $i3 = i3("/tmp/nestedcons");
}
-diag( "Testing i3, Perl $], $^X" );
+done_testing;
#!perl
# vim:ts=4:sw=4:expandtab
-use i3test tests => 7;
+use i3test;
use List::MoreUtils qw(all none);
use List::Util qw(first);
#diag(Dumper($tree));
-diag( "Testing i3, Perl $], $^X" );
+done_testing;
# Tests whether we can switch to a non-existant workspace
# (necessary for further tests)
#
-use i3test tests => 3;
-
-my $i3 = i3("/tmp/nestedcons");
+use i3test;
sub workspace_exists {
my ($name) = @_;
($name ~~ @{get_workspace_names()})
}
-my $tmp = get_unused_workspace();
-diag("Temporary workspace name: $tmp\n");
-
-$i3->command("workspace $tmp")->recv;
+my $tmp = fresh_workspace;
ok(workspace_exists($tmp), 'workspace created');
# if the workspace could not be created, we cannot run any other test
# (every test starts by creating its workspace)
BAIL_OUT('Cannot create workspace, further tests make no sense');
}
-my $otmp = get_unused_workspace();
+my $otmp = fresh_workspace;
diag("Other temporary workspace name: $otmp\n");
# As the old workspace was empty, it should get
# cleaned up as we switch away from it
-$i3->command("workspace $otmp")->recv;
+cmd "workspace $otmp";
ok(!workspace_exists($tmp), 'old workspace cleaned up');
# Switch to the same workspace again to make sure it doesn’t get cleaned up
-$i3->command("workspace $otmp")->recv;
-$i3->command("workspace $otmp")->recv;
+cmd "workspace $otmp";
+cmd "workspace $otmp";
ok(workspace_exists($otmp), 'other workspace still exists');
-diag( "Testing i3, Perl $], $^X" );
+done_testing;
# Tests whether opening an empty container and killing it again works
#
use List::Util qw(first);
-use i3test tests => 6;
+use i3test;
-my $i3 = i3("/tmp/nestedcons");
-
-my $tmp = get_unused_workspace();
-$i3->command("workspace $tmp")->recv;
+my $tmp = fresh_workspace;
ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
# Open a new container
-$i3->command("open")->recv;
+cmd 'open';
ok(@{get_ws_content($tmp)} == 1, 'container opened');
-$i3->command("kill")->recv;
+cmd 'kill';
ok(@{get_ws_content($tmp)} == 0, 'container killed');
##############################################################
# by its ID to test if the parser correctly matches the window
##############################################################
-$i3->command('open')->recv;
-$i3->command('open')->recv;
+cmd 'open';
+cmd 'open';
ok(@{get_ws_content($tmp)} == 2, 'two containers opened');
my $content = get_ws_content($tmp);
my $not_focused = first { !$_->{focused} } @{$content};
my $id = $not_focused->{id};
-$i3->command("[con_id=\"$id\"] kill")->recv;
+cmd "[con_id=\"$id\"] kill";
$content = get_ws_content($tmp);
ok(@{$content} == 1, 'one container killed');
ok($content->[0]->{id} != $id, 'correct window killed');
-diag( "Testing i3, Perl $], $^X" );
+done_testing;
#
# Tests all kinds of matching methods
#
-use i3test tests => 4;
+use i3test;
use X11::XCB qw(:all);
-my $i3 = i3("/tmp/nestedcons");
-
-my $tmp = get_unused_workspace();
-$i3->command("workspace $tmp")->recv;
+my $tmp = fresh_workspace;
ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
######################################################################
# TODO: use PCRE expressions
# TODO: specify more match types
-$i3->command(q|[class="*"] kill|)->recv;
-$i3->command(q|[con_id="99999"] kill|)->recv;
+cmd q|[class="*"] kill|;
+cmd q|[con_id="99999"] kill|;
$content = get_ws_content($tmp);
ok(@{$content} == 1, 'window still there');
# now kill the window
cmd 'nop now killing the window';
my $id = $win->{id};
-$i3->command(qq|[con_id="$id"] kill|)->recv;
+cmd qq|[con_id="$id"] kill|;
# give i3 some time to pick up the UnmapNotify event
sleep 0.25;
# TODO: same test, but with pcre expressions
-diag( "Testing i3, Perl $], $^X" );
+done_testing;
#
# Tests multiple commands (using ';') and multiple operations (using ',')
#
-use i3test tests => 24;
-use X11::XCB qw(:all);
+use i3test;
-my $i3 = i3("/tmp/nestedcons");
-
-my $tmp = get_unused_workspace();
-$i3->command("workspace $tmp")->recv;
+my $tmp = fresh_workspace;
sub multiple_cmds {
my ($cmd) = @_;
- $i3->command('open')->recv;
- $i3->command('open')->recv;
+ cmd 'open';
+ cmd 'open';
ok(@{get_ws_content($tmp)} == 2, 'two containers opened');
- $i3->command($cmd)->recv;
+ cmd $cmd;
ok(@{get_ws_content($tmp)} == 0, "both containers killed (cmd = $cmd)");
}
multiple_cmds('kill;kill');
# TODO: need a non-invasive command before implementing a test which uses ','
-diag( "Testing i3, Perl $], $^X" );
+done_testing;
#
# Tests focus switching (next/prev)
#
-use i3test tests => 14;
-use X11::XCB qw(:all);
+use i3test;
-my $i3 = i3("/tmp/nestedcons");
-
-my $tmp = get_unused_workspace();
-$i3->command("workspace $tmp")->recv;
+my $tmp = fresh_workspace;
######################################################################
# Open one container, verify that 'next v' and 'next h' do nothing
######################################################################
-$i3->command('open')->recv;
+cmd 'open';
my ($nodes, $focus) = get_ws_content($tmp);
my $old_focused = $focus->[0];
-$i3->command('next v')->recv;
+cmd 'next v';
($nodes, $focus) = get_ws_content($tmp);
is($focus->[0], $old_focused, 'focus did not change with only one con');
-$i3->command('next h')->recv;
+cmd 'next h';
($nodes, $focus) = get_ws_content($tmp);
is($focus->[0], $old_focused, 'focus did not change with only one con');
######################################################################
my $left = $old_focused;
-$i3->command('open')->recv;
+cmd 'open';
($nodes, $focus) = get_ws_content($tmp);
isnt($old_focused, $focus->[0], 'new container is focused');
my $mid = $focus->[0];
-$i3->command('open')->recv;
+cmd 'open';
($nodes, $focus) = get_ws_content($tmp);
isnt($old_focused, $focus->[0], 'new container is focused');
my $right = $focus->[0];
-$i3->command('next h')->recv;
+cmd 'next h';
($nodes, $focus) = get_ws_content($tmp);
isnt($focus->[0], $right, 'focus did change');
is($focus->[0], $left, 'left container focused (wrapping)');
-$i3->command('next h')->recv;
+cmd 'next h';
($nodes, $focus) = get_ws_content($tmp);
is($focus->[0], $mid, 'middle container focused');
-$i3->command('next h')->recv;
+cmd 'next h';
($nodes, $focus) = get_ws_content($tmp);
is($focus->[0], $right, 'right container focused');
-$i3->command('prev h')->recv;
+cmd 'prev h';
($nodes, $focus) = get_ws_content($tmp);
is($focus->[0], $mid, 'middle container focused');
-$i3->command('prev h')->recv;
+cmd 'prev h';
($nodes, $focus) = get_ws_content($tmp);
is($focus->[0], $left, 'left container focused');
-$i3->command('prev h')->recv;
+cmd 'prev h';
($nodes, $focus) = get_ws_content($tmp);
is($focus->[0], $right, 'right container focused');
# Test synonyms (horizontal/vertical instead of h/v)
######################################################################
-$i3->command('prev horizontal')->recv;
+cmd 'prev horizontal';
($nodes, $focus) = get_ws_content($tmp);
is($focus->[0], $mid, 'middle container focused');
-$i3->command('next horizontal')->recv;
+cmd 'next horizontal';
($nodes, $focus) = get_ws_content($tmp);
is($focus->[0], $right, 'right container focused');
# Test focus command
######################################################################
-$i3->command(qq|[con_id="$mid"] focus|)->recv;
+cmd qq|[con_id="$mid"] focus|;
($nodes, $focus) = get_ws_content($tmp);
is($focus->[0], $mid, 'middle container focused');
-diag( "Testing i3, Perl $], $^X" );
+done_testing;
#
# Tests splitting
#
-use i3test tests => 14;
+use i3test;
use X11::XCB qw(:all);
-my $i3 = i3("/tmp/nestedcons");
-
-my $tmp = get_unused_workspace();
-$i3->command("workspace $tmp")->recv;
+my $tmp = fresh_workspace;
my $ws = get_ws($tmp);
is($ws->{orientation}, 'horizontal', 'orientation horizontal by default');
-$i3->command('split v')->recv;
+cmd 'split v';
$ws = get_ws($tmp);
is($ws->{orientation}, 'vertical', 'split v changes workspace orientation');
# Open two containers, split, open another container. Then verify
# the layout is like we expect it to be
######################################################################
-$i3->command('open')->recv;
-$i3->command('open')->recv;
+cmd 'open';
+cmd 'open';
my $content = get_ws_content($tmp);
is(@{$content}, 2, 'two containers on workspace level');
my $old_name = $second->{name};
-$i3->command('split h')->recv;
-$i3->command('open')->recv;
+cmd 'split h';
+cmd 'open';
$content = get_ws_content($tmp);
# Test splitting multiple times without actually creating windows
######################################################################
-$tmp = get_unused_workspace();
-$i3->command("workspace $tmp")->recv;
+$tmp = fresh_workspace;
$ws = get_ws($tmp);
is($ws->{orientation}, 'horizontal', 'orientation horizontal by default');
-$i3->command('split v')->recv;
+cmd 'split v';
$ws = get_ws($tmp);
is($ws->{orientation}, 'vertical', 'split v changes workspace orientation');
-$i3->command('open')->recv;
+cmd 'open';
my @content = @{get_ws_content($tmp)};
# recursively sums up all nodes and their children
}
my $old_count = sum_nodes(\@content);
-$i3->command('split v')->recv;
+cmd 'split v';
@content = @{get_ws_content($tmp)};
$old_count = sum_nodes(\@content);
-$i3->command('split v')->recv;
+cmd 'split v';
@content = @{get_ws_content($tmp)};
my $count = sum_nodes(\@content);
is($count, $old_count, 'not more windows after splitting again');
-diag( "Testing i3, Perl $], $^X" );
+done_testing;
# 3) move a container inside another container
# 4) move a container in a different direction so that we need to go up in tree
#
-use i3test tests => 16;
-use X11::XCB qw(:all);
+use i3test;
my $i3 = i3("/tmp/nestedcons");
-my $tmp = get_unused_workspace();
-cmd "workspace $tmp";
+my $tmp = fresh_workspace;
######################################################################
# 1) move a container which cannot be moved
my $first = $old_content->[0]->{id};
-#$i3->command('move before h')->recv;
-#$i3->command('move before v')->recv;
-#$i3->command('move after v')->recv;
-#$i3->command('move after h')->recv;
+#cmd 'move before h';
+#cmd 'move before v';
+#cmd 'move after v';
+#cmd 'move after h';
my $content = get_ws_content($tmp);
#is_deeply($old_content, $content, 'workspace unmodified after useless moves');
# 2) move a container before another single container
######################################################################
-$i3->command('open')->recv;
+cmd 'open';
$content = get_ws_content($tmp);
is(@{$content}, 2, 'two containers on this workspace');
my $second = $content->[1]->{id};
is($content->[0]->{id}, $first, 'first container unmodified');
# Move the second container before the first one (→ swap them)
-$i3->command('move left')->recv;
+cmd 'move left';
$content = get_ws_content($tmp);
is($content->[0]->{id}, $second, 'first container modified');
# We should not be able to move any further
-$i3->command('move left')->recv;
+cmd 'move left';
$content = get_ws_content($tmp);
is($content->[0]->{id}, $second, 'first container unmodified');
# Now move in the other direction
-$i3->command('move right')->recv;
+cmd 'move right';
$content = get_ws_content($tmp);
is($content->[0]->{id}, $first, 'first container modified');
# We should not be able to move any further
-$i3->command('move right')->recv;
+cmd 'move right';
$content = get_ws_content($tmp);
is($content->[0]->{id}, $first, 'first container unmodified');
# | first | ------ | third |
# | | | |
# --------------------------
-$i3->command('split v')->recv;
-$i3->command('level up')->recv;
-$i3->command('open')->recv;
+cmd 'split v';
+cmd 'level up';
+cmd 'open';
$content = get_ws_content($tmp);
is(@{$content}, 3, 'three containers on this workspace');
my $third = $content->[2]->{id};
-$i3->command('move left')->recv;
+cmd 'move left';
$content = get_ws_content($tmp);
is(@{$content}, 2, 'only two containers on this workspace');
my $nodes = $content->[1]->{nodes};
# move it inside the split container
######################################################################
-$i3->command('move up')->recv;
+cmd 'move up';
$nodes = get_ws_content($tmp)->[1]->{nodes};
is($nodes->[0]->{id}, $third, 'third container on top');
is($nodes->[1]->{id}, $second, 'second container on bottom');
# move it outside again
-$i3->command('move left')->recv;
+cmd 'move left';
$content = get_ws_content($tmp);
is(@{$content}, 3, 'three nodes on this workspace');
# due to automatic flattening/cleanup, the remaining split container
# will be replaced by the con itself, so we will still have 3 nodes
-$i3->command('move right')->recv;
+cmd 'move right';
$content = get_ws_content($tmp);
is(@{$content}, 2, 'two nodes on this workspace');
# container needs to be closed. Verify that it will be closed.
######################################################################
-my $otmp = get_unused_workspace();
-cmd "workspace $otmp";
+my $otmp = fresh_workspace;
-$i3->command("open")->recv;
-$i3->command("open")->recv;
-$i3->command("split v")->recv;
-$i3->command("open")->recv;
-$i3->command("prev h")->recv;
-$i3->command("split v")->recv;
-$i3->command("open")->recv;
-$i3->command("move right")->recv;
-$i3->command("prev h")->recv;
-$i3->command("move right")->recv;
+cmd "open";
+cmd "open";
+cmd "split v";
+cmd "open";
+cmd "prev h";
+cmd "split v";
+cmd "open";
+cmd "move right";
+cmd "prev h";
+cmd "move right";
$content = get_ws_content($otmp);
is(@{$content}, 1, 'only one nodes on this workspace');
-diag( "Testing i3, Perl $], $^X" );
+done_testing;
# Regression: closing of floating clients did crash i3 when closing the
# container which contained this client.
#
-use i3test tests => 1;
-use X11::XCB qw(:all);
+use i3test;
-my $tmp = get_unused_workspace();
-cmd "workspace $tmp";
+fresh_workspace;
cmd 'open';
cmd 'mode toggle';
does_i3_live;
-diag( "Testing i3, Perl $], $^X" );
+done_testing;
#
# Regression: make a container floating, kill its parent, make it tiling again
#
-use i3test tests => 4;
-use X11::XCB qw(:all);
+use i3test;
-my $i3 = i3("/tmp/nestedcons");
+my $tmp = fresh_workspace;
-my $tmp = get_unused_workspace();
-$i3->command("workspace $tmp")->recv;
-
-$i3->command('open')->recv;
+cmd 'open';
my $left = get_focused($tmp);
-$i3->command('open')->recv;
+cmd 'open';
my $old = get_focused($tmp);
-$i3->command('split v')->recv;
-$i3->command('open')->recv;
+cmd 'split v';
+cmd 'open';
my $floating = get_focused($tmp);
diag("focused floating: " . get_focused($tmp));
-$i3->command('mode toggle')->recv;
+cmd 'mode toggle';
# TODO: eliminate this race conditition
sleep 1;
# kill old container
-$i3->command(qq|[con_id="$old"] focus|)->recv;
+cmd qq|[con_id="$old"] focus|;
is(get_focused($tmp), $old, 'old container focused');
-$i3->command('kill')->recv;
+cmd 'kill';
# kill left container
-$i3->command(qq|[con_id="$left"] focus|)->recv;
+cmd qq|[con_id="$left"] focus|;
is(get_focused($tmp), $left, 'old container focused');
-$i3->command('kill')->recv;
+cmd 'kill';
# focus floating window, make it tiling again
-$i3->command(qq|[con_id="$floating"] focus|)->recv;
+cmd qq|[con_id="$floating"] focus|;
is(get_focused($tmp), $floating, 'floating window focused');
sleep 1;
-$i3->command('mode toggle')->recv;
+cmd 'mode toggle';
does_i3_live;
-diag( "Testing i3, Perl $], $^X" );
+done_testing;
# Check if new containers are opened after the currently focused one instead
# of always at the end
use List::Util qw(first);
-use i3test tests => 7;
+use i3test;
my $i3 = i3("/tmp/nestedcons");
-my $tmp = get_unused_workspace();
-$i3->command("workspace $tmp")->recv;
+my $tmp = fresh_workspace;
ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
# see if new containers open after the currently focused
##############################################################
-$i3->command(qq|[con_id="$first"] focus|)->recv;
-$i3->command('open')->recv;
+cmd qq|[con_id="$first"] focus|;
+cmd 'open';
$content = get_ws_content($tmp);
ok(@{$content} == 3, 'three containers opened');
isnt($content->[1]->{id}, $second, 'second container replaced');
is($content->[2]->{id}, $second, 'third container unmodified');
-diag( "Testing i3, Perl $], $^X" );
-#
-
+done_testing;
#
# Check if the focus is correctly restored after closing windows.
#
-use i3test tests => 9;
+use i3test;
use List::Util qw(first);
-use Time::HiRes qw(sleep);
my $i3 = i3("/tmp/nestedcons");
-my $tmp = get_unused_workspace();
-$i3->command("workspace $tmp")->recv;
+my $tmp = fresh_workspace;
ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
my $first = open_empty_con($i3);
my $second = open_empty_con($i3);
-$i3->command('split v')->recv;
+cmd 'split v';
my ($nodes, $focus) = get_ws_content($tmp);
is($nodes->[1]->{focused}, 0, 'split container not focused');
-$i3->command('level up')->recv;
+cmd 'level up';
($nodes, $focus) = get_ws_content($tmp);
is($nodes->[1]->{focused}, 1, 'split container focused after level up');
# when closing $second
##############################################################
-$i3->command('kill')->recv;
+cmd 'kill';
# TODO: this testcase sometimes has different outcomes when the
# sleep is missing. why?
sleep 0.25;
# another case, using a slightly different layout (regression)
##############################################################
-$tmp = get_unused_workspace();
-$i3->command("workspace $tmp")->recv;
+$tmp = fresh_workspace;
ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
-$i3->command('split v')->recv;
+cmd 'split v';
$first = open_empty_con($i3);
my $bottom = open_empty_con($i3);
-$i3->command('prev v')->recv;
-$i3->command('split h')->recv;
+cmd 'prev v';
+cmd 'split h';
my $middle = open_empty_con($i3);
my $right = open_empty_con($i3);
-$i3->command('next v')->recv;
+cmd 'next v';
# We have the following layout now (second is focused):
# .----------------------------.
# `----------------------------'
# Check if the focus is restored to $right when we close $second
-$i3->command('kill')->recv;
+cmd 'kill';
is(get_focused($tmp), $right, 'top right container focused (in focus stack)');
# TODO: add test code as soon as I can reproduce it
-diag( "Testing i3, Perl $], $^X" );
+done_testing;
#
# Check if empty split containers are automatically closed.
#
-use i3test tests => 8;
-use Time::HiRes qw(sleep);
+use i3test;
my $i3 = i3("/tmp/nestedcons");
-my $tmp = get_unused_workspace();
-$i3->command("workspace $tmp")->recv;
+my $tmp = fresh_workspace;
ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
my $first = open_empty_con($i3);
my $second = open_empty_con($i3);
-$i3->command(qq|[con_id="$first"] focus|)->recv;
+cmd qq|[con_id="$first"] focus|;
-$i3->command('split v')->recv;
+cmd 'split v';
($nodes, $focus) = get_ws_content($tmp);
is($nodes->[0]->{focused}, 0, 'split container not focused');
# focus the split container
-$i3->command('level up')->recv;
+cmd 'level up';
($nodes, $focus) = get_ws_content($tmp);
my $split = $focus->[0];
-$i3->command('level down')->recv;
+cmd 'level down';
my $second = open_empty_con($i3);
# close both windows and see if the split container still exists
##############################################################
-$i3->command('kill')->recv;
-$i3->command('kill')->recv;
+cmd 'kill';
+cmd 'kill';
($nodes, $focus) = get_ws_content($tmp);
isnt($nodes->[0]->{id}, $split, 'split container closed');
# of killing them
##############################################################
-$tmp = get_unused_workspace();
-$i3->command("workspace $tmp")->recv;
+$tmp = fresh_workspace;
ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
$first = open_empty_con($i3);
$second = open_empty_con($i3);
-$i3->command(qq|[con_id="$first"] focus|)->recv;
+cmd qq|[con_id="$first"] focus|;
-$i3->command('split v')->recv;
+cmd 'split v';
($nodes, $focus) = get_ws_content($tmp);
is($nodes->[0]->{focused}, 0, 'split container not focused');
# focus the split container
-$i3->command('level up')->recv;
+cmd 'level up';
($nodes, $focus) = get_ws_content($tmp);
my $split = $focus->[0];
-$i3->command('level down')->recv;
+cmd 'level down';
my $second = open_empty_con($i3);
##############################################################
my $otmp = get_unused_workspace();
-$i3->command("move workspace $otmp")->recv;
-$i3->command("move workspace $otmp")->recv;
+cmd "move workspace $otmp";
+cmd "move workspace $otmp";
($nodes, $focus) = get_ws_content($tmp);
isnt($nodes->[0]->{id}, $split, 'split container closed');
-diag( "Testing i3, Perl $], $^X" );
+done_testing;
# the split mode (horizontal/vertical) of the underlying
# container.
#
-use i3test tests => 7;
-use Time::HiRes qw(sleep);
+use i3test;
my $i3 = i3("/tmp/nestedcons");
-my $tmp = get_unused_workspace();
-$i3->command("workspace $tmp")->recv;
+my $tmp = fresh_workspace;
ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
# Enforce vertical split mode
-$i3->command('split v')->recv;
+cmd 'split v';
my $first = open_empty_con($i3);
my $second = open_empty_con($i3);
# change mode to stacking and cycle through the containers
##############################################################
-$i3->command('layout stacking')->recv;
+cmd 'layout stacking';
is(get_focused($tmp), $second, 'second container still focused');
-$i3->command('next v')->recv;
+cmd 'next v';
is(get_focused($tmp), $first, 'first container focused');
-$i3->command('prev v')->recv;
+cmd 'prev v';
is(get_focused($tmp), $second, 'second container focused again');
##############################################################
# now change the orientation to horizontal and cycle
##############################################################
-$i3->command('level up')->recv;
-$i3->command('split h')->recv;
-$i3->command('level down')->recv;
+cmd 'level up';
+cmd 'split h';
+cmd 'level down';
-$i3->command('next v')->recv;
+cmd 'next v';
is(get_focused($tmp), $first, 'first container focused');
-$i3->command('prev v')->recv;
+cmd 'prev v';
is(get_focused($tmp), $second, 'second container focused again');
-diag( "Testing i3, Perl $], $^X" );
+done_testing;
#
# Checks if the 'move workspace' command works correctly
#
-use i3test tests => 11;
-use Time::HiRes qw(sleep);
+use i3test;
my $i3 = i3("/tmp/nestedcons");
is(@{$ws->{nodes}}, 0, 'no nodes on workspace');
is(@{$ws->{floating_nodes}}, 1, 'one floating node on workspace');
-diag( "Testing i3, Perl $], $^X" );
+done_testing;
#
# Checks if size hints are interpreted correctly.
#
-use i3test tests => 2;
-use Time::HiRes qw(sleep);
+use i3test;
my $i3 = i3("/tmp/nestedcons");
my $x = X11::XCB::Connection->new;
-my $tmp = get_unused_workspace();
-$i3->command("workspace $tmp")->recv;
+my $tmp = fresh_workspace;
ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
diag("Aspect ratio = $ar");
ok(($ar > 1.90) && ($ar < 2.10), 'Aspect ratio about 2.0');
-diag( "Testing i3, Perl $], $^X" );
+done_testing;
#
#
#
-use i3test tests => 1;
+use i3test;
cmd 'blargh!';
does_i3_live;
-diag( "Testing i3, Perl $], $^X" );
+done_testing;
#!perl
# vim:ts=4:sw=4:expandtab
-use i3test tests => 9;
-use Time::HiRes qw(sleep);
+use i3test;
-my $i3 = i3("/tmp/nestedcons");
-
-my $tmp = get_unused_workspace();
-$i3->command("workspace $tmp")->recv;
+my $tmp = fresh_workspace;
#############################################################################
# 1: see if focus stays the same when toggling tiling/floating mode
#############################################################################
-$i3->command("open")->recv;
-$i3->command("open")->recv;
+cmd "open";
+cmd "open";
my @content = @{get_ws_content($tmp)};
cmp_ok(@content, '==', 2, 'two containers opened');
cmp_ok($content[1]->{focused}, '==', 1, 'Second container focused');
-$i3->command("mode floating")->recv;
-$i3->command("mode tiling")->recv;
+cmd "mode floating";
+cmd "mode tiling";
@content = @{get_ws_content($tmp)};
cmp_ok($content[1]->{focused}, '==', 1, 'Second container still focused after mode toggle');
# (first to the next floating client, then to the last focused tiling client)
#############################################################################
-$tmp = get_unused_workspace();
-$i3->command("workspace $tmp")->recv;
+$tmp = fresh_workspace;
-$i3->command("open")->recv;
-$i3->command("open")->recv;
-$i3->command("open")->recv;
+cmd "open";
+cmd "open";
+cmd "open";
@content = @{get_ws_content($tmp)};
cmp_ok(@content, '==', 3, 'two containers opened');
my $first_id = $content[0]->{id};
diag("last_id = $last_id, second_id = $second_id, first_id = $first_id");
-$i3->command(qq|[con_id="$second_id"] focus|)->recv;
+cmd qq|[con_id="$second_id"] focus|;
@content = @{get_ws_content($tmp)};
cmp_ok($content[1]->{focused}, '==', 1, 'Second container focused');
-$i3->command("mode floating")->recv;
+cmd "mode floating";
-$i3->command(qq|[con_id="$last_id"] focus|)->recv;
+cmd qq|[con_id="$last_id"] focus|;
@content = @{get_ws_content($tmp)};
cmp_ok($content[1]->{focused}, '==', 1, 'Last container focused');
-$i3->command("mode floating")->recv;
+cmd "mode floating";
diag("focused = " . get_focused($tmp));
-$i3->command("kill")->recv;
+cmd "kill";
diag("focused = " . get_focused($tmp));
# TODO: this test result is actually not right. the focus reverts to where the mouse pointer is.
cmp_ok(get_focused($tmp), '==', $second_id, 'Focus reverted to second floating container');
-$i3->command("kill")->recv;
+cmd "kill";
@content = @{get_ws_content($tmp)};
cmp_ok($content[0]->{focused}, '==', 1, 'Focus reverted to tiling container');
+
+done_testing;
# vim:ts=4:sw=4:expandtab
# Regression test: when only having a floating window on a workspace, it should not be deleted.
-use i3test tests => 6;
+use i3test;
use X11::XCB qw(:all);
-use Time::HiRes qw(sleep);
BEGIN {
use_ok('X11::XCB::Window');
my $i3 = i3("/tmp/nestedcons");
-my $tmp = get_unused_workspace();
-$i3->command("workspace $tmp")->recv;
+my $tmp = fresh_workspace;
#############################################################################
# 1: open a floating window, get it mapped
# switch to a different workspace, see if the window is still mapped?
-my $otmp = get_unused_workspace();
-$i3->command("workspace $otmp")->recv;
+my $otmp = fresh_workspace;
ok(workspace_exists($otmp), "new workspace $otmp exists");
ok(workspace_exists($tmp), "old workspace $tmp still exists");
+
+done_testing;
# Regression test: Floating windows were not correctly unmapped when switching
# to a different workspace.
-use i3test tests => 4;
+use i3test;
use X11::XCB qw(:all);
-use Time::HiRes qw(sleep);
BEGIN {
use_ok('X11::XCB::Window');
my $i3 = i3("/tmp/nestedcons");
-my $tmp = get_unused_workspace();
-$i3->command("workspace $tmp")->recv;
+my $tmp = fresh_workspace;
#############################################################################
# 1: open a floating window, get it mapped
# switch to a different workspace, see if the window is still mapped?
-my $otmp = get_unused_workspace();
-$i3->command("workspace $otmp")->recv;
+my $otmp = fresh_workspace;
sleep 0.25;
ok(!$window->mapped, 'Window is not mapped after switching ws');
-$i3->command("nop testcase done")->recv;
+cmd "nop testcase done";
+
+done_testing;
# Regression test: New windows were attached to the container of a floating window
# if only a floating window is present on the workspace.
-use i3test tests => 7;
+use i3test;
use X11::XCB qw(:all);
use Time::HiRes qw(sleep);
my $i3 = i3("/tmp/nestedcons");
-my $tmp = get_unused_workspace();
-$i3->command("workspace $tmp")->recv;
+my $tmp = fresh_workspace;
#############################################################################
# 1: open a floating window, get it mapped
($nodes, $focus) = get_ws_content($tmp);
is(@{$nodes}, 1, 'one tiling node');
+
+done_testing;
# vim:ts=4:sw=4:expandtab
# Check if numbered workspaces and named workspaces are sorted in the right way
# in get_workspaces IPC output (necessary for i3bar etc.).
-use i3test tests => 9;
+use i3test;
use X11::XCB qw(:all);
-use Time::HiRes qw(sleep);
BEGIN {
use_ok('X11::XCB::Window');
# open a window to keep this ws open
#############################################################################
-$i3->command("workspace 93")->recv;
+cmd "workspace 93";
open_standard_window($x);
is(@f, 1, 'ws 93 found by num');
check_order('workspace order alright after opening 93');
-$i3->command("workspace 92")->recv;
+cmd "workspace 92";
open_standard_window($x);
check_order('workspace order alright after opening 92');
-$i3->command("workspace 94")->recv;
+cmd "workspace 94";
open_standard_window($x);
check_order('workspace order alright after opening 94');
-$i3->command("workspace 96")->recv;
+cmd "workspace 96";
open_standard_window($x);
check_order('workspace order alright after opening 96');
-$i3->command("workspace foo")->recv;
+cmd "workspace foo";
open_standard_window($x);
check_order('workspace order alright after opening foo');
-$i3->command("workspace 91")->recv;
+cmd "workspace 91";
open_standard_window($x);
check_order('workspace order alright after opening 91');
+
+done_testing;
# vim:ts=4:sw=4:expandtab
# Regression: Check if the focus stays the same when switching the layout
# bug introduced by 77d0d42ed2d7ac8cafe267c92b35a81c1b9491eb
-use i3test tests => 4;
+use i3test;
use X11::XCB qw(:all);
use Time::HiRes qw(sleep);
cmp_deeply(\@nums, \@sorted, $msg);
}
-my $tmp = get_unused_workspace();
-$i3->command("workspace $tmp")->recv;
+my $tmp = fresh_workspace;
my $left = open_standard_window($x);
sleep 0.25;
is($x->input_focus, $right->id, 'Right window focused');
-$i3->command('prev h')->recv;
+cmd 'prev h';
is($x->input_focus, $mid->id, 'Mid window focused');
-$i3->command('layout stacked')->recv;
+cmd 'layout stacked';
is($x->input_focus, $mid->id, 'Mid window focused');
+
+done_testing;
#!perl
# vim:ts=4:sw=4:expandtab
# Tests resizing tiling containers
-use i3test tests => 6;
+use i3test;
use X11::XCB qw(:all);
-use Time::HiRes qw(sleep);
BEGIN {
use_ok('X11::XCB::Window');
my $x = X11::XCB::Connection->new;
-my $tmp = get_unused_workspace();
-cmd "workspace $tmp";
+my $tmp = fresh_workspace;
cmd 'split v';
is($nodes->[0]->{percent}, 0.25, 'top window got only 25%');
is($nodes->[1]->{percent}, 0.75, 'bottom window got 75%');
+
+done_testing;
#
# Regression: move a floating window to a different workspace crashes i3
#
-use i3test tests => 1;
-use X11::XCB qw(:all);
+use i3test;
-my $tmp = get_unused_workspace();
+my $tmp = fresh_workspace;
my $otmp = get_unused_workspace();
-cmd "workspace $tmp";
cmd 'open';
cmd 'mode toggle';
cmd "move workspace $otmp";
does_i3_live;
+
+done_testing;
#
# Regression: floating windows are tiling after restarting, closing them crashes i3
#
-use i3test tests => 1;
-use Time::HiRes qw(sleep);
-use X11::XCB qw(:all);
+use i3test;
-my $tmp = get_unused_workspace();
-cmd "workspace $tmp";
+my $tmp = fresh_workspace;
cmd 'open';
cmd 'mode toggle';
my $ws = get_ws($tmp);
diag('ws = ' . Dumper($ws));
+
+done_testing;
# workspace as if a tiling container was closed, leading to the containers
# taking much more space than they possibly could.
#
-use i3test tests => 1;
-use X11::XCB qw(:all);
-use Time::HiRes qw(sleep);
+use i3test;
use List::Util qw(sum);
-my $tmp = get_unused_workspace();
-cmd "workspace $tmp";
+my $tmp = fresh_workspace;
cmd 'exec /usr/bin/urxvt';
sleep 0.5;
my $new_sum = sum map { $_->{rect}->{width} } @{$nodes};
is($old_sum, $new_sum, 'combined container width is still equal');
+
+done_testing;
# This testcase checks that the tree is properly flattened after moving.
#
use X11::XCB qw(:all);
-use i3test tests => 2;
+use i3test;
my $x = X11::XCB::Connection->new;
-my $tmp = get_unused_workspace;
-cmd "workspace $tmp";
+my $tmp = fresh_workspace;
my $left = open_standard_window($x);
sleep 0.25;
is($ws->{orientation}, 'horizontal', 'workspace orientation is horizontal');
is(@{$ws->{nodes}}, 3, 'all three windows on workspace level');
+
+done_testing;
#
use X11::XCB qw(:all);
use Time::HiRes qw(sleep);
-use i3test tests => 5;
+use i3test;
BEGIN {
use_ok('X11::XCB::Window');
my $x = X11::XCB::Connection->new;
-my $tmp = get_unused_workspace;
-cmd "workspace $tmp";
+my $tmp = fresh_workspace;
my $left = open_standard_window($x);
sleep 0.25;
my ($nodes, $focus) = get_ws_content($tmp);
is(@{$nodes->[1]->{nodes}}, 3, 'three windows in split con after mode toggle');
+
+done_testing;
#
use X11::XCB qw(:all);
use Time::HiRes qw(sleep);
-use i3test tests => 3;
+use i3test;
BEGIN {
use_ok('X11::XCB::Window');
my $x = X11::XCB::Connection->new;
-my $tmp = get_unused_workspace;
-cmd "workspace $tmp";
+my $tmp = fresh_workspace;
my $left = open_standard_window($x);
sleep 0.25;
sleep 0.25;
does_i3_live;
+
+done_testing;
# another workspace.
#
use X11::XCB qw(:all);
-use Time::HiRes qw(sleep);
-use i3test tests => 2;
+use i3test;
BEGIN {
use_ok('X11::XCB::Window');
my $x = X11::XCB::Connection->new;
-my $tmp = get_unused_workspace;
-cmd "workspace $tmp";
+my $tmp = fresh_workspace;
# open a tiling window on the first workspace
open_standard_window($x);
my $first = get_focused($tmp);
# on a different ws, open a floating window
-my $otmp = get_unused_workspace;
-cmd "workspace $otmp";
+my $otmp = fresh_workspace;
open_standard_window($x);
sleep 0.25;
my $float = get_focused($otmp);
# switch to the first ws and check focus
is(get_focused($tmp), $float, 'floating client correctly focused');
+
+done_testing;
# Regression test for inplace restarting with dock clients
#
use X11::XCB qw(:all);
-use Time::HiRes qw(sleep);
use i3test;
BEGIN {
my $x = X11::XCB::Connection->new;
my $i3 = i3("/tmp/nestedcons");
-my $tmp = get_unused_workspace;
-cmd "workspace $tmp";
+my $tmp = fresh_workspace;
#####################################################################
# verify that there is no dock window yet
#
# Regression test for setting a window to floating, tiling and opening a new window
#
-use Time::HiRes qw(sleep);
use i3test;
-my $tmp = get_unused_workspace;
-cmd "workspace $tmp";
-
+fresh_workspace;
cmd 'open';
cmd 'mode toggle';
# Regression test for using level-up to get to the 'content'-container and
# toggle floating
#
-use Time::HiRes qw(sleep);
use i3test;
-my $tmp = get_unused_workspace;
-cmd "workspace $tmp";
-
+fresh_workspace;
cmd 'open';
cmd 'level up';
#
# Test if the requested width/height is set after making the window floating.
#
-use Time::HiRes qw(sleep);
use X11::XCB qw(:all);
use i3test;
-my $tmp = get_unused_workspace;
-cmd "workspace $tmp";
+my $tmp = fresh_workspace;
my $x = X11::XCB::Connection->new;
# Regression test for closing one of multiple dock clients
#
use X11::XCB qw(:all);
-use Time::HiRes qw(sleep);
use i3test;
BEGIN {
my $x = X11::XCB::Connection->new;
my $i3 = i3("/tmp/nestedcons");
-my $tmp = get_unused_workspace;
-cmd "workspace $tmp";
+my $tmp = fresh_workspace;
#####################################################################
# verify that there is no dock window yet
# when setting the split container to floating
#
use X11::XCB qw(:all);
-use Time::HiRes qw(sleep);
use i3test;
BEGIN {
my $x = X11::XCB::Connection->new;
my $i3 = i3("/tmp/nestedcons");
-my $tmp = get_unused_workspace;
-cmd "workspace $tmp";
+my $tmp = fresh_workspace;
#####################################################################
# open a window with 200x80
# the time of launching the new one.
#
use X11::XCB qw(:all);
-use Time::HiRes qw(sleep);
use i3test;
BEGIN {
my $x = X11::XCB::Connection->new;
my $i3 = i3("/tmp/nestedcons");
-my $tmp = get_unused_workspace;
-cmd "workspace $tmp";
+my $tmp = fresh_workspace;
#####################################################################
# open the left window
# Regression test: level up should be a noop during fullscreen mode
#
use X11::XCB qw(:all);
-use Time::HiRes qw(sleep);
use i3test;
BEGIN {
my $x = X11::XCB::Connection->new;
my $i3 = i3("/tmp/nestedcons");
-my $tmp = get_unused_workspace;
-cmd "workspace $tmp";
+my $tmp = fresh_workspace;
#####################################################################
# open a window, verify it’s not in fullscreen mode
use v5.10;
use Exporter ();
-our @EXPORT = qw(get_workspace_names get_unused_workspace get_ws_content get_ws get_focused open_empty_con open_standard_window get_dock_clients cmd does_i3_live);
+our @EXPORT = qw(get_workspace_names get_unused_workspace fresh_workspace get_ws_content get_ws get_focused open_empty_con open_standard_window get_dock_clients cmd does_i3_live);
my $tester = Test::Builder->new();
$tmp
}
+sub fresh_workspace {
+ my $unused = get_unused_workspace;
+ cmd("workspace $unused");
+ $unused
+}
+
sub get_ws {
my ($name) = @_;
my $i3 = i3("/tmp/nestedcons");