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