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; $window->map;
sleep(0.25); sleep(0.5);
my $new_rect = $window->rect; my $new_rect = $window->rect;
ok(!eq_hash($new_rect, $original_rect), "Window got repositioned"); ok(!eq_hash($new_rect, $original_rect), "Window got repositioned");

View File

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

View File

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

View File

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

View File

@ -10,20 +10,18 @@ my $tmp = fresh_workspace;
# open a tiling window on the first workspace # open a tiling window on the first workspace
open_window; open_window;
#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 = fresh_workspace; my $otmp = fresh_workspace;
open_window; open_window;
#sleep 0.25;
my $float = get_focused($otmp); my $float = get_focused($otmp);
cmd 'mode toggle'; cmd 'mode toggle';
#sleep 0.25; sync_with_i3;
# move the floating con to first workspace # move the floating con to first workspace
cmd "move workspace $tmp"; cmd "move workspace $tmp";
#sleep 0.25; sync_with_i3;
# 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');

View File

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