LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust
LR-LIB-ALBUM: album.toggleTarget reports toggled: 0 when no photo is left to toggle
Nathaniel Ledfordf5e1dd2cbef0
diff --git a/crates/engine/src/cmd/library/specs.rs b/crates/engine/src/cmd/library/specs.rsindex df54d9162..0dcbefe19 100644--- a/crates/engine/src/cmd/library/specs.rs+++ b/crates/engine/src/cmd/library/specs.rs@@ -1076,7 +1076,7 @@ pub fn specs() -> Vec<CommandSpec> {.or_else(|| s.catalog.quick_collection());let al = existing.and_then(|a| s.catalog.album(a));return Ok(- json!({"album": al.map(|a| a.id.0), "name": al.map(|a| a.name.clone()), "added": null, "count": al.map_or(0, |a| s.catalog.album_count(a.id)), "skipped": skipped}),+ json!({"album": al.map(|a| a.id.0), "name": al.map(|a| a.name.clone()), "added": null, "toggled": 0, "count": al.map_or(0, |a| s.catalog.album_count(a.id)), "skipped": skipped}),);}let target = s.target_album.filter(|a| s.catalog.album(*a).is_some_and(|al| !al.is_smart() && !al.folder));diff --git a/crates/engine/src/tests/album_missing.rs b/crates/engine/src/tests/album_missing.rsindex 016f7e3df..560e2074c 100644--- a/crates/engine/src/tests/album_missing.rs+++ b/crates/engine/src/tests/album_missing.rs@@ -49,7 +49,7 @@ fn photos_the_catalog_lacks_reach_no_album() {// toggling: nothing is made or changed for ids that are gonelet r = s.execute("album.toggleTarget", &json!({"ids": [GONE.0]})).unwrap();- assert!(r["added"].is_null(), "{r}");+ assert!(r["added"].is_null() && r["toggled"] == 0, "{r}");assert!(s.catalog.quick_collection().is_none(), "no Quick Collection for nothing");assert_eq!(s.undo.len(), undo + 1);@@ -78,7 +78,7 @@ fn toggling_gone_photos_leaves_the_target_album_and_redo_alone() {let undo = s.undo.len();let r = s.execute("album.toggleTarget", &json!({"ids": [GONE.0]})).unwrap();assert_eq!(r["album"].as_u64(), Some(a.0), "{r}");- assert!(r["added"].is_null(), "{r}");+ assert!(r["added"].is_null() && r["toggled"] == 0, "{r}");assert_eq!(s.catalog.album(a).unwrap().photos, vec![photo]);assert_eq!((s.undo.len(), s.redo.len()), (undo, 1));}