feat(proto): RestartSurface gains resume flag (defaults false)
This commit is contained in:
@@ -92,7 +92,11 @@ pub enum Cmd {
|
|||||||
SetRatios { workspace_id: WorkspaceId, node_path: Vec<u32>, ratios: Vec<f32> },
|
SetRatios { workspace_id: WorkspaceId, node_path: Vec<u32>, ratios: Vec<f32> },
|
||||||
MoveSurface { surface_id: SurfaceId, target_surface_id: SurfaceId, edge: Edge },
|
MoveSurface { surface_id: SurfaceId, target_surface_id: SurfaceId, edge: Edge },
|
||||||
ApplyPreset { workspace_id: WorkspaceId, preset_id: String, slots: Vec<PresetSlot> },
|
ApplyPreset { workspace_id: WorkspaceId, preset_id: String, slots: Vec<PresetSlot> },
|
||||||
RestartSurface { surface_id: SurfaceId },
|
RestartSurface {
|
||||||
|
surface_id: SurfaceId,
|
||||||
|
#[serde(default)]
|
||||||
|
resume: bool,
|
||||||
|
},
|
||||||
CloseWorkspace { workspace_id: WorkspaceId },
|
CloseWorkspace { workspace_id: WorkspaceId },
|
||||||
SetWorkspaceMeta {
|
SetWorkspaceMeta {
|
||||||
workspace_id: WorkspaceId,
|
workspace_id: WorkspaceId,
|
||||||
@@ -368,6 +372,21 @@ mod tests {
|
|||||||
assert_eq!(back, env);
|
assert_eq!(back, env);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn restart_surface_resume_defaults_false_and_round_trips() {
|
||||||
|
// Legacy frame without `resume` decodes to false.
|
||||||
|
let legacy = r#"{"kind":"req","id":5,"cmd":{"cmd":"restart_surface","args":{"surface_id":"s_1"}}}"#;
|
||||||
|
let env: Envelope = serde_json::from_str(legacy).unwrap();
|
||||||
|
match env {
|
||||||
|
Envelope::Req { cmd: Cmd::RestartSurface { resume, .. }, .. } => assert!(!resume),
|
||||||
|
_ => panic!("wrong variant"),
|
||||||
|
}
|
||||||
|
// resume=true round-trips.
|
||||||
|
let e = Envelope::Req { id: 6, cmd: Cmd::RestartSurface { surface_id: SurfaceId("s_1".into()), resume: true } };
|
||||||
|
let back: Envelope = serde_json::from_str(&serde_json::to_string(&e).unwrap()).unwrap();
|
||||||
|
assert_eq!(back, e);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn event_log_cmd_no_limit_round_trips() {
|
fn event_log_cmd_no_limit_round_trips() {
|
||||||
let env = Envelope::Req { id: 9, cmd: Cmd::EventLog { limit: None } };
|
let env = Envelope::Req { id: 9, cmd: Cmd::EventLog { limit: None } };
|
||||||
|
|||||||
Reference in New Issue
Block a user