brokkr-daemon: test that an inactive Unity object syncs as hidden (kills visible-hardcoded-true)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-11-28 01:53:20 +01:00
commit adbe4dcdd6

View file

@ -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()?;