Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

Commit

Permalink
tests: warp the pointer to in multi-monitor tests to avoid flaky tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stapelberg committed Apr 9, 2012
1 parent 983ba65 commit 1bb165a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/workspace.c
Expand Up @@ -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. */
Expand Down
3 changes: 3 additions & 0 deletions testcases/t/502-focus-output.t
Expand Up @@ -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';
Expand Down
9 changes: 9 additions & 0 deletions testcases/t/503-workspace.t
Expand Up @@ -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;
Expand Down Expand Up @@ -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');

Expand Down

0 comments on commit 1bb165a

Please sign in to comment.