From 76e5ec217fbdc882bacc40ae3f2276d28507c341 Mon Sep 17 00:00:00 2001 From: John Bowler Date: Mon, 14 Oct 2024 12:26:22 -0700 Subject: [PATCH] [libpng16] test: Add a compile-time check in pngimage.c to avoid a failure Disable the check on `interlace_method` inside function `compare_read` in pngimage.c, if WRITE_INTERLACING is not supported. If interlaced encoding is disabled inside libpng, the encoded images are non-interlaced silently and unconditionally. This commit updates the image comparison to skip the interlace check in the resultant image; other behavior is still checked. This is a cherry-pick of commit d9f13d8d846e08b00f6530b7a5fe07039d48c78d from branch 'libpng18'. Reviewed-by: Cosmin Truta Signed-off-by: John Bowler Signed-off-by: Cosmin Truta --- contrib/libtests/pngimage.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/contrib/libtests/pngimage.c b/contrib/libtests/pngimage.c index 1d65247836..d22f7bcd09 100644 --- a/contrib/libtests/pngimage.c +++ b/contrib/libtests/pngimage.c @@ -1018,7 +1018,12 @@ compare_read(struct display *dp, int applied_transforms) C(height); C(bit_depth); C(color_type); - C(interlace_method); +# ifdef PNG_WRITE_INTERLACING_SUPPORTED + /* If write interlace has been disabled, the PNG file is still + * written correctly, but as a regular (not-interlaced) PNG. + */ + C(interlace_method); +# endif C(compression_method); C(filter_method);