From a6944cbbdf90be849abca3f5f8864a668b6814b2 Mon Sep 17 00:00:00 2001 From: Grzegorz Martens Date: Sat, 31 Oct 2026 17:43:46 +0100 Subject: [PATCH] M2.6: the widest image that can be averaged is decoded The exclusion's test only looked past the limit, so a mutant moving it by one survived. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01AmsdeUCdTaD72jkDw2pJKY --- crates/optimize/src/images.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/optimize/src/images.rs b/crates/optimize/src/images.rs index 7666c036fc..e99cefe9e1 100644 --- a/crates/optimize/src/images.rs +++ b/crates/optimize/src/images.rs @@ -1425,8 +1425,10 @@ mod dimension_tests { let plain = image(&|_| {}); assert!(spent(&plain, false) > 0, "one that can be averaged is decoded"); assert_eq!(spent(&plain, true), 0, "drawn where a device colour space is remapped"); - let wide = image(&|d| d.set(b"Width".to_vec(), Object::Int(i64::from(pdfcraft_filters::MAX_CCITT_COLUMNS) + 1))); - assert_eq!(spent(&wide, false), 0, "too wide to average"); + let width = |w: i64| image(&move |d| d.set(b"Width".to_vec(), Object::Int(w))); + let widest = i64::from(pdfcraft_filters::MAX_CCITT_COLUMNS); + assert!(spent(&width(widest), false) > 0, "the widest that can be averaged is decoded"); + assert_eq!(spent(&width(widest + 1), false), 0, "too wide to average"); let tinted = image(&|d| d.set(b"ColorSpace".to_vec(), Object::Array(vec![Object::name("CalGray"), Object::Dict(Dict::new())]))); assert_eq!(spent(&tinted, false), 0, "no way to tell which sample is dark"); }