Files
photocraft/crates/engine/tests/it/atn_v12.rs
T
1f524c378b Integration: track the v12 .atn fixtures and sniff v12 in the CLI (#10743)
The three version 12 fixtures were tracked inside crates/psd/fuzz/corpus,
which crates/psd/fuzz/.gitignore ignores and cargo-fuzz rewrites (cmin) or
deletes; the psd and engine test binaries include_bytes! them, so cleaning
the corpus broke the build. They move to crates/psd/tests/fixtures/atn with
a README (sizes, purpose, sha256; the seeds note folded in) and an
ATTRIBUTION.md row; the fuzzer takes the folder as an extra corpus dir.

photocraft-cli recognised an extensionless Actions file only by version
word 16, so a version 12 set without .atn (classic Mac OS Photoshop 5)
went down the JSON path and failed with a UTF-8 error. It now accepts 12
and 16, the versions photocraft-psd reads. Input: v12-commands.atn copied
to "Legacy Actions" and passed to load_actions_file.

Co-authored-by: yoriswind <164435053+yoriswind@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 02:09:41 +01:00

23 lines
1.0 KiB
Rust

use photocraft_engine::{Session, paint::tile::b64_encode};
use photocraft_psd::atn;
use serde_json::json;
/// Legacy descriptor syntax must reach the same commands and parameters as version 16.
#[test]
fn legacy_v12_commands_import_like_v16() {
let bytes = include_bytes!("../../../psd/tests/fixtures/atn/v12-commands.atn");
let modern = atn::write(&atn::parse(bytes).unwrap()).unwrap();
let expected = vec![
("filter.blur.gaussianBlur".into(), json!({"radius": 2.5})),
("image.adjustments.levels".into(), json!({"inBlack": 10, "inWhite": 240, "gamma": 1.2, "outBlack": 0, "outWhite": 250})),
("select.all".into(), json!({})),
("layer.new.layer".into(), json!({"name": "Legacy layer"})),
];
for input in [bytes.as_slice(), modern.as_slice()] {
let mut s = Session::new();
let result = s.execute("actions.load", json!({"data": b64_encode(input)})).unwrap();
assert_eq!(result["unsupported"], json!([]));
assert_eq!(s.actions.list[0].steps, expected);
}
}