summaryrefslogtreecommitdiff
path: root/src/client/shell/tests/endpoints.rs
diff options
context:
space:
mode:
authorCan Celik <ogulcancelik@gmail.com>2026-09-16 15:16:45 +0300
committerGitHub <noreply@github.com>2026-09-16 15:16:45 +0300
commitd1a53b2c0e7a365c20a524d75906ae83c6094458 (patch)
tree867b7ffb30c70d60ddad3b20975550dda21ca96f /src/client/shell/tests/endpoints.rs
parent18061191fdc019498610aee81f0df93f6c2ebd31 (diff)
fix: keep local usable when remote machines stall (#4234)
refs #3903
Diffstat (limited to 'src/client/shell/tests/endpoints.rs')
-rw-r--r--src/client/shell/tests/endpoints.rs65
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 [