aboutsummaryrefslogtreecommitdiff
path: root/src/client/shell/tests/endpoints.rs
diff options
context:
space:
mode:
authorCan Celik <ogulcancelik@gmail.com>2026-09-14 19:26:55 +0300
committerGitHub <noreply@github.com>2026-09-14 19:26:55 +0300
commitb5154541cc75f9f12b7c14964d4d277d505a5f45 (patch)
tree1a45e3eb71730ab97983d8c92edcb72a7d963ab9 /src/client/shell/tests/endpoints.rs
parent03749ae3970a74e077fc16b9327bddfc957771c9 (diff)
fix: restore saved machine screens after reconnect (#4126)
refs #3842
Diffstat (limited to 'src/client/shell/tests/endpoints.rs')
-rw-r--r--src/client/shell/tests/endpoints.rs47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/client/shell/tests/endpoints.rs b/src/client/shell/tests/endpoints.rs
index 1edba8e6..4ac8183c 100644
--- a/src/client/shell/tests/endpoints.rs
+++ b/src/client/shell/tests/endpoints.rs
@@ -1527,6 +1527,53 @@ fn new_connection_generation_accepts_a_lower_same_boot_projection_revision() {
}
#[test]
+fn reconnect_same_endpoint_accepts_new_generation_surface_revision() {
+ for previous_revision in [9, 1] {
+ let (mut state, endpoint_id) = state_with_remote();
+ let mut previous = snapshot();
+ previous.boot_id = "shared-server-boot".into();
+ previous.revision = previous_revision;
+ state.cache_endpoint_snapshot_inactive_for_generation(&endpoint_id, 4, Box::new(previous));
+ assert!(state.activate_endpoint_projection(&endpoint_id));
+ let mut previous_surface = surface();
+ previous_surface.boot_id = "shared-server-boot".into();
+ previous_surface.projection_revision = previous_revision;
+ previous_surface.surface_revision = 9;
+ state.set_pane_surface(previous_surface.clone());
+ previous_surface.projection_revision += 1;
+ state.set_pane_surface(previous_surface);
+ assert!(state.pending_pane_surface.is_some());
+ state.agent_scroll = 7;
+
+ state.mark_endpoint_disconnected(&endpoint_id);
+ let mut reconnected = snapshot();
+ reconnected.boot_id = "shared-server-boot".into();
+ reconnected.revision = 1;
+ state.cache_endpoint_snapshot_inactive_for_generation(
+ &endpoint_id,
+ 5,
+ Box::new(reconnected),
+ );
+ assert_eq!(state.snapshot.as_ref().unwrap().revision, previous_revision);
+ assert_eq!(state.pane_surface.as_ref().unwrap().surface_revision, 9);
+
+ state.set_endpoint_status(&endpoint_id, ClientEndpointStatus::Online);
+ assert!(state.activate_endpoint_projection(&endpoint_id));
+ let mut reconnected_surface = surface();
+ reconnected_surface.boot_id = "shared-server-boot".into();
+ reconnected_surface.projection_revision = 1;
+ reconnected_surface.surface_revision = 1;
+ state.set_pane_surface(reconnected_surface);
+
+ assert_eq!(state.snapshot.as_ref().unwrap().revision, 1);
+ assert_eq!(state.pane_surface.as_ref().unwrap().projection_revision, 1);
+ assert_eq!(state.pane_surface.as_ref().unwrap().surface_revision, 1);
+ assert!(state.pending_pane_surface.is_none());
+ assert_eq!(state.agent_scroll, 7);
+ }
+}
+
+#[test]
fn reconnect_snapshot_waits_for_coherent_activation_before_replacing_projection() {
let (mut state, endpoint_id) = state_with_remote();
assert!(state.activate_endpoint_projection(&endpoint_id));