diff --git a/testcases/t/514-ipc-workspace-multi-monitor.t b/testcases/t/514-ipc-workspace-multi-monitor.t index 360bd426..61622ab0 100644 --- a/testcases/t/514-ipc-workspace-multi-monitor.t +++ b/testcases/t/514-ipc-workspace-multi-monitor.t @@ -19,6 +19,10 @@ use i3test i3_autostart => 0; +# Ensure the pointer is at (0, 0) so that we really start on the first +# (the left) workspace. +$x->root->warp_pointer(0, 0); + my $config = <connect()->recv; # Workspaces requests and events ################################ -my $focused = get_ws(focused_ws()); +my $old_ws = get_ws(focused_ws); # Events @@ -46,17 +50,11 @@ $i3->subscribe({ workspace => sub { my ($event) = @_; if ($event->{change} eq 'focus') { - # Check that we have the old and new workspace - $focus->send( - $event->{current}->{name} == '2' && - $event->{old}->{name} == $focused->{name} - ); + $focus->send($event); } } })->recv; -cmd 'focus output right'; - my $t; $t = AnyEvent->timer( after => 0.5, @@ -65,7 +63,15 @@ $t = AnyEvent->timer( } ); -ok($focus->recv, 'Workspace "focus" event received'); +cmd 'focus output right'; + +my $event = $focus->recv; + +my $current_ws = get_ws(focused_ws); + +ok($event, 'Workspace "focus" event received'); +is($event->{current}->{id}, $current_ws->{id}, 'Event gave correct current workspace'); +is($event->{old}->{id}, $old_ws->{id}, 'Event gave correct old workspace'); exit_gracefully($pid);