Integration: write the .atn defaults Photoshop plays differently, keep resets and both colours (#4496)

The PR stopped writing PhotoCraft's defaults for params a step leaves
out. Checked against Photoshop, that is fine for Fill opacity and mode,
Crop delete, Selective Color method, Channel Mixer monochrome, Paint
Bucket contiguous and Gradient Map reverse/dither, but Photoshop plays
other missing keys differently: Canvas Size anchors top left (PhotoCraft:
centre), Apply Image blends Normal (Multiply), Color Balance turns
preserve luminosity off (on), and a Paint Bucket step without a
tolerance doesn't play at all. Those, and the unverified Hue/Saturation,
Color Balance tone and Save for Web keys, are written again as before.

- `tools.setColors` exported only the foreground of a step that sets
  both colours; such a step now doesn't export (the strict save refuses
  it, as before the PR).
- `kind` on an imported `layer.setAdjustment` made Photoshop's "reset to
  default" (`set` with an empty `T`) a no-op merge; it now joins only
  params that edit something.
- `cargo xtask corpus --atn` (and `--all`) failed on Windows: the Bjango
  archive has a macOS `Icon\r` file tar can't create there; it's skipped.
- `test-corpus --changed` now runs for `atn_cmds` changes, and the
  `ALL` doc comment is back on `ALL`.

Tests: defaults_photoshop_plays_differently_are_written,
set_colors_exports_only_a_single_colour and
adjustment_layer_reset_still_resets fail without this commit; the psd
and engine .atn corpus tests still pass (16 files byte-identical; 513
kept Photoshop steps).

Co-authored-by: Fabio Lissi <3223836+FabioLissi@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
David Mann
2026-10-21 02:19:11 +02:00
parent c9b0bb0cbc
commit 404a17e711
5 changed files with 92 additions and 50 deletions
+3 -1
View File
@@ -21,7 +21,8 @@ pub const PIXLS_CRATES: &[&str] = &["photocraft-raw"];
/// Corpus crates with a `heif` feature: test-corpus enables it so the HEIF corpus tests run.
const HEIF_CRATES: &[&str] = &["photocraft-codecs", "photocraft-io"];
/// Paths whose changes make `test-corpus --changed` run (the file-format and rendering crates).
/// Paths whose changes make `test-corpus --changed` run (the file-format and rendering crates,
/// and the engine's `.atn` import and export).
const CRITICAL: &[&str] = &[
"crates/psd/",
"crates/io/",
@@ -33,6 +34,7 @@ const CRITICAL: &[&str] = &[
"crates/format/",
"crates/affinity/",
"crates/raw/",
"crates/engine/src/atn_cmds",
];
/// `cargo xtask corpus [--all | --pngsuite | --download | --psd | --psd-tools | --heif | --exr | --pixls | --affinity | --atn | --photoshop [--local]] [--update-manifest]`
pub fn cmd(args: &[&str]) -> Result<(), String> {
+1 -1
View File
@@ -239,7 +239,6 @@ pub const AFFINITY: PinnedCorpus = PinnedCorpus {
)
},
};
/// Every pinned corpus, in fetch order.
/// Photoshop Actions files (`.atn`) from public repositories under permissive licences, the
/// real-file oracles of `photocraft-psd::atn` and the engine's `.atn` import (2026-10-12).
/// https://github.com/sbaril/Photoshop-Scripts (MIT): `Actions/`.
@@ -307,6 +306,7 @@ pub const ATN: PinnedCorpus = PinnedCorpus {
},
};
/// Every pinned corpus, in fetch order.
pub const ALL: &[&PinnedCorpus] = &[&PSD_MIXED, &PSD_TOOLS, &PHOTOSHOP, &HEIF, &EXR, &AFFINITY, &ATN];
/// `corpus/pixls`: real camera raws from <https://raw.pixls.us> (released into the public
+2 -1
View File
@@ -180,7 +180,8 @@ impl PinnedCorpus {
let out = staging.join(format!("u{i}"));
std::fs::create_dir_all(&out).map_err(|e| format!("create {}: {e}", out.display()))?;
let mut tar = Command::new("tar");
tar.arg("-xzf").arg(&tgz).arg("-C").arg(&out).arg(format!("{top}/{}", up.subdir));
// macOS folder icons (`Icon\r`) can't be created on Windows and are never corpus files.
tar.arg("-xzf").arg(&tgz).arg("-C").arg(&out).arg("--exclude=Icon\r").arg(format!("{top}/{}", up.subdir));
for (from, _) in up.extras {
// A root-level corpus selection (`subdir == ""`) already extracts the whole repo
// root; adding the same root files as individual tar selectors fails on GNU tar.