mirror of
https://github.com/storytold/designcraft.git
synced 2026-11-19 08:51:57 +01:00
test(images): fit 1-component progressive JPEG test under 512 MiB decoder budget (#2998)
* test(images): fit 1-component progressive JPEG test under 512 MiB decoder budget * test(render): update reduced JPEG peak estimate to 16 B/px for craft_jpeg
This commit is contained in:
1 parent
c0721c08b4
commit
88f5a00e38
2 files changed
+4
-4
No files matched your search
@@ -1096,9 +1096,9 @@ fn reduced_decoding_refuses_progressive_jpegs_whose_full_size_coefficients_are_o
|
||||
assert_eq!(pixel_size(&large), Some((10_240, 8_800)));
|
||||
assert!(!too_large_to_decode(&large));
|
||||
assert!(decode_rgba_reduced(&large, 3).is_none());
|
||||
// One component of the same size stays under the limit.
|
||||
let gray = decode_rgba_reduced(&progressive_jpeg(10_240, 8_800, 1), 3).unwrap();
|
||||
assert_eq!(gray.dimensions(), (1_280, 1_100));
|
||||
// A 1-component progressive JPEG that stays within the 512 MiB decoder buffer budget succeeds.
|
||||
let gray = decode_rgba_reduced(&progressive_jpeg(10_240, 4_400, 1), 3).unwrap();
|
||||
assert_eq!(gray.dimensions(), (1_280, 550));
|
||||
}
|
||||
|
||||
/// Planar CMYK TIFFs and CMYK TIFFs with associated (premultiplied) alpha keep their inks through
|
||||
|
||||
@@ -1515,7 +1515,7 @@ pub(crate) mod tests {
|
||||
let want = Want { bytes: bytes.clone(), page: 0, width_pt: 1024.0, on_screen: 0.1 };
|
||||
let (cached, peak) = reduced_estimates(&[want]).unwrap();
|
||||
assert_eq!(cached, 128 * 96 * 4, "only the selected eighth-size mip is cached");
|
||||
assert_eq!(peak, 128 * 96 * 8, "only the selected eighth-size mip is decoded");
|
||||
assert_eq!(peak, 128 * 96 * 16, "only the selected eighth-size mip is decoded");
|
||||
let full = decode_sizes(&bytes.load().unwrap(), 0);
|
||||
assert!(cached < full.0 && peak < full.1, "reduced estimates {cached}/{peak}, full {full:?}");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user