From: Michael Stapelberg Date: Mon, 9 Apr 2012 12:48:43 +0000 (+0200) Subject: tests: warp the pointer to in multi-monitor tests to avoid flaky tests X-Git-Tag: 4.2~20 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=1bb165a29a269658706218369100d5ed8a2773fd;p=i3%2Fi3 tests: warp the pointer to in multi-monitor tests to avoid flaky tests --- diff --git a/src/workspace.c b/src/workspace.c index 87e26049..44f32c2d 100644 --- a/src/workspace.c +++ b/src/workspace.c @@ -594,6 +594,7 @@ Con* workspace_prev_on_output(void) { Con *current = con_get_workspace(focused); Con *prev = NULL; Con *output = con_get_output(focused); + DLOG("output = %s\n", output->name); if (current->num == -1) { /* If named workspace, find previous named workspace. */ diff --git a/testcases/t/502-focus-output.t b/testcases/t/502-focus-output.t index 01e98723..4e0fedbb 100644 --- a/testcases/t/502-focus-output.t +++ b/testcases/t/502-focus-output.t @@ -28,6 +28,9 @@ sub focused_output { return $output->{name}; } +$x->root->warp_pointer(0, 0); +sync_with_i3; + is(focused_output, 'fake-0', 'focus on first output'); cmd 'focus output right'; diff --git a/testcases/t/503-workspace.t b/testcases/t/503-workspace.t index 19d9f95a..94ba3434 100644 --- a/testcases/t/503-workspace.t +++ b/testcases/t/503-workspace.t @@ -18,6 +18,9 @@ my $pid = launch_with_config($config); # Setup workspaces so that they stay open (with an empty container). ################################################################################ +$x->root->warp_pointer(0, 0); +sync_with_i3; + is(focused_ws, '1', 'starting on workspace 1'); # ensure workspace 1 stays open open_window; @@ -66,6 +69,12 @@ is(focused_ws, '1', 'workspace 1 focused'); cmd 'workspace 2'; +# XXX: This is to avoid EnterNotifies changing the focus. Not sure why they +# appear sometimes in the first place. Only happens when running the full +# testsuite. +$x->root->warp_pointer(1025, 0); +sync_with_i3; + cmd 'workspace prev_on_output'; is(focused_ws, '2', 'workspace 2 focused');