comparison mupdf-source/thirdparty/zint/backend/tests/test_tif.c @ 2:b50eed0cc0ef upstream

ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4. The directory name has changed: no version number in the expanded directory now.
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 15 Sep 2025 11:43:07 +0200
parents
children
comparison
equal deleted inserted replaced
1:1d09e1dec1d9 2:b50eed0cc0ef
1 /*
2 libzint - the open source barcode library
3 Copyright (C) 2020-2023 Robin Stuart <rstuart114@gmail.com>
4
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions
7 are met:
8
9 1. Redistributions of source code must retain the above copyright
10 notice, this list of conditions and the following disclaimer.
11 2. Redistributions in binary form must reproduce the above copyright
12 notice, this list of conditions and the following disclaimer in the
13 documentation and/or other materials provided with the distribution.
14 3. Neither the name of the project nor the names of its contributors
15 may be used to endorse or promote products derived from this software
16 without specific prior written permission.
17
18 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 SUCH DAMAGE.
29 */
30 /* SPDX-License-Identifier: BSD-3-Clause */
31
32 #include "testcommon.h"
33 #include <sys/stat.h>
34
35 INTERNAL int tif_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf);
36
37 /* For overview when debugging: ./test_tiff -f pixel_plot -d 5 */
38 static void test_pixel_plot(const testCtx *const p_ctx) {
39 int debug = p_ctx->debug;
40
41 struct item {
42 int width;
43 int height;
44 char *pattern;
45 int repeat;
46 int no_identify; /* identify fails for some valid TIFFs (eg. RGB with LZW and large rows) */
47 int ret;
48 };
49 /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
50 static const struct item data[] = {
51 /* 0*/ { 1, 1, "1", 0, 0, 0 },
52 /* 1*/ { 2, 1, "11", 0, 0, 0 },
53 /* 2*/ { 1, 2, "11", 0, 0, 0 },
54 /* 3*/ { 2, 2, "10", 1, 0, 0 },
55 /* 4*/ { 3, 1, "101", 0, 0, 0 },
56 /* 5*/ { 1, 3, "101", 0, 0, 0 },
57 /* 6*/ { 4, 1, "1010", 0, 0, 0 },
58 /* 7*/ { 1, 4, "1010", 0, 0, 0 },
59 /* 8*/ { 5, 1, "10101", 0, 0, 0 },
60 /* 9*/ { 1, 5, "10101", 0, 0, 0 },
61 /* 10*/ { 3, 2, "101", 1, 0, 0 },
62 /* 11*/ { 100, 2, "10", 1, 0, 0 },
63 /* 12*/ { 2, 100, "10", 1, 0, 0 },
64 /* 13*/ { 3, 3, "101010101", 0, 0, 0 },
65 /* 14*/ { 4, 3, "10", 1, 0, 0 },
66 /* 15*/ { 3, 4, "10", 1, 0, 0 },
67 /* 16*/ { 45, 44, "10", 1, 0, 0 }, /* Strip Count 1, Rows Per Strip 44 (45 * 44 * 4 == 7920) */
68 /* 17*/ { 45, 45, "10", 1, 0, 0 }, /* Strip Count 1, Rows Per Strip 45 (45 * 45 * 4 == 8100) */
69 /* 18*/ { 46, 45, "10", 1, 0, 0 }, /* Strip Count 2, Rows Per Strip 44 (46 * 45 * 4 == 8280) */
70 /* 19*/ { 46, 46, "10", 1, 0, 0 }, /* Strip Count 2, Rows Per Strip 44 */
71 /* 20*/ { 2048, 1, "10", 1, 1, 0 }, /* Strip Count 1, Rows Per Strip 1 (2048 * 4 == 8192) */
72 /* 21*/ { 1, 2048, "10", 1, 0, 0 }, /* Strip Count 1, Rows Per Strip 2048 */
73 /* 22*/ { 2048, 2, "10", 1, 1, 0 }, /* Strip Count 2, Rows Per Strip 1 */
74 /* 23*/ { 2, 2048, "10", 1, 0, 0 }, /* Strip Count 2, Rows Per Strip 1024 (2 * 1024 * 4 == 8192) */
75 /* 24*/ { 2048, 3, "10", 1, 1, 0 }, /* Strip Count 3, Rows Per Strip 1 */
76 /* 25*/ { 3, 2048, "10", 1, 0, 0 }, /* Strip Count 4, Rows Per Strip 682 ((3 * 682 + 2) * 4 == 8192) */
77 /* 26*/ { 2049, 4, "10", 1, 1, 0 }, /* Strip Count 4, Rows Per Strip 1 (2049 * 1 * 4 == 8196) - large rows in 1 strip, even if > 8192 */
78 /* 27*/ { 4, 2049, "10", 1, 0, 0 }, /* Strip Count 5, Rows Per Strip 512 ((4 * 512 + 1) * 4 == 8196) */
79 /* 28*/ { 4096, 1, "10", 1, 1, 0 }, /* Strip Count 1, Rows Per Strip 1 */
80 /* 29*/ { 1, 4096, "10", 1, 0, 0 }, /* Strip Count 2, Rows Per Strip 2048 */
81 /* 30*/ { 4096, 2, "10", 1, 1, 0 }, /* Strip Count 2, Rows Per Strip 1 */
82 /* 31*/ { 2, 4096, "10", 1, 0, 0 }, /* Strip Count 4, Rows Per Strip 1024 */
83 /* 32*/ { 8192, 2, "10", 1, 1, 0 }, /* Strip Count 2, Rows Per Strip 1 */
84 /* 33*/ { 2, 8192, "10", 1, 0, 0 }, /* Strip Count 8, Rows Per Strip 1024 */
85 /* 34*/ { ZINT_MAX_DATA_LEN, 1, "10", 1, 1, 0 }, /* Strip Count 1, Rows Per Strip 1 */
86 /* 35*/ { 1, ZINT_MAX_DATA_LEN, "10", 1, 1 /*NOTE: disabled due to failing on github CI, works locally*/, 0 }, /* Strip Count 9, Rows Per Strip 2048 */
87 /* 36*/ { ZINT_MAX_DATA_LEN, 2, "10", 1, 1, 0 }, /* Strip Count 2, Rows Per Strip 1 */
88 /* 37*/ { 2, ZINT_MAX_DATA_LEN, "10", 1, 1 /*NOTE: disabled due to failing on github CI, works locally*/, 0 }, /* Strip Count 17, Rows Per Strip 1024 */
89 };
90 const int data_size = ARRAY_SIZE(data);
91 int i, ret;
92 struct zint_symbol *symbol = NULL;
93
94 char *tif = "out.tif";
95
96 char data_buf[ZINT_MAX_DATA_LEN * 2 + 1];
97
98 int have_tiffinfo = testUtilHaveTiffInfo();
99 const char *const have_identify = testUtilHaveIdentify();
100
101 testStart("test_pixel_plot");
102
103 symbol = ZBarcode_Create();
104 assert_nonnull(symbol, "Symbol not created\n");
105
106 for (i = 0; i < data_size; i++) {
107 int size;
108
109 if (testContinue(p_ctx, i)) continue;
110
111 strcpy(symbol->outfile, tif);
112
113 symbol->bitmap_width = data[i].width;
114 symbol->bitmap_height = data[i].height;
115 symbol->symbology = BARCODE_ULTRA; /* Use ULTRA with alpha background to force RGB */
116 strcpy(symbol->bgcolour, "FFFFFFEE");
117 symbol->debug |= debug;
118
119 size = data[i].width * data[i].height;
120 assert_nonzero(size < (int) sizeof(data_buf), "i:%d tif_pixel_plot size %d >= sizeof(data_buf) %d\n", i, size, (int) sizeof(data_buf));
121
122 if (data[i].repeat) {
123 testUtilStrCpyRepeat(data_buf, data[i].pattern, size);
124 } else {
125 strcpy(data_buf, data[i].pattern);
126 }
127 assert_equal(size, (int) strlen(data_buf), "i:%d tif_pixel_plot size %d != strlen(data_buf) %d\n", i, size, (int) strlen(data_buf));
128
129 symbol->bitmap = (unsigned char *) data_buf;
130
131 ret = tif_pixel_plot(symbol, (unsigned char *) data_buf);
132 assert_equal(ret, data[i].ret, "i:%d tif_pixel_plot ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
133
134 if (ret < ZINT_ERROR) {
135 if (have_tiffinfo) {
136 ret = testUtilVerifyTiffInfo(symbol->outfile, debug);
137 assert_zero(ret, "i:%d tiffinfo %s ret %d != 0\n", i, symbol->outfile, ret);
138 } else if (have_identify && !data[i].no_identify) {
139 ret = testUtilVerifyIdentify(have_identify, symbol->outfile, debug);
140 assert_zero(ret, "i:%d identify %s ret %d != 0\n", i, symbol->outfile, ret);
141 }
142
143 if (!(debug & ZINT_DEBUG_TEST_KEEP_OUTFILE)) {
144 assert_zero(testUtilRemove(symbol->outfile), "i:%d testUtilRemove(%s) != 0\n", i, symbol->outfile);
145 }
146 } else {
147 if (!(debug & ZINT_DEBUG_TEST_KEEP_OUTFILE)) {
148 (void) testUtilRemove(symbol->outfile);
149 }
150 }
151
152 symbol->bitmap = NULL;
153 }
154
155 ZBarcode_Delete(symbol);
156
157 testFinish();
158 }
159
160 static void test_print(const testCtx *const p_ctx) {
161 int debug = p_ctx->debug;
162
163 struct item {
164 int symbology;
165 int input_mode;
166 int border_width;
167 int output_options;
168 int whitespace_width;
169 int whitespace_height;
170 int show_hrt;
171 int option_1;
172 int option_2;
173 int height;
174 float scale;
175 char *fgcolour;
176 char *bgcolour;
177 char *data;
178 char *composite;
179 char *expected_file;
180 char *comment;
181 };
182 static const struct item data[] = {
183 /* 0*/ { BARCODE_CODE128, -1, -1, -1, 1, -1, -1, -1, -1, 0, 0, "112233", "EEDDCC", "A", "", "code128_fgbg.tif", "" },
184 /* 1*/ { BARCODE_CODE128, -1, -1, -1, 1, -1, -1, -1, -1, 0, 0, "FFFFFF", "000000", "A", "", "code128_reverse.tif", "" },
185 /* 2*/ { BARCODE_CODE128, -1, -1, CMYK_COLOUR, 1, -1, -1, -1, -1, 0, 0, "112233", "CCDDEE", "A", "", "code128_cmyk_fgbg.tif", "" },
186 /* 3*/ { BARCODE_CODE128, -1, -1, -1, 1, -1, -1, -1, -1, 0, 0, "C00000", "FEDCBACC", "A", "", "code128_bgalpha.tif", "" },
187 /* 4*/ { BARCODE_CODE128, -1, -1, -1, 1, -1, -1, -1, -1, 0, 0, "00000099", "FEDCBA", "A", "", "code128_fgalpha.tif", "" },
188 /* 5*/ { BARCODE_CODE128, -1, -1, -1, 1, -1, -1, -1, -1, 0, 0, "00000099", "FEDCBACC", "A", "", "code128_fgbgalpha.tif", "" },
189 /* 6*/ { BARCODE_CODE128, -1, -1, CMYK_COLOUR, 1, -1, -1, -1, -1, 0, 0, "C00000", "FEDCBA", "A", "", "code128_cmyk.tif", "" },
190 /* 7*/ { BARCODE_CODE128, -1, -1, CMYK_COLOUR, 1, -1, -1, -1, -1, 0, 0, "C0000099", "FEDCBACC", "A", "", "code128_cmyk_fgbgalpha.tif", "" },
191 /* 8*/ { BARCODE_CODE128, -1, -1, CMYK_COLOUR, 1, -1, -1, -1, -1, 0, 0, "71,0,40,44", "10,0,20,5", "A", "", "code128_cmyk_fgbgcmyk.tif", "" },
192 /* 9*/ { BARCODE_ULTRA, -1, -1, -1, 1, -1, -1, -1, -1, 0, 0, "C00000", "FEDCBACC", "1234", "", "ultra_bgalpha.tif", "" },
193 /* 10*/ { BARCODE_ULTRA, -1, -1, CMYK_COLOUR, 1, -1, -1, -1, -1, 0, 0, "C00000", "FEDCBACC", "1234", "", "ultra_cmyk_bgalpha.tif", "" },
194 /* 11*/ { BARCODE_ULTRA, -1, -1, -1, 1, -1, -1, -1, -1, 0, 0, "000000BB", "FEDCBA", "1234", "", "ultra_fgalpha.tif", "" },
195 /* 12*/ { BARCODE_ULTRA, -1, -1, -1, 1, -1, -1, -1, -1, 0, 0, "000000BB", "FEDCBACC", "1234", "", "ultra_fgbgalpha.tif", "" },
196 /* 13*/ { BARCODE_ULTRA, -1, -1, -1, 1, -1, -1, -1, -1, 0, 0, "000000BB", "", "1234", "", "ultra_fgalpha_nobg.tif", "" },
197 /* 14*/ { BARCODE_ULTRA, -1, -1, -1, 1, -1, -1, -1, -1, 0, 0, "", "FEDCBACC", "1234", "", "ultra_bgalpha_nofg.tif", "" },
198 /* 15*/ { BARCODE_ULTRA, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0.5f, "", "", "1", "", "ultra_odd.tif", "" },
199 /* 16*/ { BARCODE_ULTRA, -1, -1, CMYK_COLOUR, 1, -1, -1, -1, -1, 0, 0, "", "", "1234", "", "ultra_cmyk.tif", "" },
200 /* 17*/ { BARCODE_ULTRA, -1, 1, BARCODE_BOX, 1, 1, -1, -1, -1, 0, 0, "FF0000", "0000FF", "1234", "", "ultra_fgbg_hvwsp1_box1.tif", "" },
201 /* 18*/ { BARCODE_HANXIN, UNICODE_MODE, -1, -1, -1, -1, -1, 4, 84, 0, 2, "", "", "1", "", "hanxin_v84_l4_scale2.tif", "" },
202 /* 19*/ { BARCODE_AZTEC, -1, -1, -1, -1, -1, -1, -1, 32, 0, 0, "4BE055", "", "1", "", "aztec_v32_fg.tif", "" },
203 /* 20*/ { BARCODE_DAFT, -1, -1, -1, -1, -1, -1, -1, -1, 8, 0.5f, "", "", "F", "", "daft_height8_scale0.5.tif", "" },
204 /* 21*/ { BARCODE_DAFT, -1, -1, -1, -1, -1, -1, -1, -1, 1, 0.5f, "", "", "DAFT", "", "daft_height1_scale0.5.tif", "" },
205 /* 22*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "9501234", "", "ean8_gss_5.2.2.2-1.tif", "" },
206 /* 23*/ { BARCODE_EANX, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, 0, 0, "", "", "9501234", "", "ean8_gss_5.2.2.2-1_gws.tif", "" },
207 };
208 const int data_size = ARRAY_SIZE(data);
209 int i, length, ret;
210 struct zint_symbol *symbol = NULL;
211
212 const char *data_dir = "/backend/tests/data/tif";
213 const char *tif = "out.tif";
214 char expected_file[1024];
215 char escaped[1024];
216 int escaped_size = 1024;
217 unsigned char filebuf[32768];
218 int filebuf_size;
219 char *text;
220
221 int have_tiffinfo = testUtilHaveTiffInfo();
222 const char *const have_identify = testUtilHaveIdentify();
223
224 testStartSymbol("test_print", &symbol);
225
226 if (p_ctx->generate) {
227 char data_dir_path[1024];
228 assert_nonzero(testUtilDataPath(data_dir_path, sizeof(data_dir_path), data_dir, NULL), "testUtilDataPath(%s) == 0\n", data_dir);
229 if (!testUtilDirExists(data_dir_path)) {
230 ret = testUtilMkDir(data_dir_path);
231 assert_zero(ret, "testUtilMkDir(%s) ret %d != 0 (%d: %s)\n", data_dir_path, ret, errno, strerror(errno));
232 }
233 }
234
235 for (i = 0; i < data_size; i++) {
236 int text_length;
237
238 if (testContinue(p_ctx, i)) continue;
239
240 symbol = ZBarcode_Create();
241 assert_nonnull(symbol, "Symbol not created\n");
242
243 length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, data[i].output_options, data[i].data, -1, debug);
244 if (data[i].show_hrt != -1) {
245 symbol->show_hrt = data[i].show_hrt;
246 }
247 if (data[i].height) {
248 symbol->height = data[i].height;
249 }
250 if (data[i].scale) {
251 symbol->scale = data[i].scale;
252 }
253 if (data[i].border_width != -1) {
254 symbol->border_width = data[i].border_width;
255 }
256 if (data[i].whitespace_width != -1) {
257 symbol->whitespace_width = data[i].whitespace_width;
258 }
259 if (data[i].whitespace_height != -1) {
260 symbol->whitespace_height = data[i].whitespace_height;
261 }
262 if (*data[i].fgcolour) {
263 strcpy(symbol->fgcolour, data[i].fgcolour);
264 }
265 if (*data[i].bgcolour) {
266 strcpy(symbol->bgcolour, data[i].bgcolour);
267 }
268 if (strlen(data[i].composite)) {
269 text = data[i].composite;
270 strcpy(symbol->primary, data[i].data);
271 } else {
272 text = data[i].data;
273 }
274 text_length = (int) strlen(text);
275
276 ret = ZBarcode_Encode(symbol, (unsigned char *) text, text_length);
277 assert_zero(ret, "i:%d %s ZBarcode_Encode ret %d != 0 %s\n", i, testUtilBarcodeName(data[i].symbology), ret, symbol->errtxt);
278
279 strcpy(symbol->outfile, tif);
280 ret = ZBarcode_Print(symbol, 0);
281 assert_zero(ret, "i:%d %s ZBarcode_Print %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret);
282
283 assert_nonzero(testUtilDataPath(expected_file, sizeof(expected_file), data_dir, data[i].expected_file), "i:%d testUtilDataPath == 0\n", i);
284
285 if (p_ctx->generate) {
286 printf(" /*%3d*/ { %s, %s, %d, %s, %d, %d, %d, %d, %d, %d, %.5g, \"%s\",\"%s\", \"%s\", \"%s\", \"%s\", \"%s\" },\n",
287 i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), data[i].border_width, testUtilOutputOptionsName(data[i].output_options),
288 data[i].whitespace_width, data[i].whitespace_height, data[i].show_hrt, data[i].option_1, data[i].option_2,
289 data[i].height, data[i].scale, data[i].fgcolour, data[i].bgcolour,
290 testUtilEscape(data[i].data, length, escaped, escaped_size), data[i].composite, data[i].expected_file, data[i].comment);
291 ret = testUtilRename(symbol->outfile, expected_file);
292 assert_zero(ret, "i:%d testUtilRename(%s, %s) ret %d != 0\n", i, symbol->outfile, expected_file, ret);
293 if (have_tiffinfo) {
294 ret = testUtilVerifyTiffInfo(expected_file, debug);
295 assert_zero(ret, "i:%d %s tiffinfo %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), expected_file, ret);
296 } else if (have_identify) {
297 ret = testUtilVerifyIdentify(have_identify, expected_file, debug);
298 assert_zero(ret, "i:%d %s identify %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), expected_file, ret);
299 }
300 } else {
301 assert_nonzero(testUtilExists(symbol->outfile), "i:%d testUtilExists(%s) == 0\n", i, symbol->outfile);
302 assert_nonzero(testUtilExists(expected_file), "i:%d testUtilExists(%s) == 0\n", i, expected_file);
303
304 ret = testUtilCmpBins(symbol->outfile, expected_file);
305 assert_zero(ret, "i:%d %s testUtilCmpBins(%s, %s) %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, expected_file, ret);
306
307 ret = testUtilReadFile(symbol->outfile, filebuf, sizeof(filebuf), &filebuf_size); /* For BARCODE_MEMORY_FILE */
308 assert_zero(ret, "i:%d %s testUtilReadFile(%s) %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret);
309
310 if (!(debug & ZINT_DEBUG_TEST_KEEP_OUTFILE)) {
311 assert_zero(testUtilRemove(symbol->outfile), "i:%d testUtilRemove(%s) != 0\n", i, symbol->outfile);
312 }
313
314 symbol->output_options |= BARCODE_MEMORY_FILE;
315 ret = ZBarcode_Print(symbol, 0);
316 assert_zero(ret, "i:%d %s ZBarcode_Print %s ret %d != 0 (%s)\n",
317 i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret, symbol->errtxt);
318 assert_nonnull(symbol->memfile, "i:%d %s memfile NULL\n", i, testUtilBarcodeName(data[i].symbology));
319 assert_equal(symbol->memfile_size, filebuf_size, "i:%d %s memfile_size %d != %d\n",
320 i, testUtilBarcodeName(data[i].symbology), symbol->memfile_size, filebuf_size);
321 assert_zero(memcmp(symbol->memfile, filebuf, symbol->memfile_size), "i:%d %s memcmp(memfile, filebuf) != 0\n",
322 i, testUtilBarcodeName(data[i].symbology));
323 }
324
325 ZBarcode_Delete(symbol);
326 }
327
328 testFinish();
329 }
330
331 static void test_outfile(const testCtx *const p_ctx) {
332 int ret;
333 int skip_readonly_test = 0;
334 struct zint_symbol symbol = {0};
335 unsigned char data[] = { "1" };
336
337 (void)p_ctx;
338
339 testStart("test_outfile");
340
341 symbol.symbology = BARCODE_CODE128;
342 symbol.bitmap = data;
343 symbol.bitmap_width = symbol.bitmap_height = 1;
344
345 strcpy(symbol.outfile, "test_tif_out.tif");
346 #ifndef _WIN32
347 skip_readonly_test = getuid() == 0; /* Skip if running as root on Unix as can't create read-only file */
348 #endif
349 if (!skip_readonly_test) {
350 static char expected_errtxt[] = "672: Could not open TIF output file ("; /* Excluding OS-dependent `errno` stuff */
351
352 (void) testUtilRmROFile(symbol.outfile); /* In case lying around from previous fail */
353 assert_nonzero(testUtilCreateROFile(symbol.outfile), "tif_pixel_plot testUtilCreateROFile(%s) fail (%d: %s)\n", symbol.outfile, errno, strerror(errno));
354
355 ret = tif_pixel_plot(&symbol, data);
356 assert_equal(ret, ZINT_ERROR_FILE_ACCESS, "tif_pixel_plot ret %d != ZINT_ERROR_FILE_ACCESS (%d) (%s)\n", ret, ZINT_ERROR_FILE_ACCESS, symbol.errtxt);
357 assert_zero(testUtilRmROFile(symbol.outfile), "tif_pixel_plot testUtilRmROFile(%s) != 0 (%d: %s)\n", symbol.outfile, errno, strerror(errno));
358 assert_zero(strncmp(symbol.errtxt, expected_errtxt, sizeof(expected_errtxt) - 1), "strncmp(%s, %s) != 0\n", symbol.errtxt, expected_errtxt);
359 }
360
361 symbol.output_options |= BARCODE_STDOUT;
362
363 printf("<<<Begin ignore (TIF to stdout)\n"); fflush(stdout);
364 ret = tif_pixel_plot(&symbol, data);
365 printf("\n<<<End ignore (TIF to stdout)\n"); fflush(stdout);
366 assert_zero(ret, "tif_pixel_plot ret %d != 0 (%s)\n", ret, symbol.errtxt);
367
368 testFinish();
369 }
370
371 int main(int argc, char *argv[]) {
372
373 testFunction funcs[] = { /* name, func */
374 { "test_pixel_plot", test_pixel_plot },
375 { "test_print", test_print },
376 { "test_outfile", test_outfile },
377 };
378
379 testRun(argc, argv, funcs, ARRAY_SIZE(funcs));
380
381 testReport();
382
383 return 0;
384 }
385
386 /* vim: set ts=4 sw=4 et : */