From 857021de84b34a9bdb43156b84adfff0e3b0bdea Mon Sep 17 00:00:00 2001 From: gitlost Date: Thu, 18 Jul 2024 01:04:50 +0100 Subject: [PATCH] png: allow for use of zlib-ng, a zlib replacement, by Fedora 40, by avoiding binary comparison in tests --- backend/tests/test_png.c | 5 ++++- backend/tests/test_print.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/backend/tests/test_png.c b/backend/tests/test_png.c index b8f5f497..013646df 100644 --- a/backend/tests/test_png.c +++ b/backend/tests/test_png.c @@ -1,6 +1,6 @@ /* libzint - the open source barcode library - Copyright (C) 2020-2023 Robin Stuart + Copyright (C) 2020-2024 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -31,6 +31,7 @@ #include "testcommon.h" #include +#include /* For ZLIBNG_VERSION define (if any) */ #include INTERNAL int png_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf); @@ -330,8 +331,10 @@ static void test_print(const testCtx *const p_ctx) { ret = testUtilCmpPngs(symbol->outfile, expected_file); assert_zero(ret, "i:%d %s testUtilCmpPngs(%s, %s) %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, expected_file, ret); + #ifndef ZLIBNG_VERSION /* zlib-ng (used by e.g. Fedora 40) may produce non-binary compat output */ ret = testUtilCmpBins(symbol->outfile, expected_file); assert_zero(ret, "i:%d %s testUtilCmpBins(%s, %s) %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, expected_file, ret); + #endif ret = testUtilReadFile(symbol->outfile, filebuf, sizeof(filebuf), &filebuf_size); /* For BARCODE_MEMORY_FILE */ assert_zero(ret, "i:%d %s testUtilReadFile(%s) %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret); diff --git a/backend/tests/test_print.c b/backend/tests/test_print.c index 3d6343b9..85fbbe1d 100644 --- a/backend/tests/test_print.c +++ b/backend/tests/test_print.c @@ -1,6 +1,6 @@ /* libzint - the open source barcode library - Copyright (C) 2020-2023 Robin Stuart + Copyright (C) 2020-2024 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -30,6 +30,7 @@ /* SPDX-License-Identifier: BSD-3-Clause */ #include "testcommon.h" +#include /* For ZLIBNG_VERSION define (if any) */ #include #define TEST_PRINT_OVERWRITE_EXPECTED "bmp,emf,eps,gif,pcx,png,svg,tif,txt" @@ -191,8 +192,10 @@ static void test_print(const testCtx *const p_ctx) { } else if (strcmp(exts[j], "png") == 0) { ret = testUtilCmpPngs(symbol->outfile, expected_file); assert_zero(ret, "i:%d %s testUtilCmpPngs(%s, %s) %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, expected_file, ret); + #ifndef ZLIBNG_VERSION /* zlib-ng (used by e.g. Fedora 40) may produce non-binary compat output */ ret = testUtilCmpBins(symbol->outfile, expected_file); assert_zero(ret, "i:%d %s testUtilCmpBins(%s, %s) %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, expected_file, ret); + #endif } else if (strcmp(exts[j], "svg") == 0) { ret = testUtilCmpSvgs(symbol->outfile, expected_file); assert_zero(ret, "i:%d %s testUtilCmpSvgs(%s, %s) %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, expected_file, ret);