tests: sync_with_i3 before warping pointer

To be honest, I’m not entirely sure where the race condition originates
from, but when making sure that there are no pending events
(which is what sync_with_i3 accomplishes) before warping the pointer, we
have less flaky testsuite runs.

closes #1189
This commit is contained in:
Michael Stapelberg 2014-02-25 20:44:17 +01:00
parent cdbf62d055
commit 07d583d780
7 changed files with 12 additions and 0 deletions

View File

@ -22,6 +22,7 @@ my $i3 = i3(get_socket_path());
# We move the pointer out of our way to avoid a bug where the focus will
# be set to the window under the cursor
sync_with_i3;
$x->root->warp_pointer(0, 0);
sync_with_i3;

View File

@ -126,6 +126,7 @@ is($nodes->[0]->{focused}, 1, 'fullscreen window focused');
cmd 'fullscreen';
# Focus screen 1
sync_with_i3;
$x->root->warp_pointer(1025, 0);
sync_with_i3;
@ -134,6 +135,7 @@ cmd "workspace $tmp";
my $diff_ws = open_window;
# Focus screen 0
sync_with_i3;
$x->root->warp_pointer(0, 0);
sync_with_i3;

View File

@ -41,6 +41,7 @@ sub focused_output {
return $output->{name};
}
sync_with_i3;
$x->root->warp_pointer(0, 0);
sync_with_i3;

View File

@ -31,6 +31,7 @@ my $pid = launch_with_config($config);
# Setup workspaces so that they stay open (with an empty container).
################################################################################
sync_with_i3;
$x->root->warp_pointer(0, 0);
sync_with_i3;

View File

@ -29,6 +29,7 @@ my $pid = launch_with_config($config);
my $i3 = i3(get_socket_path());
sync_with_i3;
$x->root->warp_pointer(0, 0);
sync_with_i3;
@ -76,6 +77,7 @@ verify_scratchpad_doesnt_move($second);
# now on the right output (1024x768)
################################################################################
sync_with_i3;
$x->root->warp_pointer(683 + 10, 0);
sync_with_i3;

View File

@ -28,6 +28,7 @@ sub test_focus_left_right {
my $i3 = i3(get_socket_path(0));
sync_with_i3;
$x->root->warp_pointer(0, 0);
sync_with_i3;
@ -140,6 +141,7 @@ my $pid = launch_with_config($config);
my $i3 = i3(get_socket_path(0));
sync_with_i3;
$x->root->warp_pointer(0, 0);
sync_with_i3;

View File

@ -38,6 +38,7 @@ my $third = open_window;
cmd 'floating toggle';
# Focus screen 1
sync_with_i3;
$x->root->warp_pointer(1025, 0);
sync_with_i3;
my $s1_ws = fresh_workspace;
@ -45,6 +46,7 @@ my $s1_ws = fresh_workspace;
my $fourth = open_window;
# Focus screen 2
sync_with_i3;
$x->root->warp_pointer(0, 769);
sync_with_i3;
my $s2_ws = fresh_workspace;
@ -52,6 +54,7 @@ my $s2_ws = fresh_workspace;
my $fifth = open_window;
# Focus screen 3
sync_with_i3;
$x->root->warp_pointer(1025, 769);
sync_with_i3;
my $s3_ws = fresh_workspace;