diff --git a/crates/polymodel-renderer-protocol/src/lib.rs b/crates/polymodel-renderer-protocol/src/lib.rs index a4f46bb..c109f1f 100644 --- a/crates/polymodel-renderer-protocol/src/lib.rs +++ b/crates/polymodel-renderer-protocol/src/lib.rs @@ -1,4 +1,4 @@ -//! Leaf protocol crate for the Polymodel renderer worker split. +//! Protocol crate for the Polymodel renderer worker split. //! //! Owns the types shared between the Dioxus main thread and the renderer Web Worker: //! [`MeshFormat`] / [`LengthUnit`] / [`Units`] (relocated from the mesh contract so the diff --git a/crates/polymodel-renderer-worker/src/worker.rs b/crates/polymodel-renderer-worker/src/worker.rs index a248468..d6e3e2f 100644 --- a/crates/polymodel-renderer-worker/src/worker.rs +++ b/crates/polymodel-renderer-worker/src/worker.rs @@ -594,6 +594,33 @@ mod tests { )); } + #[wasm_bindgen_test] + fn cancelled_compound_parse_maps_to_cancelled_load_error() { + let bytes = b"0 FILE root.ldr\n3 16 0 0 0 1 0 0 0 1 0 0\n"; + let source = VerifiedCompoundSource { + primary: "root.ldr".into(), + resources: vec![polymodel_renderer_protocol::ModelResource { + key: "root.ldr".into(), + path: "root.ldr".into(), + root: "mpd".into(), + byte_length: bytes.len() as u64, + sha256: vec![0; 32], + mime_type: "application/x-ldraw".into(), + target_cids: Vec::new(), + bytes: bytes.to_vec(), + }], + source_identities: Vec::new(), + target_selections: Vec::new(), + }; + let cancellation = CancellationPolicy::new(); + cancellation.cancel(); + + assert!(matches!( + parse_compound_source(source, cancellation), + Err(CompoundLoadError::Cancelled) + )); + } + #[wasm_bindgen_test] fn generation_allocation_never_reuses_saturated_identity() { assert_eq!(next_generation(0), Ok(1));