1
0
mirror of https://github.com/woo-j/zint.git synced 2024-12-23 13:33:55 +03:00

BC412: add to backend_tcl; add skeleton test

GUI: allow for Qt not parsing #if's in slots (copy_to_clipboard_png())
This commit is contained in:
gitlost 2022-07-03 23:54:42 +01:00
parent 7c4afa49c9
commit 471aed7a69
29 changed files with 323 additions and 80 deletions

View File

@ -1,5 +1,5 @@
# Copyright (C) 2008 by BogDan Vatra < bogdan@licentia.eu > # Copyright (C) 2008 by BogDan Vatra < bogdan@licentia.eu >
# Copyright (C) 2009-2021 Robin Stuart <rstuart114@gmail.com> # Copyright (C) 2009-2022 Robin Stuart <rstuart114@gmail.com>
# vim: set ts=4 sw=4 et : # vim: set ts=4 sw=4 et :
project(zint) project(zint)

View File

@ -1,8 +1,7 @@
/* bc412.c - Handles IBM BC412 (SEMI T1-95) symbology */ /* bc412.c - Handles IBM BC412 (SEMI T1-95) symbology */
/* /*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2021 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2022 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions modification, are permitted provided that the following conditions
@ -29,7 +28,7 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE. SUCH DAMAGE.
*/ */
/* vim: set ts=4 sw=4 et : */ /* SPDX-License-Identifier: BSD-3-Clause */
/* A little information about this symbology can be found at /* A little information about this symbology can be found at
* https://barcodeguide.seagullscientific.com/Content/Symbologies/BC412.htm * https://barcodeguide.seagullscientific.com/Content/Symbologies/BC412.htm
@ -136,3 +135,5 @@ INTERNAL int bc412(struct zint_symbol *symbol, unsigned char source[], int lengt
return error_number; return error_number;
} }
/* vim: set ts=4 sw=4 et : */

View File

@ -1871,6 +1871,7 @@ unsigned int ZBarcode_Cap(int symbol_id, unsigned int cap_flag) {
case BARCODE_HIBC_128: /* See CODE128 */ case BARCODE_HIBC_128: /* See CODE128 */
case BARCODE_HIBC_PDF: /* See PDF417 */ case BARCODE_HIBC_PDF: /* See PDF417 */
case BARCODE_HIBC_MICPDF: /* See PDF417 */ case BARCODE_HIBC_MICPDF: /* See PDF417 */
case BARCODE_BC412: /* TODO: Find doc */
break; break;
default: default:
result |= ZINT_CAP_COMPLIANT_HEIGHT; result |= ZINT_CAP_COMPLIANT_HEIGHT;

View File

@ -465,6 +465,9 @@ static int out_quiet_zones(const struct zint_symbol *symbol, const int hide_text
/* AIMD/TSC15032-43 (v 0.99c) Section 9.2 */ /* AIMD/TSC15032-43 (v 0.99c) Section 9.2 */
*left = *right = *top = *bottom = 1.0f; *left = *right = *top = *bottom = 1.0f;
done = 1; done = 1;
case BARCODE_BC412:
/* TODO: Find doc */
break; break;
} }

View File

@ -1,4 +1,4 @@
# Copyright (C) 2009-2021 Robin Stuart <rstuart114@gmail.com> # Copyright (C) 2009-2022 Robin Stuart <rstuart114@gmail.com>
# Adapted from qrencode/tests/CMakeLists.txt # Adapted from qrencode/tests/CMakeLists.txt
# Copyright (C) 2006-2017 Kentaro Fukuchi <kentaro@fukuchi.org> # Copyright (C) 2006-2017 Kentaro Fukuchi <kentaro@fukuchi.org>
# vim: set ts=4 sw=4 et : # vim: set ts=4 sw=4 et :
@ -40,6 +40,7 @@ endif()
zint_add_test(2of5 test_2of5) zint_add_test(2of5 test_2of5)
zint_add_test(auspost test_auspost) zint_add_test(auspost test_auspost)
zint_add_test(aztec test_aztec) zint_add_test(aztec test_aztec)
zint_add_test(bc412 test_bc412)
zint_add_test(big5 test_big5) zint_add_test(big5 test_big5)
zint_add_test(bmp test_bmp) zint_add_test(bmp test_bmp)
zint_add_test(channel test_channel) zint_add_test(channel test_channel)

188
backend/tests/test_bc412.c Normal file
View File

@ -0,0 +1,188 @@
/*
libzint - the open source barcode library
Copyright (C) 2022 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the project nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
/* SPDX-License-Identifier: BSD-3-Clause */
#include "testcommon.h"
static void test_input(int index, int generate, int debug) {
struct item {
int input_mode;
int option_1;
int option_2;
char *data;
int length;
int ret;
int expected_rows;
int expected_width;
char *expected;
char *comment;
};
struct item data[] = {
/* 0*/ { UNICODE_MODE, -1, -1, "123456", -1, ZINT_ERROR_TOO_LONG, 0, 0, "Error nan: Input wrong length (should be between 7 and 18 characters)", "" },
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
struct zint_symbol *symbol;
char escaped[1024];
testStart("test_input");
for (i = 0; i < data_size; i++) {
if (index != -1 && i != index) continue;
symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");
//symbol->debug = ZINT_DEBUG_TEST; // Needed to get codeword dump in errtxt
length = testUtilSetSymbol(symbol, BARCODE_BC412, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (generate) {
printf(" /*%3d*/ { %s, %d, %d, \"%s\", %d, %s, %d, %d, \"%s\", \"%s\" },\n",
i, testUtilInputModeName(data[i].input_mode), data[i].option_1, data[i].option_2,
testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), data[i].length,
testUtilErrorName(data[i].ret), symbol->rows, symbol->width, symbol->errtxt, data[i].comment);
} else {
if (ret < ZINT_ERROR) {
assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (%s)\n", i, symbol->rows, data[i].expected_rows, data[i].data);
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n", i, symbol->width, data[i].expected_width, data[i].data);
assert_zero(strcmp((char *) symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
}
}
ZBarcode_Delete(symbol);
}
testFinish();
}
static void test_encode(int index, int generate, int debug) {
struct item {
int input_mode;
int option_1;
int option_2;
char *data;
int ret;
int expected_rows;
int expected_width;
int bwipp_cmp;
char *comment;
char *expected;
};
struct item data[] = {
/* 0*/ { UNICODE_MODE, -1, -1, "AQ45670", 0, 1, 102, 0, "SEMI T1-95 SPECIFICATION FOR BACK SURFACE BAR CODE; BWIPP TODO",
"100101000100100100010101000100010101000101010000010101001010000101001001000101001000100101010100000101"
},
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
struct zint_symbol *symbol;
char escaped[1024];
char bwipp_buf[8192];
char bwipp_msg[1024];
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise
testStart("test_encode");
for (i = 0; i < data_size; i++) {
if (index != -1 && i != index) continue;
symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");
length = testUtilSetSymbol(symbol, BARCODE_BC412, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (generate) {
printf(" /*%3d*/ { %s, %d, %d, \"%s\", %s, %d, %d, %d, \"%s\",\n",
i, testUtilInputModeName(data[i].input_mode), data[i].option_1, data[i].option_2,
testUtilEscape(data[i].data, length, escaped, sizeof(escaped)),
testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].bwipp_cmp, data[i].comment);
testUtilModulesPrint(symbol, " ", "\n");
printf(" },\n");
} else {
if (ret < ZINT_ERROR) {
int width, row;
assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (%s)\n", i, symbol->rows, data[i].expected_rows, data[i].data);
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n", i, symbol->width, data[i].expected_width, data[i].data);
ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row);
assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, ret, width, row, data[i].data);
if (do_bwipp && testUtilCanBwipp(i, symbol, data[i].option_1, -1, -1, debug)) {
if (!data[i].bwipp_cmp) {
if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d %s not BWIPP compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment);
} else {
ret = testUtilBwipp(i, symbol, data[i].option_1, -1, -1, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf), NULL);
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected);
assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
i, testUtilBarcodeName(symbol->symbology), ret, bwipp_msg, bwipp_buf, data[i].expected);
}
}
}
}
ZBarcode_Delete(symbol);
}
testFinish();
}
int main(int argc, char *argv[]) {
testFunction funcs[] = { /* name, func, has_index, has_generate, has_debug */
{ "test_input", test_input, 1, 1, 1 },
{ "test_encode", test_encode, 1, 1, 1 },
};
testRun(argc, argv, funcs, ARRAY_SIZE(funcs));
testReport();
return 0;
}
/* vim: set ts=4 sw=4 et : */

View File

@ -767,6 +767,8 @@ static void test_utf8_to_eci_ascii(void) {
assert_zero(memcmp(data[i].data, dest, length), "i:%d memcmp != 0\n", i); assert_zero(memcmp(data[i].data, dest, length), "i:%d memcmp != 0\n", i);
} }
} }
testFinish();
} }
static void test_utf8_to_eci_utf16be(void) { static void test_utf8_to_eci_utf16be(void) {
@ -828,6 +830,8 @@ static void test_utf8_to_eci_utf16be(void) {
} }
} }
} }
testFinish();
} }
static void test_utf8_to_eci_utf16le(void) { static void test_utf8_to_eci_utf16le(void) {
@ -889,6 +893,8 @@ static void test_utf8_to_eci_utf16le(void) {
} }
} }
} }
testFinish();
} }
static void test_utf8_to_eci_utf32be(void) { static void test_utf8_to_eci_utf32be(void) {
@ -949,6 +955,8 @@ static void test_utf8_to_eci_utf32be(void) {
} }
} }
} }
testFinish();
} }
static void test_utf8_to_eci_utf32le(void) { static void test_utf8_to_eci_utf32le(void) {
@ -1009,6 +1017,8 @@ static void test_utf8_to_eci_utf32le(void) {
} }
} }
} }
testFinish();
} }
static void test_utf8_to_eci_sjis(void) { static void test_utf8_to_eci_sjis(void) {
@ -1061,6 +1071,8 @@ static void test_utf8_to_eci_sjis(void) {
assert_nonzero(out_length <= eci_length, "i:%d out_length %d > eci_length %d\n", i, out_length, eci_length); assert_nonzero(out_length <= eci_length, "i:%d out_length %d > eci_length %d\n", i, out_length, eci_length);
} }
} }
testFinish();
} }
static void test_utf8_to_eci_big5(void) { static void test_utf8_to_eci_big5(void) {
@ -1103,6 +1115,8 @@ static void test_utf8_to_eci_big5(void) {
assert_nonzero(out_length <= eci_length, "i:%d out_length %d > eci_length %d\n", i, out_length, eci_length); assert_nonzero(out_length <= eci_length, "i:%d out_length %d > eci_length %d\n", i, out_length, eci_length);
} }
} }
testFinish();
} }
static void test_utf8_to_eci_gb2312(void) { static void test_utf8_to_eci_gb2312(void) {
@ -1145,6 +1159,8 @@ static void test_utf8_to_eci_gb2312(void) {
assert_nonzero(out_length <= eci_length, "i:%d out_length %d > eci_length %d\n", i, out_length, eci_length); assert_nonzero(out_length <= eci_length, "i:%d out_length %d > eci_length %d\n", i, out_length, eci_length);
} }
} }
testFinish();
} }
static void test_utf8_to_eci_euc_kr(void) { static void test_utf8_to_eci_euc_kr(void) {
@ -1187,6 +1203,8 @@ static void test_utf8_to_eci_euc_kr(void) {
assert_nonzero(out_length <= eci_length, "i:%d out_length %d > eci_length %d\n", i, out_length, eci_length); assert_nonzero(out_length <= eci_length, "i:%d out_length %d > eci_length %d\n", i, out_length, eci_length);
} }
} }
testFinish();
} }
static void test_utf8_to_eci_gbk(void) { static void test_utf8_to_eci_gbk(void) {
@ -1229,6 +1247,8 @@ static void test_utf8_to_eci_gbk(void) {
assert_nonzero(out_length <= eci_length, "i:%d out_length %d > eci_length %d\n", i, out_length, eci_length); assert_nonzero(out_length <= eci_length, "i:%d out_length %d > eci_length %d\n", i, out_length, eci_length);
} }
} }
testFinish();
} }
static void test_utf8_to_eci_gb18030(void) { static void test_utf8_to_eci_gb18030(void) {
@ -1271,6 +1291,8 @@ static void test_utf8_to_eci_gb18030(void) {
assert_nonzero(out_length <= eci_length, "i:%d out_length %d > eci_length %d\n", i, out_length, eci_length); assert_nonzero(out_length <= eci_length, "i:%d out_length %d > eci_length %d\n", i, out_length, eci_length);
} }
} }
testFinish();
} }
static void test_is_eci_convertible_segs(int index) { static void test_is_eci_convertible_segs(int index) {

View File

@ -42,7 +42,8 @@
INTERNAL int u_gb18030_int_test(const unsigned int u, unsigned int *dest1, unsigned int *dest2); INTERNAL int u_gb18030_int_test(const unsigned int u, unsigned int *dest1, unsigned int *dest2);
// As control convert to GB 18030 using table generated from GB18030.TXT plus simple processing. // As control convert to GB 18030 using table generated from GB18030.TXT plus simple processing.
// The version of GB18030.TXT is libiconv-1.11/GB18030.TXT taken from https://haible.de/bruno/charsets/conversion-tables/GB18030.html // The version of GB18030.TXT is jdk-1.4.2/GB18030.TXT taken from
// https://haible.de/bruno/charsets/conversion-tables/GB18030.html
// The generated file backend/tests/test_gb18030_tab.h does not include U+10000..10FFFF codepoints to save space. // The generated file backend/tests/test_gb18030_tab.h does not include U+10000..10FFFF codepoints to save space.
// See also backend/tests/tools/data/GB18030.TXT.README and backend/tests/tools/gen_test_tab.php. // See also backend/tests/tools/data/GB18030.TXT.README and backend/tests/tools/gen_test_tab.php.
static int u_gb18030_int2(unsigned int u, unsigned int *dest1, unsigned int *dest2) { static int u_gb18030_int2(unsigned int u, unsigned int *dest1, unsigned int *dest2) {
@ -50,18 +51,18 @@ static int u_gb18030_int2(unsigned int u, unsigned int *dest1, unsigned int *des
int tab_length, start_i, end_i; int tab_length, start_i, end_i;
int i; int i;
// GB18030 two-byte extension (libiconv-1.16/lib/gb18030ext.h) // GB18030 two-byte extension
if (u == 0x1E3F) { // GB 18030-2005 change, was PUA U+E7C7 below, see Table 3-39, p.111, Lunde 2nd ed. if (u == 0x1E3F) { // GB 18030-2005 change, was PUA U+E7C7 below, see Table 3-39, p.111, Lunde 2nd ed.
*dest1 = 0xA8BC; *dest1 = 0xA8BC;
return 2; return 2;
} }
// GB18030 four-byte extension (libiconv-1.16/lib/gb18030uni.h) // GB18030 four-byte extension
if (u == 0xE7C7) { // PUA if (u == 0xE7C7) { // PUA
*dest1 = 0x8135; *dest1 = 0x8135;
*dest2 = 0xF437; *dest2 = 0xF437;
return 4; return 4;
} }
// GB18030 two-byte extension (libiconv-1.16/lib/gb18030ext.h) // GB18030 two-byte extension
if (u >= 0x9FB4 && u <= 0x9FBB) { // GB 18030-2005 change, were PUA, see Table 3-37, p.108, Lunde 2nd ed. if (u >= 0x9FB4 && u <= 0x9FBB) { // GB 18030-2005 change, were PUA, see Table 3-37, p.108, Lunde 2nd ed.
if (u == 0x9FB4) { if (u == 0x9FB4) {
*dest1 = 0xFE59; *dest1 = 0xFE59;
@ -80,7 +81,7 @@ static int u_gb18030_int2(unsigned int u, unsigned int *dest1, unsigned int *des
} }
return 2; return 2;
} }
// GB18030 two-byte extension (libiconv-1.16/lib/gb18030ext.h) // GB18030 two-byte extension
if (u >= 0xFE10 && u <= 0xFE19) { // GB 18030-2005 change, were PUA, see Table 3-37, p.108, Lunde 2nd ed. if (u >= 0xFE10 && u <= 0xFE19) { // GB 18030-2005 change, were PUA, see Table 3-37, p.108, Lunde 2nd ed.
if (u == 0xFE10) { if (u == 0xFE10) {
*dest1 = 0xA6D9; *dest1 = 0xA6D9;
@ -97,7 +98,7 @@ static int u_gb18030_int2(unsigned int u, unsigned int *dest1, unsigned int *des
} }
return 2; return 2;
} }
// GB18030 four-byte extension (libiconv-1.16/lib/gb18030uni.h) // GB18030 four-byte extension
if (u >= 0xFE1A && u <= 0xFE2F) { // These are Vertical Forms (U+FE1A..FE1F unassigned) and Combining Half Marks (U+FE20..FE2F) if (u >= 0xFE1A && u <= 0xFE2F) { // These are Vertical Forms (U+FE1A..FE1F unassigned) and Combining Half Marks (U+FE20..FE2F)
if (u >= 0xFE1A && u <= 0xFE1D) { if (u >= 0xFE1A && u <= 0xFE1D) {
c = 0x84318336 + (u - 0xFE1A); c = 0x84318336 + (u - 0xFE1A);
@ -110,7 +111,7 @@ static int u_gb18030_int2(unsigned int u, unsigned int *dest1, unsigned int *des
*dest2 = c & 0xFFFF; *dest2 = c & 0xFFFF;
return 4; return 4;
} }
// GB18030 (libiconv-1.16/lib/gb18030.h) // GB18030
// Code set 3 (Unicode U+10000..U+10FFFF) // Code set 3 (Unicode U+10000..U+10FFFF)
if (u >= 0x10000 /*&& u < 0x10400*/) { // Not being called for U+10400..U+10FFFF if (u >= 0x10000 /*&& u < 0x10400*/) { // Not being called for U+10400..U+10FFFF
c = u - 0x10000; c = u - 0x10000;

View File

@ -192,25 +192,27 @@ static void test_checks(int index, int debug) {
/*131*/ { 126, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 }, /*131*/ { 126, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 },
/*132*/ { 127, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 }, /*132*/ { 127, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 },
/*133*/ { 127, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 }, /*133*/ { 127, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 },
/*134*/ { 146, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 216: Symbology out of range", BARCODE_CODE128 }, /*134*/ { 147, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 216: Symbology out of range", BARCODE_CODE128 },
/*135*/ { 146, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 216: Symbology out of range", -1 }, /*135*/ { 147, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 216: Symbology out of range", -1 },
/*136*/ { BARCODE_CODE128, -1, "\200", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 245: Invalid UTF-8 in input data", -1 }, /*136*/ { BARCODE_LAST + 1, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 216: Symbology out of range", BARCODE_CODE128 },
/*137*/ { BARCODE_GS1_128, -1, "[01]12345678901234", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 }, /*137*/ { BARCODE_LAST + 1, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 216: Symbology out of range", -1 },
/*138*/ { BARCODE_GS1_128, -1, "[01]12345678901234", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_NONCOMPLIANT, "Error 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 }, /*138*/ { BARCODE_CODE128, -1, "\200", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 245: Invalid UTF-8 in input data", -1 },
/*139*/ { BARCODE_QRCODE, -1, "", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", -1 }, /*139*/ { BARCODE_GS1_128, -1, "[01]12345678901234", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 },
/*140*/ { BARCODE_QRCODE, -1, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 }, /*140*/ { BARCODE_GS1_128, -1, "[01]12345678901234", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_NONCOMPLIANT, "Error 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 },
/*141*/ { BARCODE_QRCODE, -1, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_USES_ECI, "Error 222: Encoded data includes ECI 13", -1 }, /*141*/ { BARCODE_QRCODE, -1, "", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", -1 },
/*142*/ { BARCODE_CODEONE, -1, "[01]12345678901231", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 512: ECI ignored for GS1 mode", -1 }, /*142*/ { BARCODE_QRCODE, -1, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 },
/*143*/ { BARCODE_CODEONE, -1, "[01]12345678901231", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 512: ECI ignored for GS1 mode", -1 }, /*143*/ { BARCODE_QRCODE, -1, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_USES_ECI, "Error 222: Encoded data includes ECI 13", -1 },
/*144*/ { BARCODE_CODEONE, -1, "[01]12345678901234", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 512: ECI ignored for GS1 mode", -1 }, // Warning in encoder overrides library warnings /*144*/ { BARCODE_CODEONE, -1, "[01]12345678901231", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 512: ECI ignored for GS1 mode", -1 },
/*145*/ { BARCODE_CODEONE, -1, "[01]12345678901234", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_NONCOMPLIANT, "Error 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 }, // But not errors /*145*/ { BARCODE_CODEONE, -1, "[01]12345678901231", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 512: ECI ignored for GS1 mode", -1 },
/*146*/ { BARCODE_AZTEC, -1, "", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", -1 }, /*146*/ { BARCODE_CODEONE, -1, "[01]12345678901234", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 512: ECI ignored for GS1 mode", -1 }, // Warning in encoder overrides library warnings
/*147*/ { BARCODE_AZTEC, -1, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 }, /*147*/ { BARCODE_CODEONE, -1, "[01]12345678901234", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_NONCOMPLIANT, "Error 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 }, // But not errors
/*148*/ { BARCODE_AZTEC, -1, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_USES_ECI, "Error 222: Encoded data includes ECI 13", -1 }, /*148*/ { BARCODE_AZTEC, -1, "", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", -1 },
/*149*/ { BARCODE_AZTEC, 6, "", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 503: Invalid error correction level - using default instead", -1 }, /*149*/ { BARCODE_AZTEC, -1, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 },
/*150*/ { BARCODE_AZTEC, 6, "", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 503: Invalid error correction level - using default instead", -1 }, /*150*/ { BARCODE_AZTEC, -1, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_USES_ECI, "Error 222: Encoded data includes ECI 13", -1 },
/*151*/ { BARCODE_AZTEC, 6, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 }, // ECI warning trumps all other warnings /*151*/ { BARCODE_AZTEC, 6, "", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 503: Invalid error correction level - using default instead", -1 },
/*152*/ { BARCODE_AZTEC, 6, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 503: Invalid error correction level - using default instead", -1 }, // But not errors /*152*/ { BARCODE_AZTEC, 6, "", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 503: Invalid error correction level - using default instead", -1 },
/*153*/ { BARCODE_AZTEC, 6, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 }, // ECI warning trumps all other warnings
/*154*/ { BARCODE_AZTEC, 6, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 503: Invalid error correction level - using default instead", -1 }, // But not errors
}; };
int data_size = ARRAY_SIZE(data); int data_size = ARRAY_SIZE(data);
int i, length, ret; int i, length, ret;
@ -582,8 +584,8 @@ static void test_escape_char_process(int index, int generate, int debug) {
if (generate) { if (generate) {
printf(" /*%3d*/ { %s, %s, %d, \"%s\", \"%s\", %s, %d, \"%s\", %d, \"%s\" },\n", printf(" /*%3d*/ { %s, %s, %d, \"%s\", \"%s\", %s, %d, \"%s\", %d, \"%s\" },\n",
i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), data[i].eci, i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), data[i].eci,
testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), testUtilEscape(data[i].data, length, escaped, ARRAY_SIZE(escaped)),
testUtilEscape(data[i].composite, strlen(data[i].composite), escaped_composite, sizeof(escaped_composite)), testUtilEscape(data[i].composite, strlen(data[i].composite), escaped_composite, ARRAY_SIZE(escaped_composite)),
testUtilErrorName(data[i].ret), symbol->width, symbol->errtxt, data[i].compare_previous, data[i].comment); testUtilErrorName(data[i].ret), symbol->width, symbol->errtxt, data[i].compare_previous, data[i].comment);
} else { } else {
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected); assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);

View File

@ -47,7 +47,7 @@ static void test_quiet_zones(void) {
symbol.symbology = i; symbol.symbology = i;
symbol.output_options = BARCODE_QUIET_ZONES; symbol.output_options = BARCODE_QUIET_ZONES;
ret = out_quiet_zones_test(&symbol, hide_text, &left, &right, &top, &bottom); ret = out_quiet_zones_test(&symbol, hide_text, &left, &right, &top, &bottom);
if (i != BARCODE_FLAT) { // Only one which isn't marked as done if (i != BARCODE_FLAT && i != BARCODE_BC412) { // Only two which aren't marked as done
assert_nonzero(ret, "i:%d %s not done\n", i, testUtilBarcodeName(i)); assert_nonzero(ret, "i:%d %s not done\n", i, testUtilBarcodeName(i));
} }
} }

View File

@ -290,22 +290,22 @@ static void test_qr_input(int index, int generate, int debug) {
/*126*/ { UNICODE_MODE, 16384, 4, 8 << 8, "é", 0, 16384, "7C 04 00 04 02 C3 A9 00 EC", 1, 1, "ECI-16384 B2 (no conversion)" }, /*126*/ { UNICODE_MODE, 16384, 4, 8 << 8, "é", 0, 16384, "7C 04 00 04 02 C3 A9 00 EC", 1, 1, "ECI-16384 B2 (no conversion)" },
/*127*/ { UNICODE_MODE, 3, 4, -1, "product:Google Pixel 4a - 128 GB of Storage - Black;price:$439.97", 0, 3, "(86) 70 34 39 70 72 6F 64 75 63 74 3A 47 6F 6F 67 6C 65 20 50 69 78 65 6C 20 34 61 20 2D", 0, 1, "ECI-3 B57 A8; BWIPP different encodation (B65)" }, /*127*/ { UNICODE_MODE, 3, 4, -1, "product:Google Pixel 4a - 128 GB of Storage - Black;price:$439.97", 0, 3, "(86) 70 34 39 70 72 6F 64 75 63 74 3A 47 6F 6F 67 6C 65 20 50 69 78 65 6C 20 34 61 20 2D", 0, 1, "ECI-3 B57 A8; BWIPP different encodation (B65)" },
/*128*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\201\176", 0, 0, "80 10 1F 00 EC 11 EC 11 EC", 1, 1, "K1 (Shift JIS 0x817E)" }, /*128*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\201\176", 0, 0, "80 10 1F 00 EC 11 EC 11 EC", 1, 1, "K1 (Shift JIS 0x817E)" },
/*129*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\201\177", 0, 0, "40 28 17 F0 EC 11 EC 11 EC", 1, 1, "B2 (0x817F previously used Kanji mode, now excludes trailing 0x7F)" }, /*129*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\201\177", 0, 0, "40 28 17 F0 EC 11 EC 11 EC", 0, 1, "B2 (0x817F previously used Kanji mode, now excludes trailing 0x7F); BWIPP TODO: exclude also" },
/*130*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\201\200", 0, 0, "80 10 20 00 EC 11 EC 11 EC", 1, 1, "K1 (Shift JIS 0x8180)" }, /*130*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\201\200", 0, 0, "80 10 20 00 EC 11 EC 11 EC", 1, 1, "K1 (Shift JIS 0x8180)" },
/*131*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\237\176", 0, 0, "80 1B 5F 00 EC 11 EC 11 EC", 1, 1, "K1 (Shift JIS 0x9F7E)" }, /*131*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\237\176", 0, 0, "80 1B 5F 00 EC 11 EC 11 EC", 1, 1, "K1 (Shift JIS 0x9F7E)" },
/*132*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\237\177", 0, 0, "40 29 F7 F0 EC 11 EC 11 EC", 1, 1, "B2 (0x9F7F previously used Kanji mode, now excludes trailing 0x7F)" }, /*132*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\237\177", 0, 0, "40 29 F7 F0 EC 11 EC 11 EC", 0, 1, "B2 (0x9F7F previously used Kanji mode, now excludes trailing 0x7F); BWIPP TODO: exclude also" },
/*133*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\340\176", 0, 0, "80 1B BF 00 EC 11 EC 11 EC", 1, 1, "K1 (Shift JIS 0xE07E)" }, /*133*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE | (5 << 8), "\340\176", 0, 0, "80 1B BF 00 EC 11 EC 11 EC", 1, 1, "K1 (Shift JIS 0xE07E)" },
/*134*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\340\177", 0, 0, "40 2E 07 F0 EC 11 EC 11 EC", 1, 1, "B2 (0xE07F previously used Kanji mode, now excludes trailing 0x7F)" }, /*134*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\340\177", 0, 0, "40 2E 07 F0 EC 11 EC 11 EC", 0, 1, "B2 (0xE07F previously used Kanji mode, now excludes trailing 0x7F); BWIPP TODO: exclude also" },
/*135*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\352\244", 0, 0, "80 1F 92 00 EC 11 EC 11 EC", 1, 1, "K1 (Shift JIS 0xEAA4, last valid codepoint)" }, /*135*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE | (4 << 8), "\352\244", 0, 0, "80 1F 92 00 EC 11 EC 11 EC", 1, 1, "K1 (Shift JIS 0xEAA4, last valid codepoint)" },
/*136*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\353\277", 0, 0, "80 1F FF 80 EC 11 EC 11 EC", 1, 1, "K1 (0xEBBF undefined in Shift JIS but not checked and uses Kanji mode)" }, /*136*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\353\277", 0, 0, "80 1F FF 80 EC 11 EC 11 EC", 0, 1, "K1 (0xEBBF undefined in Shift JIS but not checked and uses Kanji mode); BWIPP TODO: exclude also" },
/*137*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\353\300", 0, 0, "40 2E BC 00 EC 11 EC 11 EC", 1, 1, "B2 (0xEBC0 was always excluded)" }, /*137*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\353\300", 0, 0, "40 2E BC 00 EC 11 EC 11 EC", 1, 1, "B2 (0xEBC0 was always excluded)" },
/*138*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\201\300", 0, 0, "80 10 40 00 EC 11 EC 11 EC", 1, 1, "K1 (Shift JIS 0x81C0)" }, /*138*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\201\300", 0, 0, "80 10 40 00 EC 11 EC 11 EC", 1, 1, "K1 (Shift JIS 0x81C0)" },
/*139*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\201\374", 0, 0, "80 10 5E 00 EC 11 EC 11 EC", 1, 1, "K1 (Shift JIS 0x81FC)" }, /*139*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE | (2 << 8), "\201\374", 0, 0, "80 10 5E 00 EC 11 EC 11 EC", 1, 1, "K1 (Shift JIS 0x81FC)" },
/*140*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\201\375", 0, 0, "40 28 1F D0 EC 11 EC 11 EC", 1, 1, "B2 (0x81FD previously used Kanji mode, now excludes trailing 0xFD)" }, /*140*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\201\375", 0, 0, "40 28 1F D0 EC 11 EC 11 EC", 0, 1, "B2 (0x81FD previously used Kanji mode, now excludes trailing 0xFD); BWIPP TODO: exclude also" },
/*141*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\201\376", 0, 0, "40 28 1F E0 EC 11 EC 11 EC", 1, 1, "B2 (0x81FE previously used Kanji mode, now excludes trailing 0xFE)" }, /*141*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\201\376", 0, 0, "40 28 1F E0 EC 11 EC 11 EC", 0, 1, "B2 (0x81FE previously used Kanji mode, now excludes trailing 0xFE); BWIPP TODO: exclude also" },
/*142*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\201\377", 0, 0, "40 28 1F F0 EC 11 EC 11 EC", 1, 1, "B2 (0x81FF previously used Kanji mode, now excludes trailing 0xFF)" }, /*142*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\201\377", 0, 0, "40 28 1F F0 EC 11 EC 11 EC", 0, 1, "B2 (0x81FF previously used Kanji mode, now excludes trailing 0xFF); BWIPP TODO: exclude also" },
/*143*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\201\377", 0, 0, "40 28 1F F0 EC 11 EC 11 EC", 1, 1, "B2 (0x81FF previously used Kanji mode, now excludes trailing 0xFF)" }, /*143*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\201\377", 0, 0, "40 28 1F F0 EC 11 EC 11 EC", 0, 1, "B2 (0x81FF previously used Kanji mode, now excludes trailing 0xFF); BWIPP TODO: exclude also" },
/*144*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\201\255", 0, 0, "80 10 36 80 EC 11 EC 11 EC", 1, 1, "K1 (0x81AD undefined in Shift JIS but not checked and uses Kanji mode)" }, /*144*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE | (7 << 8), "\201\255", 0, 0, "80 10 36 80 EC 11 EC 11 EC", 1, 1, "K1 (0x81AD undefined in Shift JIS but not checked and uses Kanji mode)" },
}; };
int data_size = ARRAY_SIZE(data); int data_size = ARRAY_SIZE(data);
int i, length, ret; int i, length, ret;

View File

@ -27,11 +27,12 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE. SUCH DAMAGE.
*/ */
/* SPDX-License-Identifier: BSD-3-Clause */
/* /*
* Adapted from qrencode/tests/common.c * Adapted from qrencode/tests/common.c
* Copyright (C) 2006-2017 Kentaro Fukuchi <kentaro@fukuchi.org> * Copyright (C) 2006-2017 Kentaro Fukuchi <kentaro@fukuchi.org>
*/ */
/* Due to above: */
/* SPDX-License-Identifier: LGPL-2.1+ */
#include "testcommon.h" #include "testcommon.h"
@ -2012,6 +2013,7 @@ static const char *testUtilBwippName(int index, const struct zint_symbol *symbol
{ "qrcode", BARCODE_UPNQR, 143, 0, 0, 1, 0, 0, }, { "qrcode", BARCODE_UPNQR, 143, 0, 0, 1, 0, 0, },
{ "ultracode", BARCODE_ULTRA, 144, 1, 1, 0, 0, 0, }, { "ultracode", BARCODE_ULTRA, 144, 1, 1, 0, 0, 0, },
{ "rectangularmicroqrcode", BARCODE_RMQR, 145, 1, 1, 1, 0, 0, }, { "rectangularmicroqrcode", BARCODE_RMQR, 145, 1, 1, 1, 0, 0, },
{ "bc412", BARCODE_BC412, 146, 1, 1, 0, 0, 0, },
}; };
static const int data_size = ARRAY_SIZE(data); static const int data_size = ARRAY_SIZE(data);
@ -2762,6 +2764,8 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
itoc(symbol->structapp.count)); itoc(symbol->structapp.count));
bwipp_opts = bwipp_opts_buf; bwipp_opts = bwipp_opts_buf;
} }
} else if (symbology == BARCODE_BC412) {
// TODO:
} }
} }

View File

@ -31,6 +31,8 @@
* Adapted from qrencode/tests/common.h * Adapted from qrencode/tests/common.h
* Copyright (C) 2006-2017 Kentaro Fukuchi <kentaro@fukuchi.org> * Copyright (C) 2006-2017 Kentaro Fukuchi <kentaro@fukuchi.org>
*/ */
/* Due to above: */
/* SPDX-License-Identifier: LGPL-2.1+ */
#ifndef Z_TESTCOMMON_H #ifndef Z_TESTCOMMON_H
#define Z_TESTCOMMON_H #define Z_TESTCOMMON_H

View File

@ -1,6 +1,6 @@
--- /home/mburke/code/bwipp/postscriptbarcode/build/monolithic/barcode.ps 2022-05-09 17:52:29.878548024 +0100 --- /home/mburke/code/bwipp/postscriptbarcode/build/monolithic/barcode.ps 2022-07-03 21:45:03.217966554 +0100
+++ backend/tests/tools/bwipp_dump.ps 2022-05-09 18:09:55.849954110 +0100 +++ backend/tests/tools/bwipp_dump.ps 2022-07-03 21:50:45.106786827 +0100
@@ -15187,8 +15187,8 @@ @@ -15224,8 +15224,8 @@
} bind } bind
/fime { /fime {
/sbs [2.25 6.75 2.25 15.75 2.25 6.75 2.25] def /sbs [2.25 6.75 2.25 15.75 2.25 6.75 2.25] def
@ -11,7 +11,7 @@
} bind } bind
>> def >> def
@@ -26479,34 +26479,80 @@ @@ -26518,34 +26518,80 @@
pop pop
} ifelse } ifelse
@ -111,7 +111,7 @@
end end
@@ -26565,7 +26611,7 @@ @@ -26604,7 +26650,7 @@
pop pop
} ifelse } ifelse
@ -120,7 +120,7 @@
% Get the result of encoding with ean8 and gs1-cc % Get the result of encoding with ean8 and gs1-cc
options (lintype) (ean8) put options (lintype) (ean8) put
@@ -26573,29 +26619,75 @@ @@ -26612,29 +26658,75 @@
options (dontdraw) true put options (dontdraw) true put
% Plot the linear part % Plot the linear part
@ -216,7 +216,7 @@
end end
@@ -26654,34 +26746,80 @@ @@ -26693,34 +26785,80 @@
pop pop
} ifelse } ifelse
@ -316,7 +316,7 @@
end end
@@ -26755,34 +26893,80 @@ @@ -26794,34 +26932,80 @@
/opt options /opt options
>> def >> def
@ -416,7 +416,7 @@
end end
@@ -26841,7 +27025,7 @@ @@ -26880,7 +27064,7 @@
pop pop
} ifelse } ifelse
@ -425,7 +425,7 @@
options (lintype) (databaromni) put options (lintype) (databaromni) put
options (linkage) true put options (linkage) true put
@@ -26852,7 +27036,7 @@ @@ -26891,7 +27075,7 @@
linear options //databaromni exec linear options //databaromni exec
dup (sbs) get /linsbs exch def dup (sbs) get /linsbs exch def
dup (bhs) get 0 get 72 mul /linheight exch def dup (bhs) get 0 get 72 mul /linheight exch def
@ -434,7 +434,7 @@
% Plot the separator % Plot the separator
/sepfinder { /sepfinder {
@@ -26883,20 +27067,66 @@ @@ -26922,20 +27106,66 @@
sep 0 [0 0 0] putinterval sep 0 [0 0 0] putinterval
sep sep length 4 sub [0 0 0 0] putinterval sep sep length 4 sub [0 0 0 0] putinterval
18 sepfinder 64 sepfinder 18 sepfinder 64 sepfinder
@ -513,7 +513,7 @@
end end
@@ -26954,7 +27184,7 @@ @@ -26993,7 +27223,7 @@
pop pop
} ifelse } ifelse
@ -522,7 +522,7 @@
options (lintype) (databarstacked) put options (lintype) (databarstacked) put
options (linkage) true put options (linkage) true put
@@ -26965,7 +27195,7 @@ @@ -27004,7 +27234,7 @@
linear options //databarstacked exec linear options //databarstacked exec
dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def
dup (pixy) get /linheight exch def dup (pixy) get /linheight exch def
@ -531,7 +531,7 @@
% Plot the separator % Plot the separator
/sepfinder { /sepfinder {
@@ -26993,20 +27223,52 @@ @@ -27032,20 +27262,52 @@
sep 0 [ 0 0 0 0 ] putinterval sep 0 [ 0 0 0 0 ] putinterval
sep sep length 4 sub [ 0 0 0 0 ] putinterval sep sep length 4 sub [ 0 0 0 0 ] putinterval
18 sepfinder 18 sepfinder
@ -596,7 +596,7 @@
end end
@@ -27064,7 +27326,7 @@ @@ -27103,7 +27365,7 @@
pop pop
} ifelse } ifelse
@ -605,7 +605,7 @@
options (lintype) (databarstackedomni) put options (lintype) (databarstackedomni) put
options (linkage) true put options (linkage) true put
@@ -27075,7 +27337,7 @@ @@ -27114,7 +27376,7 @@
linear options //databarstackedomni exec linear options //databarstackedomni exec
dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def
dup (pixy) get /linheight exch def dup (pixy) get /linheight exch def
@ -614,7 +614,7 @@
% Plot the separator % Plot the separator
/sepfinder { /sepfinder {
@@ -27103,20 +27365,52 @@ @@ -27142,20 +27404,52 @@
sep 0 [ 0 0 0 0 ] putinterval sep 0 [ 0 0 0 0 ] putinterval
sep sep length 4 sub [ 0 0 0 0 ] putinterval sep sep length 4 sub [ 0 0 0 0 ] putinterval
18 sepfinder 18 sepfinder
@ -679,7 +679,7 @@
end end
@@ -27289,7 +27583,7 @@ @@ -27328,7 +27622,7 @@
pop pop
} ifelse } ifelse
@ -688,7 +688,7 @@
options (lintype) (databarlimited) put options (lintype) (databarlimited) put
options (linkage) true put options (linkage) true put
@@ -27300,7 +27594,7 @@ @@ -27339,7 +27633,7 @@
linear options //databarlimited exec linear options //databarlimited exec
dup (sbs) get /linsbs exch def dup (sbs) get /linsbs exch def
dup (bhs) get 0 get 72 mul /linheight exch def dup (bhs) get 0 get 72 mul /linheight exch def
@ -697,7 +697,7 @@
% Plot the separator % Plot the separator
mark mark
@@ -27308,22 +27602,68 @@ @@ -27347,22 +27641,68 @@
counttomark 1 sub array astore /sep exch def pop pop counttomark 1 sub array astore /sep exch def pop pop
sep 0 [0 0 0] putinterval sep 0 [0 0 0] putinterval
sep sep length 9 sub [0 0 0 0 0 0 0 0 0] putinterval % 4 + 5 right guard spaces sep sep length 9 sub [0 0 0 0 0 0 0 0 0] putinterval % 4 + 5 right guard spaces
@ -780,7 +780,7 @@
end end
@@ -27382,7 +27722,7 @@ @@ -27421,7 +27761,7 @@
pop pop
} ifelse } ifelse
@ -789,7 +789,7 @@
options (lintype) (databarexpanded) put options (lintype) (databarexpanded) put
options (linkage) true put options (linkage) true put
@@ -27393,7 +27733,7 @@ @@ -27432,7 +27772,7 @@
linear options //databarexpanded exec linear options //databarexpanded exec
dup (sbs) get /linsbs exch def dup (sbs) get /linsbs exch def
dup (bhs) get 0 get 72 mul /linheight exch def dup (bhs) get 0 get 72 mul /linheight exch def
@ -798,7 +798,7 @@
% Plot the separator % Plot the separator
/sepfinder { /sepfinder {
@@ -27422,20 +27762,60 @@ @@ -27461,20 +27801,60 @@
18 98 bot length 13 sub {} for 18 98 bot length 13 sub {} for
69 98 bot length 13 sub {} for 69 98 bot length 13 sub {} for
] {sepfinder} forall ] {sepfinder} forall
@ -871,7 +871,7 @@
end end
@@ -27493,7 +27873,7 @@ @@ -27532,7 +27912,7 @@
pop pop
} ifelse } ifelse
@ -880,7 +880,7 @@
options (lintype) (databarexpandedstacked) put options (lintype) (databarexpandedstacked) put
options (linkage) true put options (linkage) true put
@@ -27504,7 +27884,7 @@ @@ -27543,7 +27923,7 @@
linear options //databarexpandedstacked exec linear options //databarexpandedstacked exec
dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def
dup (pixy) get /linheight exch def dup (pixy) get /linheight exch def
@ -889,7 +889,7 @@
% Plot the separator % Plot the separator
/sepfinder { /sepfinder {
@@ -27530,21 +27910,49 @@ @@ -27569,21 +27949,49 @@
19 98 bot length 13 sub {} for 19 98 bot length 13 sub {} for
70 98 bot length 13 sub {} for 70 98 bot length 13 sub {} for
] {sepfinder} forall ] {sepfinder} forall
@ -952,7 +952,7 @@
end end
@@ -27603,7 +28011,7 @@ @@ -27642,7 +28050,7 @@
pop pop
} ifelse } ifelse
@ -961,7 +961,7 @@
options (inkspread) (0) put options (inkspread) (0) put
options (dontdraw) true put options (dontdraw) true put
@@ -27630,35 +28038,87 @@ @@ -27669,35 +28077,87 @@
linear << options {} forall >> //gs1-128 exec linear << options {} forall >> //gs1-128 exec
dup (sbs) get /linsbs exch def dup (sbs) get /linsbs exch def
dup (bhs) get 0 get 72 mul /linheight exch def dup (bhs) get 0 get 72 mul /linheight exch def
@ -1063,7 +1063,7 @@
end end
@@ -29091,3 +29551,189 @@ @@ -29130,3 +29590,189 @@
% --END ENCODER hibcazteccode-- % --END ENCODER hibcazteccode--
% --END TEMPLATE-- % --END TEMPLATE--

View File

@ -73,6 +73,7 @@ HEADERS += ../backend/aztec.h \
SOURCES += ../backend/2of5.c \ SOURCES += ../backend/2of5.c \
../backend/auspost.c \ ../backend/auspost.c \
../backend/aztec.c \ ../backend/aztec.c \
../backend/bc412.c \
../backend/bmp.c \ ../backend/bmp.c \
../backend/codablock.c \ ../backend/codablock.c \
../backend/code.c \ ../backend/code.c \

View File

@ -55,6 +55,7 @@ HEADERS += ../backend/aztec.h \
SOURCES += ../backend/2of5.c \ SOURCES += ../backend/2of5.c \
../backend/auspost.c \ ../backend/auspost.c \
../backend/aztec.c \ ../backend/aztec.c \
../backend/bc412.c \
../backend/bmp.c \ ../backend/bmp.c \
../backend/codablock.c \ ../backend/codablock.c \
../backend/code.c \ ../backend/code.c \

View File

@ -5567,6 +5567,7 @@ done
../backend/2of5.c ../backend/2of5.c
../backend/auspost.c ../backend/auspost.c
../backend/aztec.c ../backend/aztec.c
../backend/bc412.c
../backend/bmp.c ../backend/bmp.c
../backend/codablock.c ../backend/codablock.c
../backend/code128.c ../backend/code128.c

View File

@ -70,6 +70,7 @@ TEA_ADD_SOURCES([
../backend/2of5.c ../backend/2of5.c
../backend/auspost.c ../backend/auspost.c
../backend/aztec.c ../backend/aztec.c
../backend/bc412.c
../backend/bmp.c ../backend/bmp.c
../backend/codablock.c ../backend/codablock.c
../backend/code128.c ../backend/code128.c

View File

@ -310,6 +310,7 @@ static const char *s_code_list[] = {
"UPNQR", "UPNQR",
"UltraCode", "UltraCode",
"rMQR", "rMQR",
"BC412",
NULL}; NULL};
static const int s_code_number[] = { static const int s_code_number[] = {
@ -408,6 +409,7 @@ static const int s_code_number[] = {
BARCODE_UPNQR, BARCODE_UPNQR,
BARCODE_ULTRA, BARCODE_ULTRA,
BARCODE_RMQR, BARCODE_RMQR,
BARCODE_BC412,
0}; 0};
/* ECI TCL encoding names. /* ECI TCL encoding names.

View File

@ -450,7 +450,7 @@ static int get_barcode_name(const char *barcode_name) {
{ BARCODE_DBAR_EXPSTK_CC, "rssexpstackcc" }, /* Synonym */ { BARCODE_DBAR_EXPSTK_CC, "rssexpstackcc" }, /* Synonym */
{ BARCODE_DBAR_LTD, "rssltd" }, /* Synonym */ { BARCODE_DBAR_LTD, "rssltd" }, /* Synonym */
{ BARCODE_DBAR_LTD_CC, "rssltdcc" }, /* Synonym */ { BARCODE_DBAR_LTD_CC, "rssltdcc" }, /* Synonym */
{ BARCODE_C25STANDARD, "standardcode2of5" }, { BARCODE_C25STANDARD, "standardcode2of5" }, /* Synonym */
{ BARCODE_TELEPEN, "telepen" }, { BARCODE_TELEPEN, "telepen" },
{ BARCODE_TELEPEN_NUM, "telepennum" }, { BARCODE_TELEPEN_NUM, "telepennum" },
{ BARCODE_ULTRA, "ultra" }, { BARCODE_ULTRA, "ultra" },

View File

@ -1282,6 +1282,8 @@ void MainWindow::copy_to_clipboard_png()
{ {
copy_to_clipboard(QSL(".zint.png"), QSL("PNG")); copy_to_clipboard(QSL(".zint.png"), QSL("PNG"));
} }
#else
void MainWindow::copy_to_clipboard_png() {} // Workaround Qt not parsing #ifndef NO_PNG in slots
#endif #endif
void MainWindow::copy_to_clipboard_svg() void MainWindow::copy_to_clipboard_svg()

View File

@ -102,9 +102,7 @@ public slots:
void copy_to_clipboard_emf(); void copy_to_clipboard_emf();
void copy_to_clipboard_eps(); void copy_to_clipboard_eps();
void copy_to_clipboard_gif(); void copy_to_clipboard_gif();
#ifndef NO_PNG void copy_to_clipboard_png(); // Note Qt can't handle #ifndef NO_PNG in slots
void copy_to_clipboard_png();
#endif
void copy_to_clipboard_pcx(); void copy_to_clipboard_pcx();
void copy_to_clipboard_svg(); void copy_to_clipboard_svg();
void copy_to_clipboard_tif(); void copy_to_clipboard_tif();

View File

@ -126,6 +126,7 @@
<ClCompile Include="..\backend\2of5.c" /> <ClCompile Include="..\backend\2of5.c" />
<ClCompile Include="..\backend\auspost.c" /> <ClCompile Include="..\backend\auspost.c" />
<ClCompile Include="..\backend\aztec.c" /> <ClCompile Include="..\backend\aztec.c" />
<ClCompile Include="..\backend\bc412.c" />
<ClCompile Include="..\backend\bmp.c" /> <ClCompile Include="..\backend\bmp.c" />
<ClCompile Include="..\backend\codablock.c" /> <ClCompile Include="..\backend\codablock.c" />
<ClCompile Include="..\backend\code.c" /> <ClCompile Include="..\backend\code.c" />

View File

@ -275,6 +275,10 @@
RelativePath="..\backend\aztec.c" RelativePath="..\backend\aztec.c"
> >
</File> </File>
<File
RelativePath="..\backend\bc412.c"
>
</File>
<File <File
RelativePath="..\backend\bmp.c" RelativePath="..\backend\bmp.c"
> >

View File

@ -304,6 +304,7 @@
<ClCompile Include="..\..\backend\2of5.c" /> <ClCompile Include="..\..\backend\2of5.c" />
<ClCompile Include="..\..\backend\auspost.c" /> <ClCompile Include="..\..\backend\auspost.c" />
<ClCompile Include="..\..\backend\aztec.c" /> <ClCompile Include="..\..\backend\aztec.c" />
<ClCompile Include="..\..\backend\bc412.c" />
<ClCompile Include="..\..\backend\bmp.c" /> <ClCompile Include="..\..\backend\bmp.c" />
<ClCompile Include="..\..\backend\codablock.c" /> <ClCompile Include="..\..\backend\codablock.c" />
<ClCompile Include="..\..\backend\code.c" /> <ClCompile Include="..\..\backend\code.c" />

View File

@ -71,6 +71,7 @@
<ClCompile Include="..\..\backend\2of5.c" /> <ClCompile Include="..\..\backend\2of5.c" />
<ClCompile Include="..\..\backend\auspost.c" /> <ClCompile Include="..\..\backend\auspost.c" />
<ClCompile Include="..\..\backend\aztec.c" /> <ClCompile Include="..\..\backend\aztec.c" />
<ClCompile Include="..\..\backend\bc412.c" />
<ClCompile Include="..\..\backend\bmp.c" /> <ClCompile Include="..\..\backend\bmp.c" />
<ClCompile Include="..\..\backend\codablock.c" /> <ClCompile Include="..\..\backend\codablock.c" />
<ClCompile Include="..\..\backend\code.c" /> <ClCompile Include="..\..\backend\code.c" />

View File

@ -126,6 +126,7 @@
<ClCompile Include="..\..\backend\2of5.c" /> <ClCompile Include="..\..\backend\2of5.c" />
<ClCompile Include="..\..\backend\auspost.c" /> <ClCompile Include="..\..\backend\auspost.c" />
<ClCompile Include="..\..\backend\aztec.c" /> <ClCompile Include="..\..\backend\aztec.c" />
<ClCompile Include="..\..\backend\bc412.c" />
<ClCompile Include="..\..\backend\bmp.c" /> <ClCompile Include="..\..\backend\bmp.c" />
<ClCompile Include="..\..\backend\codablock.c" /> <ClCompile Include="..\..\backend\codablock.c" />
<ClCompile Include="..\..\backend\code.c" /> <ClCompile Include="..\..\backend\code.c" />

View File

@ -100,6 +100,10 @@ SOURCE=..\..\backend\aztec.c
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\backend\bc412.c
# End Source File
# Begin Source File
SOURCE=..\..\backend\bmp.c SOURCE=..\..\backend\bmp.c
# End Source File # End Source File
# Begin Source File # Begin Source File