Skip to content

EffectCraft: An open-source motion graphics and compositing tool written by scratch in pure Rust

fix(engine): expose transparent param in comp.saveFrameAs schema and test execute_checked

Kushagra Kumar77e2cf05542f
diff --git a/crates/engine/src/commands/comp_more.rs b/crates/engine/src/commands/comp_more.rs
index 96aa29a9a..b47d0ebf8 100644
--- a/crates/engine/src/commands/comp_more.rs
+++ b/crates/engine/src/commands/comp_more.rs
@@ -235,7 +235,7 @@ pub fn specs() -> Vec<CommandSpec> {
"File...",
["Composition", "Save Frame As"],
Some("Cmd+Alt+S"),
- "{path (.png; with queue: an output path or template), time?, scale?, queue?: bool (add a Render Queue item from the Frame Default templates instead of writing now)}",
+ "{path (.png; with queue: an output path or template), time?, scale?, queue?: bool (add a Render Queue item from the Frame Default templates instead of writing now), transparent?: bool (default true)}",
has_comp,
save_frame
),
diff --git a/crates/engine/src/tests_frame_export.rs b/crates/engine/src/tests_frame_export.rs
index d56c941ae..a11f7c64c 100644
--- a/crates/engine/src/tests_frame_export.rs
+++ b/crates/engine/src/tests_frame_export.rs
@@ -184,7 +184,7 @@ fn save_frame_as_png_preserves_alpha_channel() {
assert_eq!(empty_px[3], 0, "outside solid region must have alpha 0: {empty_px:?}");
let flat_path = dir.join("flat.png").to_string_lossy().to_string();
- s.execute("comp.saveFrameAs", json!({"path": flat_path, "transparent": false})).unwrap();
+ s.execute_checked("comp.saveFrameAs", json!({"path": flat_path, "transparent": false})).unwrap();
let flat_img = image::load_from_memory(&std::fs::read(&flat_path).unwrap()).unwrap().to_rgba8();
let flat_empty_px = flat_img.get_pixel(24, 24);
assert_eq!(flat_empty_px[3], 255, "transparent: false must composite over background: {flat_empty_px:?}");