png: allow for use of zlib-ng, a zlib replacement, by Fedora 40,

by avoiding binary comparison in tests
This commit is contained in:
gitlost 2024-07-18 01:04:50 +01:00
parent fb3b3001aa
commit 857021de84
2 changed files with 8 additions and 2 deletions

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2020-2023 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2020-2024 Robin Stuart <rstuart114@gmail.com>
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 <errno.h>
#include <zlib.h> /* For ZLIBNG_VERSION define (if any) */
#include <sys/stat.h>
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);

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2020-2023 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2020-2024 Robin Stuart <rstuart114@gmail.com>
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 <zlib.h> /* For ZLIBNG_VERSION define (if any) */
#include <sys/stat.h>
#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);