mirror of
https://github.com/storytold/photocraft.git
synced 2026-11-09 16:34:29 +00:00
Exercise legacy action imports through the integration suite
This commit is contained in:
@@ -68,25 +68,6 @@ fn b64(bytes: &[u8]) -> String {
|
||||
photocraft_paint::tile::b64_encode(bytes)
|
||||
}
|
||||
|
||||
/// 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/fuzz/corpus/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(input)})).unwrap();
|
||||
assert_eq!(result["unsupported"], json!([]));
|
||||
assert_eq!(s.actions.list[0].steps, expected);
|
||||
}
|
||||
}
|
||||
|
||||
/// A set with a mapped filter, an adjustment layer, selection steps, a layer by name, a Stop,
|
||||
/// a Play, a tool selection (no document effect) and an event PhotoCraft has no command for.
|
||||
fn sample() -> AtnFile {
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
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/fuzz/corpus/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);
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ mod atn_crystallize_cell_size;
|
||||
mod atn_ripple_amount;
|
||||
mod atn_selective_color;
|
||||
mod atn_stroke_width;
|
||||
mod atn_v12;
|
||||
mod background_and_mask_depth;
|
||||
mod background_layer_consistency;
|
||||
mod brush_smoothing;
|
||||
|
||||
Reference in New Issue
Block a user