Mercurial > hgrepos > Python2 > PyMuPDF
comparison mupdf-source/thirdparty/zint/backend/tests/test_emf.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-2024 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 static void test_print(const testCtx *const p_ctx) { | |
| 36 int debug = p_ctx->debug; | |
| 37 | |
| 38 struct item { | |
| 39 int symbology; | |
| 40 int input_mode; | |
| 41 int border_width; | |
| 42 int output_options; | |
| 43 int whitespace_width; | |
| 44 int whitespace_height; | |
| 45 int option_1; | |
| 46 int option_2; | |
| 47 float scale; | |
| 48 float dpmm; | |
| 49 char *fgcolour; | |
| 50 char *bgcolour; | |
| 51 int rotate_angle; | |
| 52 char *data; | |
| 53 char *expected_file; | |
| 54 char *comment; | |
| 55 }; | |
| 56 static const struct item data[] = { | |
| 57 /* 0*/ { BARCODE_CODE128, UNICODE_MODE, -1, BOLD_TEXT, -1, -1, -1, -1, 0.0f, 0, "", "", 0, "Égjpqy", "code128_egrave_bold.emf", "" }, | |
| 58 /* 1*/ { BARCODE_CODE128, UNICODE_MODE, -1, BOLD_TEXT, -1, -1, -1, -1, 0.0f, 100.0f / 25.4f, "", "", 0, "Égjpqy", "code128_egrave_bold_100dpi.emf", "" }, | |
| 59 /* 2*/ { BARCODE_CODE128, UNICODE_MODE, -1, BOLD_TEXT, -1, -1, -1, -1, 0.0f, 150.0f / 25.4f, "", "", 0, "Égjpqy", "code128_egrave_bold_150dpi.emf", "" }, | |
| 60 /* 3*/ { BARCODE_CODE128, UNICODE_MODE, -1, BOLD_TEXT, -1, -1, -1, -1, 0.0f, 300.0f / 25.4f, "", "", 0, "Égjpqy", "code128_egrave_bold_300dpi.emf", "" }, | |
| 61 /* 4*/ { BARCODE_CODE128, UNICODE_MODE, -1, BOLD_TEXT, -1, -1, -1, -1, 0.0f, 400.0f / 25.4f, "", "", 0, "Égjpqy", "code128_egrave_bold_400dpi.emf", "" }, | |
| 62 /* 5*/ { BARCODE_CODE128, UNICODE_MODE, -1, BOLD_TEXT, -1, -1, -1, -1, 0.0f, 1200.0f / 25.4f, "", "", 0, "Égjpqy", "code128_egrave_bold_1200dpi.emf", "" }, | |
| 63 /* 6*/ { BARCODE_TELEPEN, -1, -1, -1, -1, -1, -1, -1, 0.0f, 0, "147AD0", "FC9630", 0, "123", "telenum_fg_bg.emf", "" }, | |
| 64 /* 7*/ { BARCODE_TELEPEN, -1, -1, -1, -1, -1, -1, -1, 0.0f, 150.0f / 25.4f, "147AD0", "FC9630", 0, "123", "telenum_fg_bg_150dpi.emf", "" }, | |
| 65 /* 8*/ { BARCODE_ULTRA, -1, -1, -1, 5, -1, -1, -1, 0.0f, 0, "147AD0", "FC9630", 0, "123", "ultracode_fg_bg.emf", "" }, | |
| 66 /* 9*/ { BARCODE_ULTRA, -1, 2, BARCODE_BOX, 2, 2, -1, -1, 0.0f, 0, "FF0000", "0000FF", 0, "123", "ultracode_fg_bg_box2.emf", "" }, | |
| 67 /* 10*/ { BARCODE_ULTRA, -1, 2, BARCODE_BOX, 2, 2, -1, -1, 0.0f, 600.0f / 25.4f, "FF0000", "0000FF", 0, "123", "ultracode_fg_bg_box2_600dpi.emf", "" }, | |
| 68 /* 11*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, 0.0f, 0, "", "", 0, "9501101531000", "ean13_ggs_5.2.2.1-1.emf", "" }, | |
| 69 /* 12*/ { BARCODE_EANX, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, 0.0f, 0, "", "", 0, "9501101531000", "ean13_ggs_5.2.2.1-1_gws.emf", "" }, | |
| 70 /* 13*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, 0.0f, 0, "", "", 0, "9780877799306+54321", "ean13_5addon_ggs_5.2.2.5.2-2.emf", "" }, | |
| 71 /* 14*/ { BARCODE_EANX, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, 0.0f, 0, "", "", 0, "9780877799306+54321", "ean13_5addon_ggs_5.2.2.5.2-2_gws.emf", "" }, | |
| 72 /* 15*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, 0.0f, 0, "", "", 0, "210987654321+54321", "ean13_5addon_#185.emf", "#185 Byte count, font data, HeaderExtension1/2" }, | |
| 73 /* 16*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, 0.0f, 0, "", "", 0, "9501234", "ean8_gss_5.2.2.2-1.emf", "" }, | |
| 74 /* 17*/ { BARCODE_EANX, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, 0.0f, 0, "", "", 0, "9501234", "ean8_gss_5.2.2.2-1_gws.emf", "" }, | |
| 75 /* 18*/ { BARCODE_EANX, -1, -1, EANUPC_GUARD_WHITESPACE, 3, -1, -1, -1, 0.0f, 0, "", "", 0, "9501234", "ean8_gss_5.2.2.2-1_gws_wsw3.emf", "" }, | |
| 76 /* 19*/ { BARCODE_EANX, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, 2.5f, 0, "", "", 0, "9501234", "ean8_gss_5.2.2.2-1_gws_sc2_5.emf", "" }, | |
| 77 /* 20*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, -1, -1, 0.0f, 0, "", "", 0, "012345678905+24", "upca_2addon_ggs_5.2.6.6-5.emf", "" }, | |
| 78 /* 21*/ { BARCODE_UPCA, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, 0.0f, 0, "", "", 0, "012345678905+24", "upca_2addon_ggs_5.2.6.6-5_gws.emf", "" }, | |
| 79 /* 22*/ { BARCODE_UPCA, -1, -1, EANUPC_GUARD_WHITESPACE, 1, 2, -1, -1, 0.0f, 0, "", "", 0, "012345678905+24", "upca_2addon_ggs_5.2.6.6-5_gws_wsw1h2.emf", "" }, | |
| 80 /* 23*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, -1, -1, 0.0f, 0, "", "", 0, "0123456+12", "upce_2addon.emf", "" }, | |
| 81 /* 24*/ { BARCODE_UPCE, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, 0.0f, 0, "", "", 0, "0123456+12", "upce_2addon_gws.emf", "" }, | |
| 82 /* 25*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, -1, -1, 0.0f, 150.f / 25.4f, "", "", 0, "0123456+12", "upce_2addon_150dpi.emf", "" }, | |
| 83 /* 26*/ { BARCODE_UPCE, -1, -1, SMALL_TEXT | BOLD_TEXT, -1, -1, -1, -1, 0.0f, 0, "", "", 0, "0123456+12", "upce_2addon_small_bold.emf", "" }, | |
| 84 /* 27*/ { BARCODE_UPCE, -1, -1, SMALL_TEXT | BOLD_TEXT | EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, 0.0f, 0, "", "", 0, "0123456+12", "upce_2addon_small_bold_gws.emf", "" }, | |
| 85 /* 28*/ { BARCODE_ITF14, -1, -1, BOLD_TEXT, -1, -1, -1, -1, 0.0f, 0, "", "", 0, "123", "itf14_bold.emf", "" }, | |
| 86 /* 29*/ { BARCODE_ITF14, -1, -1, BOLD_TEXT, -1, -1, -1, -1, 0.0f, 600.f / 25.4f, "", "", 0, "123", "itf14_bold_600dpi.emf", "" }, | |
| 87 /* 30*/ { BARCODE_CODE39, -1, -1, -1, -1, -1, -1, -1, 0.0f, 0, "", "", 90, "123", "code39_rotate_90.emf", "" }, | |
| 88 /* 31*/ { BARCODE_CODE39, -1, -1, -1, -1, -1, -1, -1, 0.0f, 300.f / 25.4f, "", "", 90, "123", "code39_rotate_90_300dpi.emf", "" }, | |
| 89 /* 32*/ { BARCODE_CODE39, -1, -1, -1, -1, -1, -1, -1, 0.0f, 0, "", "", 180, "123", "code39_rotate_180.emf", "" }, | |
| 90 /* 33*/ { BARCODE_CODE39, -1, -1, -1, -1, -1, -1, -1, 0.0f, 0, "", "", 270, "123", "code39_rotate_270.emf", "" }, | |
| 91 /* 34*/ { BARCODE_MAXICODE, -1, -1, -1, -1, -1, -1, -1, 0.0f, 0, "E0E0E0", "700070", 0, "THIS IS A 93 CHARACTER CODE SET A MESSAGE THAT FILLS A MODE 4, UNAPPENDED, MAXICODE SYMBOL...", "maxicode_#185.emf", "#185 Maxicode scaling" }, | |
| 92 /* 35*/ { BARCODE_MAXICODE, -1, -1, -1, -1, -1, -1, -1, 0.0f, 150.f / 25.4f, "E0E0E0", "700070", 0, "THIS IS A 93 CHARACTER CODE SET A MESSAGE THAT FILLS A MODE 4, UNAPPENDED, MAXICODE SYMBOL...", "maxicode_#185_150dpi.emf", "#185 Maxicode scaling" }, | |
| 93 /* 36*/ { BARCODE_MAXICODE, -1, -1, -1, -1, -1, -1, -1, 0.0f, 600.f / 25.4f, "E0E0E0", "700070", 0, "THIS IS A 93 CHARACTER CODE SET A MESSAGE THAT FILLS A MODE 4, UNAPPENDED, MAXICODE SYMBOL...", "maxicode_#185_600dpi.emf", "#185 Maxicode scaling" }, | |
| 94 /* 37*/ { BARCODE_MAXICODE, -1, -1, -1, -1, -1, -1, -1, 0.0f, 0, "", "FFFFFF00", 90, "THIS IS A 93 CHARACTER CODE SET A MESSAGE THAT FILLS A MODE 4, UNAPPENDED, MAXICODE SYMBOL...", "maxicode_rotate_90_nobg.emf", "" }, | |
| 95 /* 38*/ { BARCODE_MAXICODE, -1, -1, -1, -1, -1, -1, -1, 0.0f, 300.0f, "", "FFFFFF00", 90, "THIS IS A 93 CHARACTER CODE SET A MESSAGE THAT FILLS A MODE 4, UNAPPENDED, MAXICODE SYMBOL...", "maxicode_rotate_90_nobg_300dpi.emf", "" }, | |
| 96 /* 39*/ { BARCODE_UPU_S10, -1, -1, CMYK_COLOUR, -1, -1, -1, -1, 0.0f, 0, "71,0,40,44", "FFFFFF00", 0, "QA47312482PS", "upu_s10_cmyk_nobg.emf", "" }, | |
| 97 }; | |
| 98 const int data_size = ARRAY_SIZE(data); | |
| 99 int i, length, ret; | |
| 100 struct zint_symbol *symbol = NULL; | |
| 101 | |
| 102 const char *data_dir = "/backend/tests/data/emf"; | |
| 103 const char *emf = "out.emf"; | |
| 104 char expected_file[1024]; | |
| 105 char escaped[1024]; | |
| 106 int escaped_size = 1024; | |
| 107 unsigned char filebuf[32768]; | |
| 108 int filebuf_size; | |
| 109 | |
| 110 int have_libreoffice = 0; | |
| 111 if (p_ctx->generate) { | |
| 112 have_libreoffice = testUtilHaveLibreOffice(); | |
| 113 } | |
| 114 | |
| 115 testStartSymbol("test_print", &symbol); | |
| 116 | |
| 117 if (p_ctx->generate) { | |
| 118 char data_dir_path[1024]; | |
| 119 assert_nonzero(testUtilDataPath(data_dir_path, sizeof(data_dir_path), data_dir, NULL), "testUtilDataPath(%s) == 0\n", data_dir); | |
| 120 if (!testUtilDirExists(data_dir_path)) { | |
| 121 ret = testUtilMkDir(data_dir_path); | |
| 122 assert_zero(ret, "testUtilMkDir(%s) ret %d != 0 (%d: %s)\n", data_dir_path, ret, errno, strerror(errno)); | |
| 123 } | |
| 124 } | |
| 125 | |
| 126 for (i = 0; i < data_size; i++) { | |
| 127 | |
| 128 if (testContinue(p_ctx, i)) continue; | |
| 129 | |
| 130 symbol = ZBarcode_Create(); | |
| 131 assert_nonnull(symbol, "Symbol not created\n"); | |
| 132 | |
| 133 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); | |
| 134 if (data[i].border_width != -1) { | |
| 135 symbol->border_width = data[i].border_width; | |
| 136 } | |
| 137 if (data[i].whitespace_width != -1) { | |
| 138 symbol->whitespace_width = data[i].whitespace_width; | |
| 139 } | |
| 140 if (data[i].whitespace_height != -1) { | |
| 141 symbol->whitespace_height = data[i].whitespace_height; | |
| 142 } | |
| 143 if (data[i].scale) { | |
| 144 symbol->scale = data[i].scale; | |
| 145 } | |
| 146 if (data[i].dpmm) { | |
| 147 symbol->dpmm = data[i].dpmm; | |
| 148 symbol->scale = ZBarcode_Scale_From_XdimDp(symbol->symbology, ZBarcode_Default_Xdim(symbol->symbology), symbol->dpmm, "EMF"); | |
| 149 } | |
| 150 if (*data[i].fgcolour) { | |
| 151 strcpy(symbol->fgcolour, data[i].fgcolour); | |
| 152 } | |
| 153 if (*data[i].bgcolour) { | |
| 154 strcpy(symbol->bgcolour, data[i].bgcolour); | |
| 155 } | |
| 156 | |
| 157 ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); | |
| 158 assert_zero(ret, "i:%d %s ZBarcode_Encode ret %d != 0 %s\n", i, testUtilBarcodeName(data[i].symbology), ret, symbol->errtxt); | |
| 159 | |
| 160 strcpy(symbol->outfile, emf); | |
| 161 ret = ZBarcode_Print(symbol, data[i].rotate_angle); | |
| 162 assert_zero(ret, "i:%d %s ZBarcode_Print %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret); | |
| 163 | |
| 164 assert_nonzero(testUtilDataPath(expected_file, sizeof(expected_file), data_dir, data[i].expected_file), "i:%d testUtilDataPath == 0\n", i); | |
| 165 | |
| 166 if (p_ctx->generate) { | |
| 167 printf(" /*%3d*/ { %s, %s, %d, %s, %d, %d, %d, %d, %g, \"%s\", \"%s\", %d, \"%s\", \"%s\", \"%s\" },\n", | |
| 168 i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), data[i].border_width, | |
| 169 testUtilOutputOptionsName(data[i].output_options), data[i].whitespace_width, data[i].whitespace_height, | |
| 170 data[i].option_1, data[i].option_2, data[i].dpmm, data[i].fgcolour, data[i].bgcolour, data[i].rotate_angle, | |
| 171 testUtilEscape(data[i].data, length, escaped, escaped_size), data[i].expected_file, data[i].comment); | |
| 172 ret = testUtilRename(symbol->outfile, expected_file); | |
| 173 assert_zero(ret, "i:%d testUtilRename(%s, %s) ret %d != 0\n", i, symbol->outfile, expected_file, ret); | |
| 174 if (have_libreoffice) { | |
| 175 /* Note this will fail (on Ubuntu anyway) if LibreOffice Base/Calc/Impress/Writer running (i.e. anything but LibreOffice Draw) | |
| 176 Doesn't seem to be a way to force Draw invocation through the command line */ | |
| 177 ret = testUtilVerifyLibreOffice(expected_file, debug); | |
| 178 assert_zero(ret, "i:%d %s libreoffice %s ret %d != 0 - check that LibreOffice is not running!\n", | |
| 179 i, testUtilBarcodeName(data[i].symbology), expected_file, ret); | |
| 180 } | |
| 181 } else { | |
| 182 assert_nonzero(testUtilExists(symbol->outfile), "i:%d testUtilExists(%s) == 0\n", i, symbol->outfile); | |
| 183 assert_nonzero(testUtilExists(expected_file), "i:%d testUtilExists(%s) == 0\n", i, expected_file); | |
| 184 | |
| 185 ret = testUtilCmpBins(symbol->outfile, expected_file); | |
| 186 assert_zero(ret, "i:%d %s testUtilCmpBins(%s, %s) %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, expected_file, ret); | |
| 187 | |
| 188 ret = testUtilReadFile(symbol->outfile, filebuf, sizeof(filebuf), &filebuf_size); /* For BARCODE_MEMORY_FILE */ | |
| 189 assert_zero(ret, "i:%d %s testUtilReadFile(%s) %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret); | |
| 190 | |
| 191 if (!(debug & ZINT_DEBUG_TEST_KEEP_OUTFILE)) { | |
| 192 assert_zero(testUtilRemove(symbol->outfile), "i:%d testUtilRemove(%s) != 0\n", i, symbol->outfile); | |
| 193 } | |
| 194 | |
| 195 symbol->output_options |= BARCODE_MEMORY_FILE; | |
| 196 ret = ZBarcode_Print(symbol, data[i].rotate_angle); | |
| 197 assert_zero(ret, "i:%d %s ZBarcode_Print %s ret %d != 0 (%s)\n", | |
| 198 i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret, symbol->errtxt); | |
| 199 assert_nonnull(symbol->memfile, "i:%d %s memfile NULL\n", i, testUtilBarcodeName(data[i].symbology)); | |
| 200 assert_equal(symbol->memfile_size, filebuf_size, "i:%d %s memfile_size %d != %d\n", | |
| 201 i, testUtilBarcodeName(data[i].symbology), symbol->memfile_size, filebuf_size); | |
| 202 assert_zero(memcmp(symbol->memfile, filebuf, symbol->memfile_size), "i:%d %s memcmp(memfile, filebuf) != 0\n", | |
| 203 i, testUtilBarcodeName(data[i].symbology)); | |
| 204 } | |
| 205 | |
| 206 ZBarcode_Delete(symbol); | |
| 207 } | |
| 208 | |
| 209 testFinish(); | |
| 210 } | |
| 211 | |
| 212 INTERNAL int emf_plot(struct zint_symbol *symbol, int rotate_angle); | |
| 213 | |
| 214 static void test_outfile(const testCtx *const p_ctx) { | |
| 215 int ret; | |
| 216 int skip_readonly_test = 0; | |
| 217 struct zint_symbol symbol = {0}; | |
| 218 struct zint_vector vector = {0}; | |
| 219 | |
| 220 (void)p_ctx; | |
| 221 | |
| 222 testStart("test_outfile"); | |
| 223 | |
| 224 symbol.symbology = BARCODE_CODE128; | |
| 225 symbol.vector = &vector; | |
| 226 | |
| 227 strcpy(symbol.outfile, "test_emf_out.emf"); | |
| 228 #ifndef _WIN32 | |
| 229 skip_readonly_test = getuid() == 0; /* Skip if running as root on Unix as can't create read-only file */ | |
| 230 #endif | |
| 231 if (!skip_readonly_test) { | |
| 232 static char expected_errtxt[] = "640: Could not open EMF output file ("; /* Excluding OS-dependent `errno` stuff */ | |
| 233 | |
| 234 (void) testUtilRmROFile(symbol.outfile); /* In case lying around from previous fail */ | |
| 235 assert_nonzero(testUtilCreateROFile(symbol.outfile), "emf_plot testUtilCreateROFile(%s) fail (%d: %s)\n", symbol.outfile, errno, strerror(errno)); | |
| 236 | |
| 237 ret = emf_plot(&symbol, 0); | |
| 238 assert_equal(ret, ZINT_ERROR_FILE_ACCESS, "emf_plot ret %d != ZINT_ERROR_FILE_ACCESS (%d) (%s)\n", ret, ZINT_ERROR_FILE_ACCESS, symbol.errtxt); | |
| 239 assert_zero(testUtilRmROFile(symbol.outfile), "emf_plot testUtilRmROFile(%s) != 0 (%d: %s)\n", symbol.outfile, errno, strerror(errno)); | |
| 240 assert_zero(strncmp(symbol.errtxt, expected_errtxt, sizeof(expected_errtxt) - 1), "strncmp(%s, %s) != 0\n", symbol.errtxt, expected_errtxt); | |
| 241 } | |
| 242 | |
| 243 symbol.output_options |= BARCODE_STDOUT; | |
| 244 | |
| 245 printf("<<<Begin ignore (EMF to stdout)\n"); fflush(stdout); | |
| 246 ret = emf_plot(&symbol, 0); | |
| 247 printf("\n<<<End ignore (EMF to stdout)\n"); fflush(stdout); | |
| 248 assert_zero(ret, "emf_plot ret %d != 0 (%s)\n", ret, symbol.errtxt); | |
| 249 | |
| 250 symbol.vector = NULL; | |
| 251 ret = emf_plot(&symbol, 0); | |
| 252 assert_equal(ret, ZINT_ERROR_INVALID_DATA, "emf_plot ret %d != ZINT_ERROR_INVALID_DATA (%d) (%s)\n", ret, ZINT_ERROR_INVALID_DATA, symbol.errtxt); | |
| 253 | |
| 254 testFinish(); | |
| 255 } | |
| 256 | |
| 257 int main(int argc, char *argv[]) { | |
| 258 | |
| 259 testFunction funcs[] = { /* name, func */ | |
| 260 { "test_print", test_print }, | |
| 261 { "test_outfile", test_outfile }, | |
| 262 }; | |
| 263 | |
| 264 testRun(argc, argv, funcs, ARRAY_SIZE(funcs)); | |
| 265 | |
| 266 testReport(); | |
| 267 | |
| 268 return 0; | |
| 269 } | |
| 270 | |
| 271 /* vim: set ts=4 sw=4 et : */ |
