diff options
Diffstat (limited to 'src/client/shell/tests/endpoints.rs')
| -rw-r--r-- | src/client/shell/tests/endpoints.rs | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/src/client/shell/tests/endpoints.rs b/src/client/shell/tests/endpoints.rs index de7abb3d..5c00e645 100644 --- a/src/client/shell/tests/endpoints.rs +++ b/src/client/shell/tests/endpoints.rs @@ -1398,6 +1398,71 @@ fn clicking_remote_machine_name_requests_activation_without_mutating_projection( } #[test] +fn clicking_local_can_cancel_a_remote_switch_while_local_is_still_displayed() { + for workspace in [false, true] { + let (mut state, remote) = state_with_remote(); + state.compose(100, 28).unwrap(); + let mut pending = ClientShellInput::default(); + assert!(state.activate_endpoint(remote, &mut pending)); + assert_eq!(state.active_endpoint_id, ClientEndpointId::Local); + let rect = if workspace { + state + .hits + .workspaces + .iter() + .find(|hit| hit.endpoint_id.is_local()) + .unwrap() + .rect + } else { + state + .hits + .machines + .iter() + .find(|hit| hit.endpoint_id.is_local()) + .unwrap() + .rect + }; + let outcome = state.handle_raw_events(vec![ + RawInputEvent::Mouse(MouseEvent { + kind: MouseEventKind::Down(MouseButton::Left), + column: rect.x + 5, + row: rect.y, + modifiers: KeyModifiers::empty(), + }), + RawInputEvent::Mouse(MouseEvent { + kind: MouseEventKind::Up(MouseButton::Left), + column: rect.x + 5, + row: rect.y, + modifiers: KeyModifiers::empty(), + }), + ]); + assert!( + matches!(outcome.actions.as_slice(), [ClientShellAction::ActivateEndpoint { + endpoint_id: ClientEndpointId::Local, target, + }] if target.is_some() == workspace) + ); + } +} + +#[test] +fn reconnecting_local_selection_still_reaches_the_runtime() { + let (mut state, _) = state_with_remote(); + state.mark_endpoint_disconnected(&ClientEndpointId::Local); + let mut outcome = ClientShellInput::default(); + state.focus_or_activate( + ClientEndpointId::Local, + ClientEndpointFocusTarget::Workspace("local-workspace".into()), + &mut outcome, + ); + assert!( + matches!(outcome.actions.as_slice(), [ClientShellAction::ActivateEndpoint { + endpoint_id: ClientEndpointId::Local, + target: Some(ClientEndpointFocusTarget::Workspace(id)), + }] if id == "local-workspace") + ); +} + +#[test] fn machine_arrow_toggles_inactive_machine_without_switching() { for sidebar_collapsed in [false, true] { for status in [ |
