diff --git a/brokkr-daemon/src/main.rs b/brokkr-daemon/src/main.rs index f83e29b..643cae9 100644 --- a/brokkr-daemon/src/main.rs +++ b/brokkr-daemon/src/main.rs @@ -3379,6 +3379,42 @@ mod tests { Ok(()) } + #[test] + fn sync_once_writes_an_inactive_unity_object_as_hidden_in_blender() -> Result<()> { + let temp = tempfile::tempdir()?; + let unity_path = temp.path().join("unity.ccmp"); + let blender_path = temp.path().join("blender.ccmp"); + seed_component_property_stores(&unity_path, &blender_path, "active-state")?; + MirrorStore::open(&unity_path)?.put_messagepack_document( + "brokkr.unity.host_snapshot.v0", + "unity/host/current", + &json!({ + "sceneObjects": [{ + "objectId": "unity-cube", + "name": "Cube", + "path": "/Cube", + "activeSelf": false + }] + }), + )?; + + let report = run_sync_once(&SyncArgs { + unity_cache: unity_path, + blender_cache: blender_path.clone(), + dry_run: false, + })?; + + assert_eq!(report.blender_commands_written, 1, "{report:#?}"); + let command = MirrorStore::open(&blender_path)? + .documents()? + .into_iter() + .find(|document| document.key.starts_with("blender/commands/")) + .expect("Brokkr should emit a Blender visibility command"); + assert_eq!(command.value["action"], "setObjectVisibility"); + assert_eq!(command.value["visible"], false); + Ok(()) + } + #[test] fn dry_run_counts_active_state_command_but_writes_none() -> Result<()> { let temp = tempfile::tempdir()?;