Test that a stub decoder reaches the scan, the ladder and export

FR-RAW-2's "without changing callers" needs a test that would fail if a
caller named the concrete decoder; passing a real RAW through rawler
cannot tell the two apart, because both routes give the same answer.

The decoder_seam tests hand a stub decoder, for a container no real
decoder reads, to the catalog scan (read_metadata_only over a folder
backend), the preview ladder (the remote two-stage fetch, an import's
thumbnail and the viewer's no-GPU fallback) and export (open_for_export,
skipped without an adapter). Each assertion is on something only the
stub produces: its camera and date, a header fetched at its 64-byte
budget rather than HEADER_BYTES, preview and sensor sizes turned by its
orientation. Switching collect_metadata or make_thumbnail back to the
free functions fails two of the three tests.

The develop test_support module is widened to the crate so the export
test shares the one headless GPU context the other tests use. The
requirements note for FR-RAW-2 now records the trait as built and the
second decoder as not.
This commit is contained in:
2026-09-24 21:33:14 -04:00
parent 414094bd38
commit 733a033274
4 changed files with 290 additions and 5 deletions
+9 -3
View File
@@ -243,9 +243,15 @@ read metadata, and `import.rs` fetches exactly that range through `Storage::read
calling `dr_decode::metadata`. The decoder states its requirement and the storage layer satisfies
it; a decoder holding its own `SourceRef` would have had to implement the range policy itself.
What is genuinely not built is the trait. There is one decoder, reached through free functions, so
"without changing callers" is a claim nothing yet tests. The clause stands as written and is
outstanding work, not a satisfied one.
*Status (2026-09-24).* The trait is built: `dr_decode::Decoder`, over bytes — `header_bytes`,
`metadata`, `orientation`, `locate_preview`, `preview` and `decode` — with `dr_decode::Rawler` as
its one implementation, delegating to the free functions that were there before. The catalog scan,
the thumbnail ladder, import, the viewer, export, merge and repairs take a `&dyn Decoder`; only the
places that start a job name `dr_decode::default()`. "Without changing callers" is tested by
`dr-ui`'s `decoder_seam` tests, which hand a stub decoder for a container no real decoder reads to
the scan, the ladder and export, and fail if any of them reaches past the trait. Nothing in the
trait takes a path or a `SourceRef`. The second decoder itself (LibRaw, D2) is not built; S7 (#48)
is what would say when it is needed.
**FR-RAW-3 — Sensor data handling.** Correctly apply per-camera black/white levels, CFA pattern
identification, and camera-native colour matrices. Demosaic quality shall be selectable, with at