test(engine): pin the #6958 exposure fixtures in File Info camera data (#6983)

Main fixed the exposure formatting itself in be9f0c250, so what is left
here is the regression coverage the report asked for, asserted through a
real EXIF block: the two reported values (0.031714 s -> 1/32 s,
0.0215 s -> 1/47 s), a reciprocal that rounds to a whole denominator
(1/3 s), and the three-significant-digit decimal fallback for a time too
far from any whole denominator (0.2731 s -> 0.273 s).

Fixes #6958

Co-authored-by: highperfocused <highperfocused@pm.me>
This commit is contained in:
mroxso
2026-11-05 13:05:38 +01:00
committed by GitHub
co-authored by highperfocused
parent e3ecd73569
commit 50d485ce76
+6
View File
@@ -1300,6 +1300,12 @@ fn camera_data_formats_like_photoshop_and_falls_back_to_xmp() {
assert_eq!(info(Some(0.5), Some(5.6), None), json!({"exposure": "1/2 s", "fNumber": "f/5.6"}));
assert_eq!(info(Some(0.4), None, None), json!({"exposure": "0.4 s"}));
assert_eq!(info(Some(1.0 / 2000.0), None, None), json!({"exposure": "1/2000 s"}));
// Non-standard fractions round to the nearest 1/n instead of losing digits (#6958).
assert_eq!(info(Some(0.031714), None, None), json!({"exposure": "1/32 s"}));
assert_eq!(info(Some(0.0215), None, None), json!({"exposure": "1/47 s"}));
assert_eq!(info(Some(1.0 / 3.0), None, None), json!({"exposure": "1/3 s"}));
// Too far from any whole denominator: three significant digits, not two decimals.
assert_eq!(info(Some(0.2731), None, None), json!({"exposure": "0.273 s"}));
assert_eq!(info(Some(0.0), Some(0.0), Some(0.0)), json!({}));
// No EXIF block (a raw import, XMP-only files): Photoshop's exif:/tiff:/aux: properties.
let xmp = r#"<x:xmpmeta xmlns:x="adobe:ns:meta/"><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">