ui-egui, raw: fix the two main CI failures left by the craft-libs format migration

- ui-egui: the typed TIFF open path is taken on TIFF magic bytes again, not on a
  `.tif` name. `photocraft_formats::detect(name, ..)` falls back to the extension,
  so any `.tif` file bypassed the import service (#14236);
  `files_dropped_with_no_document_open_all_open` caught it.
- raw: `recovers_a_known_matrix_and_curve` pins its fixture's white level to the
  12-bit range. craft-raw's NEF reader ignores a WhiteLevel tag and read the
  synthetic image's flat brightest patch (2370) as a saturation plateau, which
  skewed the fitted tone curve.
This commit is contained in:
RickiNano committed 2026-11-14 10:06:04 +01:00
1 parent 5b27ff6fe3
commit 2c8fab58ef
2 files changed
+7 -3

No files matched your search

+4 -1
View File
@@ -849,7 +849,10 @@ mod tests {
let cam: Vec<[f32; 3]> = patches(w, h).iter().map(|p| [0, 1, 2].map(|k| p[k] / WB[k] as f32)).collect();
let data = crate::testgen::mosaic(&cam, w, [0, 1, 1, 2], 0, 4095);
let b = crate::testgen::tiff_ep("NIKON CORPORATION", w, h, &data, [0, 1, 1, 2], 12, vec![]);
let s = crate::decode(&b, &crate::Limits::default()).unwrap();
let mut s = crate::decode(&b, &crate::Limits::default()).unwrap();
// The data spans the full 12-bit range. craft-raw's NEF reader takes no WhiteLevel tag
// and reads the brightest flat, noiseless patch as a saturation plateau.
s.white = [4095.0; 3];
let to_srgb = color::invert(&color::srgb_to_xyz_d50()).unwrap();
let pro_to_srgb = color::mul(&to_srgb, &color::rgb_to_xyz(color::ROMM, color::D50_XY));
let f = |x: f64| 1.6 * x / (1.0 + 0.6 * x);
+3 -2
View File
@@ -97,8 +97,9 @@ impl PhotocraftApp {
// A PSD and a magic-detected TIFF both go through the typed IO path: only it carries
// `PsdApprovalRequired` (and, for a PSD, the structured damaged flag), so a layered
// TIFF's high-memory decision can raise its prompt instead of becoming a terminal
// string. Every other format keeps the shell's import service.
let typed_open = photocraft_io::is_psd(bytes) || photocraft_formats::detect(name, bytes) == Some(photocraft_formats::Format::Tiff);
// string. Every other format keeps the shell's import service. `detect` gets no name:
// given one it falls back to the extension, and a `.tif` name alone is no TIFF.
let typed_open = photocraft_io::is_psd(bytes) || photocraft_formats::detect("", bytes) == Some(photocraft_formats::Format::Tiff);
let (mut doc, warnings, damaged) = if typed_open {
// Read PSD damage as structured information in the same decode, not by
// retrying an error or matching the text of a compatibility warning. A TIFF never