Merge branch 'testsuite' into next

This commit is contained in:
Michael Stapelberg 2011-11-23 00:04:53 +00:00
commit d0d804ba69
40 changed files with 99 additions and 142 deletions

1
.gitignore vendored
View File

@ -7,6 +7,7 @@ loglevels.tmp
*.gcno *.gcno
testcases/testsuite-* testcases/testsuite-*
testcases/latest testcases/latest
testcases/Makefile
*.output *.output
*.tab.* *.tab.*
*.yy.c *.yy.c

View File

@ -10,10 +10,7 @@ WriteMakefile(
'AnyEvent' => 0, 'AnyEvent' => 0,
'AnyEvent::I3' => '0.09', 'AnyEvent::I3' => '0.09',
'X11::XCB' => '0.03', 'X11::XCB' => '0.03',
'Test::Most' => 0, 'Inline' => 0,
'Test::Deep' => 0,
'EV' => 0,
'Inline' => 0,
}, },
PM => {}, # do not install any files from this directory PM => {}, # do not install any files from this directory
clean => { clean => {

View File

@ -8,7 +8,6 @@ use X11::XCB::Rect;
use X11::XCB::Window; use X11::XCB::Window;
use X11::XCB qw(:all); use X11::XCB qw(:all);
use AnyEvent::I3; use AnyEvent::I3;
use EV;
use List::Util qw(first); use List::Util qw(first);
use Time::HiRes qw(sleep); use Time::HiRes qw(sleep);
use Cwd qw(abs_path); use Cwd qw(abs_path);
@ -61,15 +60,14 @@ sub import {
my $class = shift; my $class = shift;
my $pkg = caller; my $pkg = caller;
my $test_most_args = @_ ? "qw(@_)" : ""; my $test_more_args = @_ ? "qw(@_)" : "";
local $@; local $@;
eval << "__"; eval << "__";
package $pkg; package $pkg;
use Test::Most $test_most_args; use Test::More $test_more_args;
use Data::Dumper; use Data::Dumper;
use AnyEvent::I3; use AnyEvent::I3;
use Time::HiRes qw(sleep); use Time::HiRes qw(sleep);
use Test::Deep qw(eq_deeply cmp_deeply);
__ __
$tester->bail_out("$@") if $@; $tester->bail_out("$@") if $@;
feature->import(":5.10"); feature->import(":5.10");
@ -95,11 +93,12 @@ sub wait_for_event {
my $cv = AE::cv; my $cv = AE::cv;
my $prep = EV::prepare sub { $x->flush;
$x->flush;
};
my $check = EV::check sub { # unfortunately, there is no constant for this
my $ae_read = 0;
my $guard = AE::io $x->get_file_descriptor, $ae_read, sub {
while (defined(my $event = $x->poll_for_event)) { while (defined(my $event = $x->poll_for_event)) {
if ($cb->($event)) { if ($cb->($event)) {
$cv->send(1); $cv->send(1);
@ -108,15 +107,12 @@ sub wait_for_event {
} }
}; };
my $watcher = EV::io $x->get_file_descriptor, EV::READ, sub {
# do nothing, we only need this watcher so that EV picks up the events
};
# Trigger timeout after $timeout seconds (can be fractional) # Trigger timeout after $timeout seconds (can be fractional)
my $t = AE::timer $timeout, 0, sub { warn "timeout ($timeout secs)"; $cv->send(0) }; my $t = AE::timer $timeout, 0, sub { warn "timeout ($timeout secs)"; $cv->send(0) };
my $result = $cv->recv; my $result = $cv->recv;
undef $t; undef $t;
undef $guard;
return $result; return $result;
} }
@ -139,7 +135,7 @@ sub wait_for_unmap {
wait_for_event 2, sub { wait_for_event 2, sub {
$_[0]->{response_type} == UNMAP_NOTIFY # and $_[0]->{window} == $id $_[0]->{response_type} == UNMAP_NOTIFY # and $_[0]->{window} == $id
}; };
sync_with_i3($x); sync_with_i3();
} }
# #
@ -173,15 +169,13 @@ sub open_window {
$window->map; $window->map;
wait_for_map($window); wait_for_map($window);
# We sync with i3 here to make sure $x->input_focus is updated.
sync_with_i3($x);
return $window; return $window;
} }
# Thin wrapper around open_window which sets window_type to # Thin wrapper around open_window which sets window_type to
# _NET_WM_WINDOW_TYPE_UTILITY to make the window floating. # _NET_WM_WINDOW_TYPE_UTILITY to make the window floating.
sub open_floating_window { sub open_floating_window {
my ($x, $args) = @_; my ($args) = @_;
my %args = ($args ? %$args : ()); my %args = ($args ? %$args : ());
$args{window_type} = $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY'); $args{window_type} = $x->atom(name => '_NET_WM_WINDOW_TYPE_UTILITY');
@ -325,8 +319,6 @@ sub focused_ws {
# See also docs/testsuite for a long explanation # See also docs/testsuite for a long explanation
# #
sub sync_with_i3 { sub sync_with_i3 {
my ($x) = @_;
# Since we need a (mapped) window for receiving a ClientMessage, we create # Since we need a (mapped) window for receiving a ClientMessage, we create
# one on the first call of sync_with_i3. It will be re-used in all # one on the first call of sync_with_i3. It will be re-used in all
# subsequent calls. # subsequent calls.
@ -470,7 +462,7 @@ use parent 'X11::XCB::Connection';
sub input_focus { sub input_focus {
my $self = shift; my $self = shift;
i3test::sync_with_i3($self); i3test::sync_with_i3();
return $self->SUPER::input_focus(@_); return $self->SUPER::input_focus(@_);
} }

View File

@ -21,6 +21,6 @@ $window->map;
sleep(0.25); 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_hash($new_rect, $original_rect), "Window got repositioned");
done_testing; done_testing;

View File

@ -5,7 +5,7 @@
# #
use i3test; use i3test;
my $result = sync_with_i3($x); my $result = sync_with_i3;
ok($result, 'syncing was successful'); ok($result, 'syncing was successful');
done_testing; done_testing;

View File

@ -17,7 +17,7 @@ my $focus = $x->input_focus;
# Switch to another workspace # Switch to another workspace
fresh_workspace; fresh_workspace;
sync_with_i3($x); sync_with_i3;
my $new_focus = $x->input_focus; my $new_focus = $x->input_focus;
isnt($focus, $new_focus, "Focus changed"); isnt($focus, $new_focus, "Focus changed");

View File

@ -76,7 +76,7 @@ $window->map;
wait_for_map $window; wait_for_map $window;
cmd 'floating enable'; cmd 'floating enable';
sync_with_i3($x); sync_with_i3;
($absolute, $top) = $window->rect; ($absolute, $top) = $window->rect;

View File

@ -51,15 +51,15 @@ wait_for_map $window;
cmd 'open'; cmd 'open';
my $new_rect = $window->rect; my $new_rect = $window->rect;
ok(!eq_deeply($new_rect, $original_rect), "Window got repositioned"); ok(!eq_hash($new_rect, $original_rect), "Window got repositioned");
$original_rect = $new_rect; $original_rect = $new_rect;
$window->fullscreen(1); $window->fullscreen(1);
sync_with_i3($x); sync_with_i3;
$new_rect = $window->rect; $new_rect = $window->rect;
ok(!eq_deeply($new_rect, $original_rect), "Window got repositioned after fullscreen"); ok(!eq_hash($new_rect, $original_rect), "Window got repositioned after fullscreen");
my $orect = $output->{rect}; my $orect = $output->{rect};
my $wrect = $new_rect; my $wrect = $new_rect;
@ -98,7 +98,7 @@ $window->map;
wait_for_map $window; wait_for_map $window;
$new_rect = $window->rect; $new_rect = $window->rect;
ok(!eq_deeply($new_rect, $original_rect), "Window got repositioned after fullscreen"); ok(!eq_hash($new_rect, $original_rect), "Window got repositioned after fullscreen");
ok($window->mapped, "Window is mapped after opening it in fullscreen mode"); ok($window->mapped, "Window is mapped after opening it in fullscreen mode");
$wrect = $new_rect; $wrect = $new_rect;
@ -123,20 +123,20 @@ my $swindow = $x->root->create_child(
$swindow->map; $swindow->map;
sync_with_i3($x); sync_with_i3;
ok(!$swindow->mapped, 'window not mapped while fullscreen window active'); ok(!$swindow->mapped, 'window not mapped while fullscreen window active');
$new_rect = $swindow->rect; $new_rect = $swindow->rect;
ok(!eq_deeply($new_rect, $original_rect), "Window got repositioned"); ok(!eq_hash($new_rect, $original_rect), "Window got repositioned");
$swindow->fullscreen(1); $swindow->fullscreen(1);
sync_with_i3($x); sync_with_i3;
is(fullscreen_windows(), 1, 'amount of fullscreen windows'); is(fullscreen_windows(), 1, 'amount of fullscreen windows');
$window->fullscreen(0); $window->fullscreen(0);
sync_with_i3($x); sync_with_i3;
is(fullscreen_windows(), 0, 'amount of fullscreen windows'); is(fullscreen_windows(), 0, 'amount of fullscreen windows');
ok($swindow->mapped, 'window mapped after other fullscreen ended'); ok($swindow->mapped, 'window mapped after other fullscreen ended');
@ -148,7 +148,7 @@ ok($swindow->mapped, 'window mapped after other fullscreen ended');
########################################################################### ###########################################################################
$swindow->fullscreen(0); $swindow->fullscreen(0);
sync_with_i3($x); sync_with_i3;
is(fullscreen_windows(), 0, 'amount of fullscreen windows after disabling'); is(fullscreen_windows(), 0, 'amount of fullscreen windows after disabling');

View File

@ -25,7 +25,6 @@ sub focus_after {
my $msg = shift; my $msg = shift;
cmd $msg; cmd $msg;
sync_with_i3 $x;
return $x->input_focus; return $x->input_focus;
} }

View File

@ -52,7 +52,7 @@ is($docknode->{rect}->{height}, 30, 'dock node has unchanged height');
$window->rect(X11::XCB::Rect->new(x => 0, y => 0, width => 50, height => 40)); $window->rect(X11::XCB::Rect->new(x => 0, y => 0, width => 50, height => 40));
sync_with_i3 $x; sync_with_i3;
@docked = get_dock_clients('top'); @docked = get_dock_clients('top');
is(@docked, 1, 'one dock client found'); is(@docked, 1, 'one dock client found');

View File

@ -15,7 +15,7 @@ my $tiled_right = open_window;
my $focus = $x->input_focus; my $focus = $x->input_focus;
# Create a floating window which is smaller than the minimum enforced size of i3 # Create a floating window which is smaller than the minimum enforced size of i3
my $window = open_floating_window($x); my $window = open_floating_window;
is($x->input_focus, $window->id, 'floating window focused'); is($x->input_focus, $window->id, 'floating window focused');

View File

@ -24,7 +24,6 @@ sub focus_after {
my $msg = shift; my $msg = shift;
cmd $msg; cmd $msg;
sync_with_i3($x);
return $x->input_focus; return $x->input_focus;
} }

View File

@ -9,13 +9,13 @@ fresh_workspace;
# Create a floating window and see if resizing works # Create a floating window and see if resizing works
##################################################################### #####################################################################
my $window = open_floating_window($x); my $window = open_floating_window;
# See if configurerequests cause window movements (they should not) # See if configurerequests cause window movements (they should not)
my ($a, $t) = $window->rect; my ($a, $t) = $window->rect;
$window->rect(X11::XCB::Rect->new(x => $a->x, y => $a->y, width => $a->width, height => $a->height)); $window->rect(X11::XCB::Rect->new(x => $a->x, y => $a->y, width => $a->width, height => $a->height));
sync_with_i3($x); sync_with_i3;
my ($na, $nt) = $window->rect; my ($na, $nt) = $window->rect;
is_deeply($na, $a, 'Rects are equal after configurerequest'); is_deeply($na, $a, 'Rects are equal after configurerequest');
@ -23,7 +23,7 @@ is_deeply($na, $a, 'Rects are equal after configurerequest');
sub test_resize { sub test_resize {
$window->rect(X11::XCB::Rect->new(x => 0, y => 0, width => 100, height => 100)); $window->rect(X11::XCB::Rect->new(x => 0, y => 0, width => 100, height => 100));
sync_with_i3($x); sync_with_i3;
my ($absolute, $top) = $window->rect; my ($absolute, $top) = $window->rect;
@ -34,7 +34,7 @@ sub test_resize {
$window->rect(X11::XCB::Rect->new(x => 0, y => 0, width => 300, height => 500)); $window->rect(X11::XCB::Rect->new(x => 0, y => 0, width => 300, height => 500));
sync_with_i3($x); sync_with_i3;
($absolute, $top) = $window->rect; ($absolute, $top) = $window->rect;

View File

@ -24,7 +24,7 @@ is(@urgent, 0, 'no window got the urgent flag');
# Add the urgency hint, switch to a different workspace and back again # Add the urgency hint, switch to a different workspace and back again
##################################################################### #####################################################################
$top->add_hint('urgency'); $top->add_hint('urgency');
sync_with_i3($x); sync_with_i3;
my @content = @{get_ws_content($tmp)}; my @content = @{get_ws_content($tmp)};
@urgent = grep { $_->{urgent} } @content; @urgent = grep { $_->{urgent} } @content;
@ -41,7 +41,7 @@ cmd '[id="' . $top->id . '"] focus';
is(@urgent, 0, 'no window got the urgent flag after focusing'); is(@urgent, 0, 'no window got the urgent flag after focusing');
$top->add_hint('urgency'); $top->add_hint('urgency');
sync_with_i3($x); sync_with_i3;
@urgent = grep { $_->{urgent} } @{get_ws_content($tmp)}; @urgent = grep { $_->{urgent} } @{get_ws_content($tmp)};
is(@urgent, 0, 'no window got the urgent flag after re-setting urgency hint'); is(@urgent, 0, 'no window got the urgent flag after re-setting urgency hint');
@ -55,7 +55,7 @@ ok(!$ws->{urgent}, 'urgent flag not set on workspace');
my $otmp = fresh_workspace; my $otmp = fresh_workspace;
$top->add_hint('urgency'); $top->add_hint('urgency');
sync_with_i3($x); sync_with_i3;
$ws = get_ws($tmp); $ws = get_ws($tmp);
ok($ws->{urgent}, 'urgent flag set on workspace'); ok($ws->{urgent}, 'urgent flag set on workspace');

View File

@ -18,7 +18,7 @@ my $right = open_window({ name => 'Right' });
my ($abs, $rgeom) = $right->rect; my ($abs, $rgeom) = $right->rect;
my $child = open_floating_window($x, { my $child = open_floating_window({
dont_map => 1, dont_map => 1,
name => 'Child window', name => 'Child window',
}); });
@ -31,7 +31,7 @@ my $cgeom;
($abs, $cgeom) = $child->rect; ($abs, $cgeom) = $child->rect;
cmp_ok($cgeom->x, '>=', $rgeom->x, 'Child X >= right container X'); cmp_ok($cgeom->x, '>=', $rgeom->x, 'Child X >= right container X');
my $child2 = open_floating_window($x, { my $child2 = open_floating_window({
dont_map => 1, dont_map => 1,
name => 'Child window 2', name => 'Child window 2',
}); });

View File

@ -29,28 +29,44 @@ my $i3 = i3(get_socket_path());
my $tree = $i3->get_tree->recv; my $tree = $i3->get_tree->recv;
# a unique value
my $ignore = \"";
my $expected = { my $expected = {
fullscreen_mode => 0, fullscreen_mode => 0,
nodes => ignore(), nodes => $ignore,
window => undef, window => undef,
name => 'root', name => 'root',
orientation => ignore(), orientation => $ignore,
type => 0, type => 0,
id => ignore(), id => $ignore,
rect => ignore(), rect => $ignore,
window_rect => ignore(), window_rect => $ignore,
geometry => ignore(), geometry => $ignore,
swallows => ignore(), swallows => $ignore,
percent => undef, percent => undef,
layout => 'default', layout => 'default',
focus => ignore(), focus => $ignore,
focused => JSON::XS::false, focused => JSON::XS::false,
urgent => JSON::XS::false, urgent => JSON::XS::false,
border => 'normal', border => 'normal',
'floating_nodes' => ignore(), 'floating_nodes' => $ignore,
}; };
cmp_deeply($tree, $expected, 'root node OK'); # a shallow copy is sufficient, since we only ignore values at the root
my $tree_copy = { %$tree };
for (keys %$expected) {
my $val = $expected->{$_};
# delete unwanted keys, so we can use is_deeply()
if (ref($val) eq 'SCALAR' and $val == $ignore) {
delete $tree_copy->{$_};
delete $expected->{$_};
}
}
is_deeply($tree_copy, $expected, 'root node OK');
my @nodes = @{$tree->{nodes}}; my @nodes = @{$tree->{nodes}};

View File

@ -101,7 +101,7 @@ ok(@{$content} == 2, 'two windows opened');
cmd '[class="special" title="left"] kill'; cmd '[class="special" title="left"] kill';
sync_with_i3($x); sync_with_i3;
$content = get_ws_content($tmp); $content = get_ws_content($tmp);
is(@{$content}, 1, 'one window still there'); is(@{$content}, 1, 'one window still there');

View File

@ -136,7 +136,7 @@ is(@{$content}, 1, 'only one nodes on this workspace');
###################################################################### ######################################################################
$tmp = fresh_workspace; $tmp = fresh_workspace;
my $floatwin = open_floating_window($x); my $floatwin = open_floating_window;
my ($absolute_before, $top_before) = $floatwin->rect; my ($absolute_before, $top_before) = $floatwin->rect;
cmd 'move left'; cmd 'move left';

View File

@ -23,7 +23,7 @@ wait_for_map $win;
$win->hints->aspect($aspect); $win->hints->aspect($aspect);
$x->flush; $x->flush;
sync_with_i3($x); sync_with_i3;
my $rect = $win->rect; my $rect = $win->rect;
my $ar = $rect->width / $rect->height; my $ar = $rect->width / $rect->height;

View File

@ -36,8 +36,6 @@ cmd 'floating enable';
cmd '[id="' . $second->id . '"] focus'; cmd '[id="' . $second->id . '"] focus';
sync_with_i3($x);
is($x->input_focus, $second->id, 'second con focused'); is($x->input_focus, $second->id, 'second con focused');
cmd 'floating enable'; cmd 'floating enable';
@ -67,8 +65,6 @@ cmd 'floating enable';
cmd '[id="' . $second->id . '"] focus'; cmd '[id="' . $second->id . '"] focus';
sync_with_i3($x);
is($x->input_focus, $second->id, 'second con focused'); is($x->input_focus, $second->id, 'second con focused');
cmd 'floating enable'; cmd 'floating enable';
@ -103,13 +99,11 @@ cmd 'floating enable';
cmd '[id="' . $second->id . '"] focus'; cmd '[id="' . $second->id . '"] focus';
sync_with_i3($x);
is($x->input_focus, $second->id, 'second con focused'); is($x->input_focus, $second->id, 'second con focused');
cmd 'floating enable'; cmd 'floating enable';
sync_with_i3($x); sync_with_i3;
# now kill the second one. focus should fall back to the third one, which is # now kill the second one. focus should fall back to the third one, which is
# also floating # also floating
@ -132,8 +126,6 @@ $tmp = fresh_workspace;
$first = open_window({ background_color => '#ff0000' }); # window 8 $first = open_window({ background_color => '#ff0000' }); # window 8
$second = open_window({ background_color => '#00ff00' }); # window 9 $second = open_window({ background_color => '#00ff00' }); # window 9
sync_with_i3($x);
is($x->input_focus, $second->id, 'second container focused'); is($x->input_focus, $second->id, 'second container focused');
cmd 'floating enable'; cmd 'floating enable';
@ -142,32 +134,22 @@ is($x->input_focus, $second->id, 'second container focused');
cmd 'focus tiling'; cmd 'focus tiling';
sync_with_i3($x);
is($x->input_focus, $first->id, 'first (tiling) container focused'); is($x->input_focus, $first->id, 'first (tiling) container focused');
cmd 'focus floating'; cmd 'focus floating';
sync_with_i3($x);
is($x->input_focus, $second->id, 'second (floating) container focused'); is($x->input_focus, $second->id, 'second (floating) container focused');
cmd 'focus floating'; cmd 'focus floating';
sync_with_i3($x);
is($x->input_focus, $second->id, 'second (floating) container still focused'); is($x->input_focus, $second->id, 'second (floating) container still focused');
cmd 'focus mode_toggle'; cmd 'focus mode_toggle';
sync_with_i3($x);
is($x->input_focus, $first->id, 'first (tiling) container focused'); is($x->input_focus, $first->id, 'first (tiling) container focused');
cmd 'focus mode_toggle'; cmd 'focus mode_toggle';
sync_with_i3($x);
is($x->input_focus, $second->id, 'second (floating) container focused'); is($x->input_focus, $second->id, 'second (floating) container focused');
############################################################################# #############################################################################
@ -176,42 +158,30 @@ is($x->input_focus, $second->id, 'second (floating) container focused');
$tmp = fresh_workspace; $tmp = fresh_workspace;
$first = open_floating_window($x, { background_color => '#ff0000' });# window 10 $first = open_floating_window({ background_color => '#ff0000' });# window 10
$second = open_floating_window($x, { background_color => '#00ff00' }); # window 11 $second = open_floating_window({ background_color => '#00ff00' }); # window 11
$third = open_floating_window($x, { background_color => '#0000ff' }); # window 12 $third = open_floating_window({ background_color => '#0000ff' }); # window 12
sync_with_i3($x);
is($x->input_focus, $third->id, 'third container focused'); is($x->input_focus, $third->id, 'third container focused');
cmd 'focus left'; cmd 'focus left';
sync_with_i3($x);
is($x->input_focus, $second->id, 'second container focused'); is($x->input_focus, $second->id, 'second container focused');
cmd 'focus left'; cmd 'focus left';
sync_with_i3($x);
is($x->input_focus, $first->id, 'first container focused'); is($x->input_focus, $first->id, 'first container focused');
cmd 'focus left'; cmd 'focus left';
sync_with_i3($x);
is($x->input_focus, $third->id, 'focus wrapped to third container'); is($x->input_focus, $third->id, 'focus wrapped to third container');
cmd 'focus right'; cmd 'focus right';
sync_with_i3($x);
is($x->input_focus, $first->id, 'focus wrapped to first container'); is($x->input_focus, $first->id, 'focus wrapped to first container');
cmd 'focus right'; cmd 'focus right';
sync_with_i3($x);
is($x->input_focus, $second->id, 'focus on second container'); is($x->input_focus, $second->id, 'focus on second container');
done_testing; done_testing;

View File

@ -15,7 +15,7 @@ my $tmp = fresh_workspace;
ok(workspace_exists($tmp), "workspace $tmp exists"); ok(workspace_exists($tmp), "workspace $tmp exists");
# Create a floating window which is smaller than the minimum enforced size of i3 # Create a floating window which is smaller than the minimum enforced size of i3
my $window = open_floating_window($x); my $window = open_floating_window;
ok($window->mapped, 'Window is mapped'); 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?

View File

@ -14,14 +14,14 @@ my $tmp = fresh_workspace;
############################################################################# #############################################################################
# Create a floating window which is smaller than the minimum enforced size of i3 # Create a floating window which is smaller than the minimum enforced size of i3
my $window = open_floating_window($x); my $window = open_floating_window;
ok($window->mapped, 'Window is mapped'); 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 = fresh_workspace; my $otmp = fresh_workspace;
sync_with_i3($x); sync_with_i3;
ok(!$window->mapped, 'Window is not mapped after switching ws'); ok(!$window->mapped, 'Window is not mapped after switching ws');

View File

@ -14,7 +14,7 @@ my $tmp = fresh_workspace;
############################################################################# #############################################################################
# Create a floating window # Create a floating window
my $window = open_floating_window($x); my $window = open_floating_window;
ok($window->mapped, 'Window is mapped'); ok($window->mapped, 'Window is mapped');
my $ws = get_ws($tmp); my $ws = get_ws($tmp);
@ -47,7 +47,7 @@ is(@{$ws->{floating_nodes}}, 0, 'no floating nodes so far');
is(@{$ws->{nodes}}, 1, 'one tiling node (stacked con)'); is(@{$ws->{nodes}}, 1, 'one tiling node (stacked con)');
# Create a floating window # Create a floating window
$window = open_floating_window($x); $window = open_floating_window;
ok($window->mapped, 'Window is mapped'); ok($window->mapped, 'Window is mapped');
$ws = get_ws($tmp); $ws = get_ws($tmp);

View File

@ -13,7 +13,7 @@ sub check_order {
my @nums = map { $_->{num} } grep { defined($_->{num}) } @ws; my @nums = map { $_->{num} } grep { defined($_->{num}) } @ws;
my @sorted = sort @nums; my @sorted = sort @nums;
cmp_deeply(\@nums, \@sorted, $msg); is_deeply(\@nums, \@sorted, $msg);
} }
check_order('workspace order alright before testing'); check_order('workspace order alright before testing');

View File

@ -13,7 +13,7 @@ sub check_order {
my @nums = map { $_->{num} } grep { defined($_->{num}) } @ws; my @nums = map { $_->{num} } grep { defined($_->{num}) } @ws;
my @sorted = sort @nums; my @sorted = sort @nums;
cmp_deeply(\@nums, \@sorted, $msg); is_deeply(\@nums, \@sorted, $msg);
} }
my $tmp = fresh_workspace; my $tmp = fresh_workspace;
@ -22,8 +22,6 @@ my $left = open_window;
my $mid = open_window; my $mid = open_window;
my $right = open_window; my $right = open_window;
sync_with_i3($x);
diag("left = " . $left->id . ", mid = " . $mid->id . ", right = " . $right->id); 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');

View File

@ -10,8 +10,6 @@ cmd 'split v';
my $top = open_window; my $top = open_window;
my $bottom = open_window; my $bottom = open_window;
sync_with_i3($x);
diag("top = " . $top->id . ", bottom = " . $bottom->id); diag("top = " . $top->id . ", bottom = " . $bottom->id);
is($x->input_focus, $bottom->id, 'Bottom window focused'); is($x->input_focus, $bottom->id, 'Bottom window focused');

View File

@ -18,7 +18,7 @@ my ($nodes, $focus) = get_ws_content($tmp);
############################################################################# #############################################################################
# Create a floating window # Create a floating window
my $window = open_floating_window($x); my $window = open_floating_window;
ok($window->mapped, 'Window is mapped'); ok($window->mapped, 'Window is mapped');
($nodes, $focus) = get_ws_content($tmp); ($nodes, $focus) = get_ws_content($tmp);

View File

@ -17,7 +17,7 @@ cmp_ok($absolute->{width}, '>', 400, 'i3 raised the width');
cmp_ok($absolute->{height}, '>', 150, 'i3 raised the height'); cmp_ok($absolute->{height}, '>', 150, 'i3 raised the height');
cmd 'floating toggle'; cmd 'floating toggle';
sync_with_i3($x); sync_with_i3;
($absolute, $top) = $window->rect; ($absolute, $top) = $window->rect;

View File

@ -46,7 +46,7 @@ my $third = open_window({
$third->map; $third->map;
sync_with_i3 $x; sync_with_i3;
diag("third = " . $third->id); diag("third = " . $third->id);
@ -57,9 +57,6 @@ my $tmp2 = get_unused_workspace;
cmd "move workspace $tmp2"; cmd "move workspace $tmp2";
# verify that the third window has the focus # verify that the third window has the focus
sync_with_i3($x);
is($x->input_focus, $third->id, 'third window focused'); is($x->input_focus, $third->id, 'third window focused');
done_testing; done_testing;

View File

@ -47,7 +47,7 @@ is($docknode->{rect}->{height}, 30, 'dock node has unchanged height');
$window->add_hint('urgency'); $window->add_hint('urgency');
sync_with_i3($x); sync_with_i3;
does_i3_live; does_i3_live;

View File

@ -9,8 +9,6 @@ use X11::XCB qw(ICCCM_WM_STATE_NORMAL ICCCM_WM_STATE_WITHDRAWN);
my $window = open_window; my $window = open_window;
sync_with_i3($x);
is($window->state, ICCCM_WM_STATE_NORMAL, 'WM_STATE normal'); is($window->state, ICCCM_WM_STATE_NORMAL, 'WM_STATE normal');
$window->unmap; $window->unmap;

View File

@ -14,8 +14,6 @@ sub two_windows {
my $first = open_window; my $first = open_window;
my $second = open_window; my $second = open_window;
sync_with_i3 $x;
is($x->input_focus, $second->id, 'second window focused'); is($x->input_focus, $second->id, 'second window focused');
ok(@{get_ws_content($tmp)} == 2, 'two containers opened'); ok(@{get_ws_content($tmp)} == 2, 'two containers opened');

View File

@ -124,13 +124,13 @@ cmp_ok(@content, '==', 1, 'one node on this workspace now');
is($content[0]->{border}, 'normal', 'normal border'); is($content[0]->{border}, 'normal', 'normal border');
$window->name('special borderless title'); $window->name('special borderless title');
sync_with_i3 $x; sync_with_i3;
@content = @{get_ws_content($tmp)}; @content = @{get_ws_content($tmp)};
is($content[0]->{border}, 'none', 'no border'); is($content[0]->{border}, 'none', 'no border');
$window->name('special title'); $window->name('special title');
sync_with_i3 $x; sync_with_i3;
cmd 'border normal'; cmd 'border normal';
@ -138,7 +138,7 @@ cmd 'border normal';
is($content[0]->{border}, 'normal', 'border reset to normal'); is($content[0]->{border}, 'normal', 'border reset to normal');
$window->name('special borderless title'); $window->name('special borderless title');
sync_with_i3 $x; sync_with_i3;
@content = @{get_ws_content($tmp)}; @content = @{get_ws_content($tmp)};
is($content[0]->{border}, 'normal', 'still normal border'); is($content[0]->{border}, 'normal', 'still normal border');
@ -235,7 +235,7 @@ wait_for_unmap $window;
$window->destroy; $window->destroy;
# give i3 a chance to delete the window from its tree # give i3 a chance to delete the window from its tree
sync_with_i3 $x; sync_with_i3;
@content = @{get_ws_content($tmp)}; @content = @{get_ws_content($tmp)};
cmp_ok(@content, '==', 0, 'no nodes on this workspace now'); cmp_ok(@content, '==', 0, 'no nodes on this workspace now');
@ -457,7 +457,7 @@ $x->change_property(
$x->flush; $x->flush;
sync_with_i3 $x; sync_with_i3;
@content = @{get_ws_content($tmp)}; @content = @{get_ws_content($tmp)};
cmp_ok(@content, '==', 1, 'one node on this workspace now'); cmp_ok(@content, '==', 1, 'one node on this workspace now');

View File

@ -135,7 +135,7 @@ $window->map;
# We use sync_with_i3 instead of wait_for_map here because i3 will not actually # We use sync_with_i3 instead of wait_for_map here because i3 will not actually
# map the window -- it will be assigned to a different workspace and will only # map the window -- it will be assigned to a different workspace and will only
# be mapped once you switch to that workspace # be mapped once you switch to that workspace
sync_with_i3 $x; sync_with_i3;
ok(@{get_ws_content($tmp)} == 0, 'still no containers'); ok(@{get_ws_content($tmp)} == 0, 'still no containers');
ok(@{get_ws_content('targetws')} == 2, 'two containers on targetws'); ok(@{get_ws_content('targetws')} == 2, 'two containers on targetws');

View File

@ -26,8 +26,6 @@ ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
my $first = open_window; my $first = open_window;
my $second = open_window; my $second = open_window;
sync_with_i3($x);
is($x->input_focus, $second->id, 'second window focused'); is($x->input_focus, $second->id, 'second window focused');
my @content = @{get_ws_content($tmp)}; my @content = @{get_ws_content($tmp)};
ok(@content == 2, 'two containers opened'); ok(@content == 2, 'two containers opened');
@ -56,8 +54,6 @@ ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
$first = open_window; $first = open_window;
$second = open_window; $second = open_window;
sync_with_i3($x);
is($x->input_focus, $second->id, 'second window focused'); is($x->input_focus, $second->id, 'second window focused');
@content = @{get_ws_content($tmp)}; @content = @{get_ws_content($tmp)};
ok(@content == 1, 'one con at workspace level'); ok(@content == 1, 'one con at workspace level');

View File

@ -70,8 +70,6 @@ cmd 'focus parent';
$third = open_window; $third = open_window;
sync_with_i3($x);
is($x->input_focus, $third->id, 'third window focused'); is($x->input_focus, $third->id, 'third window focused');
cmd 'focus left'; cmd 'focus left';

View File

@ -18,7 +18,7 @@ EOT
my $pid = launch_with_config($config); my $pid = launch_with_config($config);
my @names = @{get_workspace_names()}; my @names = @{get_workspace_names()};
cmp_deeply(\@names, [ '1' ], 'i3 starts on workspace 1 without any configuration'); is_deeply(\@names, [ '1' ], 'i3 starts on workspace 1 without any configuration');
exit_gracefully($pid); exit_gracefully($pid);
@ -36,7 +36,7 @@ EOT
$pid = launch_with_config($config); $pid = launch_with_config($config);
@names = @{get_workspace_names()}; @names = @{get_workspace_names()};
cmp_deeply(\@names, [ 'foobar' ], 'i3 starts on named workspace foobar'); is_deeply(\@names, [ 'foobar' ], 'i3 starts on named workspace foobar');
exit_gracefully($pid); exit_gracefully($pid);
@ -54,7 +54,7 @@ EOT
$pid = launch_with_config($config); $pid = launch_with_config($config);
@names = @{get_workspace_names()}; @names = @{get_workspace_names()};
cmp_deeply(\@names, [ 'foobar' ], 'i3 starts on named workspace foobar'); is_deeply(\@names, [ 'foobar' ], 'i3 starts on named workspace foobar');
exit_gracefully($pid); exit_gracefully($pid);

View File

@ -16,7 +16,7 @@ sub get_marks {
my $tmp = fresh_workspace; my $tmp = fresh_workspace;
my $marks = get_marks(); my $marks = get_marks();
cmp_deeply($marks, [], 'no marks set so far'); is_deeply($marks, [], 'no marks set so far');
############################################################## ##############################################################
# 2: check that setting a mark is reflected in the get_marks reply # 2: check that setting a mark is reflected in the get_marks reply
@ -25,7 +25,7 @@ cmp_deeply($marks, [], 'no marks set so far');
cmd 'open'; cmd 'open';
cmd 'mark foo'; cmd 'mark foo';
cmp_deeply(get_marks(), [ 'foo' ], 'mark foo set'); is_deeply(get_marks(), [ 'foo' ], 'mark foo set');
############################################################## ##############################################################
# 3: check that the mark is gone after killing the container # 3: check that the mark is gone after killing the container
@ -33,7 +33,7 @@ cmp_deeply(get_marks(), [ 'foo' ], 'mark foo set');
cmd 'kill'; cmd 'kill';
cmp_deeply(get_marks(), [ ], 'mark gone'); is_deeply(get_marks(), [ ], 'mark gone');
############################################################## ##############################################################
# 4: check that duplicate marks are included twice in the get_marks reply # 4: check that duplicate marks are included twice in the get_marks reply
@ -45,6 +45,6 @@ cmd 'mark bar';
cmd 'open'; cmd 'open';
cmd 'mark bar'; cmd 'mark bar';
cmp_deeply(get_marks(), [ 'bar', 'bar' ], 'duplicate mark found twice'); is_deeply(get_marks(), [ 'bar', 'bar' ], 'duplicate mark found twice');
done_testing; done_testing;

View File

@ -73,7 +73,7 @@ $tmp = fresh_workspace;
ok(@{get_ws_content($tmp)} == 0, 'no containers yet'); ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
$first = open_floating_window($x); $first = open_floating_window;
my $wscontent = get_ws($tmp); my $wscontent = get_ws($tmp);
my @floating = @{$wscontent->{floating_nodes}}; my @floating = @{$wscontent->{floating_nodes}};
@ -101,7 +101,7 @@ $tmp = fresh_workspace;
ok(@{get_ws_content($tmp)} == 0, 'no containers yet'); ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
$first = open_floating_window($x); $first = open_floating_window;
$wscontent = get_ws($tmp); $wscontent = get_ws($tmp);
@floating = @{$wscontent->{floating_nodes}}; @floating = @{$wscontent->{floating_nodes}};

View File

@ -103,7 +103,7 @@ $win->map;
# We dont use wait_for_map because the window will not get mapped -- it is on # We dont use wait_for_map because the window will not get mapped -- it is on
# a different workspace. # a different workspace.
# We sync with i3 here to make sure $x->input_focus is updated. # We sync with i3 here to make sure $x->input_focus is updated.
sync_with_i3($x); sync_with_i3;
is(@{get_ws_content($second_ws)}, 0, 'still no containers on the second workspace'); is(@{get_ws_content($second_ws)}, 0, 'still no containers on the second workspace');
is(@{get_ws_content($first_ws)}, 1, 'one container on the first workspace'); is(@{get_ws_content($first_ws)}, 1, 'one container on the first workspace');
@ -117,7 +117,7 @@ mark_window($leader->id);
$win = open_window({ dont_map => 1, client_leader => $leader }); $win = open_window({ dont_map => 1, client_leader => $leader });
$win->map; $win->map;
sync_with_i3($x); sync_with_i3;
is(@{get_ws_content($second_ws)}, 0, 'still no containers on the second workspace'); is(@{get_ws_content($second_ws)}, 0, 'still no containers on the second workspace');
is(@{get_ws_content($first_ws)}, 2, 'two containers on the first workspace'); is(@{get_ws_content($first_ws)}, 2, 'two containers on the first workspace');
@ -128,7 +128,7 @@ is(@{get_ws_content($first_ws)}, 2, 'two containers on the first workspace');
###################################################################### ######################################################################
complete_startup(); complete_startup();
sync_with_i3($x); sync_with_i3;
my $otherwin = open_window; my $otherwin = open_window;
is(@{get_ws_content($second_ws)}, 1, 'one container on the second workspace'); is(@{get_ws_content($second_ws)}, 1, 'one container on the second workspace');