testcases: replace sleep with sync_with_i3 where appropiate

This commit is contained in:
Maik Fischer 2011-11-23 12:57:13 +01:00 committed by Michael Stapelberg
parent 33e9c29022
commit c2229b905a
6 changed files with 20 additions and 24 deletions

View File

@ -18,7 +18,7 @@ is_deeply($window->rect, $original_rect, "rect unmodified before mapping");
$window->map;
sleep(0.25);
sleep(0.5);
my $new_rect = $window->rect;
ok(!eq_hash($new_rect, $original_rect), "Window got repositioned");

View File

@ -16,8 +16,7 @@ cmd 'open';
my $floating = get_focused($tmp);
diag("focused floating: " . get_focused($tmp));
cmd 'mode toggle';
# TODO: eliminate this race conditition
sleep 1;
sync_with_i3;
# kill old container
cmd qq|[con_id="$old"] focus|;
@ -33,7 +32,7 @@ cmd 'kill';
cmd qq|[con_id="$floating"] focus|;
is(get_focused($tmp), $floating, 'floating window focused');
sleep 1;
sync_with_i3;
cmd 'mode toggle';
does_i3_live;

View File

@ -42,9 +42,8 @@ isnt(get_focused($tmp), $second, 'different container focused');
##############################################################
cmd 'kill';
# TODO: this testcase sometimes has different outcomes when the
# sleep is missing. why?
sleep 0.25;
sync_with_i3;
($nodes, $focus) = get_ws_content($tmp);
is($nodes->[1]->{nodes}->[0]->{id}, $second, 'second container found');
ok($nodes->[1]->{nodes}->[0]->{focused}, 'second container focused');
@ -103,8 +102,7 @@ my $win = open_window({ background_color => '#00ff00' });
cmd qq|[con_id="$middle"] focus|;
$win->destroy;
sleep 0.25;
sync_with_i3;
is(get_focused($tmp), $middle, 'middle container focused');

View File

@ -6,6 +6,11 @@
#
use i3test;
sub sync_cmd {
cmd @_;
sync_with_i3;
}
my $tmp = fresh_workspace;
my $left = open_window;
@ -13,23 +18,19 @@ my $mid = open_window;
my $right = open_window;
# go to workspace level
cmd 'level up';
sleep 0.25;
sync_cmd 'level up';
# make it floating
cmd 'mode toggle';
sleep 0.25;
sync_cmd 'mode toggle';
# move the con outside the floating con
cmd 'move up';
sleep 0.25;
sync_cmd 'move up';
does_i3_live;
# move another con outside
cmd '[id="' . $mid->id . '"] focus';
cmd 'move up';
sleep 0.25;
sync_cmd '[id="' . $mid->id . '"] focus';
sync_cmd 'move up';
does_i3_live;

View File

@ -10,20 +10,18 @@ my $tmp = fresh_workspace;
# open a tiling window on the first workspace
open_window;
#sleep 0.25;
my $first = get_focused($tmp);
# on a different ws, open a floating window
my $otmp = fresh_workspace;
open_window;
#sleep 0.25;
my $float = get_focused($otmp);
cmd 'mode toggle';
#sleep 0.25;
sync_with_i3;
# move the floating con to first workspace
cmd "move workspace $tmp";
#sleep 0.25;
sync_with_i3;
# switch to the first ws and check focus
is(get_focused($tmp), $float, 'floating client correctly focused');

View File

@ -11,10 +11,10 @@ open_window;
open_window;
cmd 'layout stacking';
sleep 1;
sync_with_i3;
cmd 'fullscreen';
sleep 1;
sync_with_i3;
cmd 'restart';
sleep 1;