From 07d583d7806dc87c92796fcc1c3cf0b887dd925b Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Tue, 25 Feb 2014 20:44:17 +0100 Subject: [PATCH] tests: sync_with_i3 before warping pointer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- testcases/t/132-move-workspace.t | 1 + testcases/t/156-fullscreen-focus.t | 2 ++ testcases/t/502-focus-output.t | 1 + testcases/t/503-workspace.t | 1 + testcases/t/505-scratchpad-resolution.t | 2 ++ testcases/t/506-focus-right.t | 2 ++ testcases/t/510-focus-across-outputs.t | 3 +++ 7 files changed, 12 insertions(+) diff --git a/testcases/t/132-move-workspace.t b/testcases/t/132-move-workspace.t index 6367488a..1e0a3478 100644 --- a/testcases/t/132-move-workspace.t +++ b/testcases/t/132-move-workspace.t @@ -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; diff --git a/testcases/t/156-fullscreen-focus.t b/testcases/t/156-fullscreen-focus.t index 170c641d..b337de9a 100644 --- a/testcases/t/156-fullscreen-focus.t +++ b/testcases/t/156-fullscreen-focus.t @@ -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; diff --git a/testcases/t/502-focus-output.t b/testcases/t/502-focus-output.t index 8c1c36c5..cf297f0e 100644 --- a/testcases/t/502-focus-output.t +++ b/testcases/t/502-focus-output.t @@ -41,6 +41,7 @@ sub focused_output { return $output->{name}; } +sync_with_i3; $x->root->warp_pointer(0, 0); sync_with_i3; diff --git a/testcases/t/503-workspace.t b/testcases/t/503-workspace.t index c79643e3..7fe7f15b 100644 --- a/testcases/t/503-workspace.t +++ b/testcases/t/503-workspace.t @@ -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; diff --git a/testcases/t/505-scratchpad-resolution.t b/testcases/t/505-scratchpad-resolution.t index de13a544..2235e802 100644 --- a/testcases/t/505-scratchpad-resolution.t +++ b/testcases/t/505-scratchpad-resolution.t @@ -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; diff --git a/testcases/t/506-focus-right.t b/testcases/t/506-focus-right.t index 3f58b00c..aa0b9c9a 100644 --- a/testcases/t/506-focus-right.t +++ b/testcases/t/506-focus-right.t @@ -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; diff --git a/testcases/t/510-focus-across-outputs.t b/testcases/t/510-focus-across-outputs.t index 2c6fd396..afa0ddef 100644 --- a/testcases/t/510-focus-across-outputs.t +++ b/testcases/t/510-focus-across-outputs.t @@ -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;