From e14d9e99d526fbc508d3abcd0a3bbd4d18ba13d3 Mon Sep 17 00:00:00 2001 From: gitlost Date: Sat, 20 Nov 2021 11:32:30 +0000 Subject: [PATCH] Add HEIGHTPERROW_MODE_input mode flag (#204) backend_qt: add encodedWidth, encodedRows DBAR_EXPSTK: add max rows option (option_3) CODE16K/CODE49: add min rows option (option_1) GUI: HIBC xxx -> HIBC --- ChangeLog | 3 + backend/code16k.c | 12 +- backend/code49.c | 14 + backend/common.c | 6 +- backend/composite.c | 1 + backend/rss.c | 35 ++- backend/tests/test_code16k.c | 111 +++++--- backend/tests/test_code49.c | 79 ++++-- backend/tests/test_composite.c | 225 ++++++++------- backend/tests/test_raster.c | 164 +++++++++++ backend/tests/test_rss.c | 402 ++++++++++++++++----------- backend/tests/test_vector.c | 162 +++++++++++ backend/tests/testcommon.c | 18 +- backend/zint.h | 1 + backend_qt/qzint.cpp | 16 ++ backend_qt/qzint.h | 5 + backend_qt/tests/test_qzint.cpp | 13 +- backend_tcl/zint.c | 26 +- docs/manual.txt | 78 ++++-- frontend/main.c | 13 +- frontend/tests/test_args.c | 7 + frontend_qt/grpAztec.ui | 8 +- frontend_qt/grpC128.ui | 6 +- frontend_qt/grpC16k.ui | 226 ++++++++++++++- frontend_qt/grpC39.ui | 8 +- frontend_qt/grpC49.ui | 183 ++++++++++++- frontend_qt/grpCodablockF.ui | 142 +++++++++- frontend_qt/grpDBExtend.ui | 267 +++++++++++++++++- frontend_qt/grpDM.ui | 8 +- frontend_qt/grpMicroPDF.ui | 130 ++++++++- frontend_qt/grpPDF417.ui | 469 +++++++++++++++++++++----------- frontend_qt/grpQR.ui | 8 +- frontend_qt/grpUPCA.ui | 8 +- frontend_qt/grpUPCEAN.ui | 8 +- frontend_qt/mainwindow.cpp | 189 ++++++++++++- frontend_qt/mainwindow.h | 10 + 36 files changed, 2453 insertions(+), 608 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1760d3d2..1bb6bb7b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -38,6 +38,9 @@ Changes - DAFT: max chars 50 -> 100 - CMake: separate no-optimize from ZINT_DEBUG into new ZINT_NOOPT option - PDF417: add specify rows option +- Add HEIGHTPERROW_MODE input mode flag +- DBAR_EXPSTK: add max rows option +- CODE16K/CODE49: add min rows option Bugs ---- diff --git a/backend/code16k.c b/backend/code16k.c index fbcf6d0e..34721ad7 100644 --- a/backend/code16k.c +++ b/backend/code16k.c @@ -64,6 +64,7 @@ INTERNAL int code16k(struct zint_symbol *symbol, unsigned char source[], int len int list[2][C128_MAX] = {{0}}; char set[C128_MAX] = {0}, fset[C128_MAX], mode, last_set, current_set; int pads_needed, indexliste, i, m, read, mx_reader; + int extra_pads = 0; int values[C128_MAX] = {0}; int bar_characters; float glyph_count; @@ -183,6 +184,15 @@ INTERNAL int code16k(struct zint_symbol *symbol, unsigned char source[], int len if (rows == 1) { rows = 2; } + if (symbol->option_1 >= 2 && symbol->option_1 <= 16) { /* Minimum no. of rows */ + if (symbol->option_1 > rows) { + extra_pads = (symbol->option_1 - rows) * 5; + rows = symbol->option_1; + } + } else if (symbol->option_1 >= 1) { + strcpy(symbol->errtxt, "424: Minimum number of rows out of range (2 to 16)"); + return ZINT_ERROR_INVALID_OPTION; + } /* start with the mode character - Table 2 */ m = 0; @@ -313,7 +323,7 @@ INTERNAL int code16k(struct zint_symbol *symbol, unsigned char source[], int len if ((bar_characters + pads_needed) < 8) { pads_needed += 8 - (bar_characters + pads_needed); } - for (i = 0; i < pads_needed; i++) { + for (i = 0; i < pads_needed + extra_pads; i++) { values[bar_characters] = 103; bar_characters++; } diff --git a/backend/code49.c b/backend/code49.c index 506a0c34..48350546 100644 --- a/backend/code49.c +++ b/backend/code49.c @@ -246,6 +246,20 @@ INTERNAL int code49(struct zint_symbol *symbol, unsigned char source[], int leng rows++; } + if (symbol->option_1 >= 2 && symbol->option_1 <= 8) { /* Minimum no. of rows */ + if (symbol->option_1 > rows) { + for (j = symbol->option_1 - rows; j > 0; j--) { + for (i = 0; i < 7; i++) { + c_grid[rows][i] = 48; /* Pad */ + } + rows++; + } + } + } else if (symbol->option_1 >= 1) { + strcpy(symbol->errtxt, "424: Minimum number of rows out of range (2 to 8)"); + return ZINT_ERROR_INVALID_OPTION; + } + /* Add row count and mode character */ c_grid[rows - 1][6] = (7 * (rows - 2)) + M; diff --git a/backend/common.c b/backend/common.c index 014cb652..00a46df6 100644 --- a/backend/common.c +++ b/backend/common.c @@ -424,7 +424,11 @@ INTERNAL int set_height(struct zint_symbol *symbol, const float min_row_height, if (zero_count) { if (symbol->height) { - row_height = stripf((symbol->height - fixed_height) / zero_count); + if (symbol->input_mode & HEIGHTPERROW_MODE) { + row_height = stripf(symbol->height); + } else { + row_height = stripf((symbol->height - fixed_height) / zero_count); + } } else if (default_height) { row_height = stripf(default_height / zero_count); } else { diff --git a/backend/composite.c b/backend/composite.c index 394f9fb7..463bcdac 100644 --- a/backend/composite.c +++ b/backend/composite.c @@ -1441,6 +1441,7 @@ INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int l linear->input_mode = symbol->input_mode; linear->output_options = symbol->output_options; linear->option_2 = symbol->option_2; + linear->option_3 = symbol->option_3; /* If symbol->height given minimum row height will be returned, else default height */ linear->height = symbol->height; linear->debug = symbol->debug; diff --git a/backend/rss.c b/backend/rss.c index 63a6ec8c..20fed411 100644 --- a/backend/rss.c +++ b/backend/rss.c @@ -832,10 +832,11 @@ INTERNAL int dbar_date(const unsigned char source[], const int src_posn) { /* Handles all data encodation from section 7.2.5 of ISO/IEC 24724 */ static int dbar_exp_binary_string(struct zint_symbol *symbol, const unsigned char source[], char binary_string[], - int cols_per_row, int *p_bp) { + int *p_cols_per_row, const int max_rows, int *p_bp) { int encoding_method, i, j, read_posn, mode = NUMERIC; char last_digit = '\0'; - int symbol_characters, characters_per_row = cols_per_row * 2; + int symbol_characters, characters_per_row = *p_cols_per_row * 2; + int min_cols_per_row = 0; int length = (int) ustrlen(source); const int debug_print = (symbol->debug & ZINT_DEBUG_PRINT); #ifndef _MSC_VER @@ -1079,7 +1080,7 @@ static int dbar_exp_binary_string(struct zint_symbol *symbol, const unsigned cha } } - if (debug_print) printf("Resultant binary = %.*s\n\tLength: %d\n", bp, binary_string, bp); + if (debug_print) printf("Resultant binary (%d): %.*s\n", bp, bp, binary_string); remainder = 12 - (bp % 12); if (remainder == 12) { @@ -1087,6 +1088,13 @@ static int dbar_exp_binary_string(struct zint_symbol *symbol, const unsigned cha } symbol_characters = ((bp + remainder) / 12) + 1; + if (max_rows) { + min_cols_per_row = ((symbol_characters + 1) / 2 + max_rows - 1) / max_rows; + if (min_cols_per_row > *p_cols_per_row) { + characters_per_row = min_cols_per_row * 2; + } + } + if (characters_per_row && (symbol_characters % characters_per_row) == 1) { // DBAR_EXPSTK symbol_characters++; } @@ -1116,6 +1124,13 @@ static int dbar_exp_binary_string(struct zint_symbol *symbol, const unsigned cha } symbol_characters = ((bp + remainder) / 12) + 1; + if (max_rows) { + min_cols_per_row = ((symbol_characters + 1) / 2 + max_rows - 1) / max_rows; + if (min_cols_per_row > *p_cols_per_row) { + characters_per_row = min_cols_per_row * 2; + } + } + if (characters_per_row && (symbol_characters % characters_per_row) == 1) { // DBAR_EXPSTK symbol_characters++; } @@ -1126,7 +1141,7 @@ static int dbar_exp_binary_string(struct zint_symbol *symbol, const unsigned cha remainder = (12 * (symbol_characters - 1)) - bp; - if (debug_print) printf("Resultant binary = %.*s\n\tLength: %d\n", bp, binary_string, bp); + if (debug_print) printf(" Expanded binary (%d): %.*s\n", bp, bp, binary_string); } if (bp > 252) { /* 252 = (21 * 12) */ @@ -1134,6 +1149,10 @@ static int dbar_exp_binary_string(struct zint_symbol *symbol, const unsigned cha return ZINT_ERROR_TOO_LONG; } + if (min_cols_per_row && min_cols_per_row > *p_cols_per_row) { + *p_cols_per_row = min_cols_per_row; + } + /* Now add padding to binary string (7.2.5.5.4) */ i = remainder; if (mode == NUMERIC) { @@ -1164,7 +1183,8 @@ static int dbar_exp_binary_string(struct zint_symbol *symbol, const unsigned cha binary_string[7] = d2 ? '1' : '0'; } if (debug_print) { - printf("Resultant binary = %.*s\n\tLength: %d, Symbol chars: %d\n", bp, binary_string, bp, symbol_characters); + printf(" Final binary (%d): %.*s\n Symbol chars: %d, Remainder: %d\n", + bp, bp, binary_string, symbol_characters, remainder); } *p_bp = bp; @@ -1252,6 +1272,7 @@ INTERNAL int dbar_exp_cc(struct zint_symbol *symbol, unsigned char source[], int int widths[4]; int bp = 0; int cols_per_row = 0; + int max_rows = 0; int stack_rows = 1; const int debug_print = (symbol->debug & ZINT_DEBUG_PRINT); #ifndef _MSC_VER @@ -1297,10 +1318,12 @@ INTERNAL int dbar_exp_cc(struct zint_symbol *symbol, unsigned char source[], int component of an EAN.UCC Composite symbol." */ cols_per_row = 2; } + } else if (symbol->option_3 >= 2 && symbol->option_3 <= 11) { + max_rows = symbol->option_3; } } - error_number = dbar_exp_binary_string(symbol, reduced, binary_string, cols_per_row, &bp); + error_number = dbar_exp_binary_string(symbol, reduced, binary_string, &cols_per_row, max_rows, &bp); if (error_number != 0) { return error_number; } diff --git a/backend/tests/test_code16k.c b/backend/tests/test_code16k.c index a787e17e..2d8c4dba 100644 --- a/backend/tests/test_code16k.c +++ b/backend/tests/test_code16k.c @@ -145,6 +145,7 @@ static void test_input(int index, int generate, int debug) { struct item { int input_mode; + int option_1; char *data; int length; int ret; @@ -161,29 +162,37 @@ static void test_input(int index, int generate, int debug) { // ß U+00DF (\337, 223), UTF-8 C39F, CodeA and CodeB extended ASCII // é U+00E9 (\351, 233), UTF-8 C3A9, CodeB-only extended ASCII struct item data[] = { - /* 0*/ { UNICODE_MODE, "\037", -1, 0, 2, 70, "(10) 0 95 103 103 103 103 103 103 22 42", "ModeA US Pad (6)" }, - /* 1*/ { UNICODE_MODE, "A", -1, 0, 2, 70, "(10) 1 33 103 103 103 103 103 103 52 82", "ModeB A Pad (6)" }, - /* 2*/ { UNICODE_MODE, "12", -1, 0, 2, 70, "(10) 2 12 103 103 103 103 103 103 98 27", "ModeC 12 Pad (6)" }, - /* 3*/ { GS1_MODE, "[90]A", -1, 0, 2, 70, "(10) 3 25 16 33 103 103 103 103 83 20", "ModeBFNC1 9 0 A Pad (4)" }, - /* 4*/ { GS1_MODE, "[90]12", -1, 0, 2, 70, "(10) 4 90 12 103 103 103 103 103 79 62", "ModeCFNC1 90 12 Pad (5)" }, - /* 5*/ { GS1_MODE, "[90]12[20]12", -1, 0, 2, 70, "(10) 4 90 12 102 20 12 103 103 9 72", "ModeCFNC1 90 12 FNC1 20 12 Pad (2)" }, - /* 6*/ { GS1_MODE, "[90]123[20]12", -1, 0, 2, 70, "(15) 4 90 12 100 19 99 102 20 12 103 103 103 103 88 22", "ModeCFNC1 90 CodeB 3 CodeC FNC1 20 12 Pad (4)" }, - /* 7*/ { GS1_MODE, "[90]123[91]1A3[20]12", -1, 0, 4, 70, "(20) 18 90 12 100 19 102 25 99 11 100 33 19 99 102 20 12 103 103 0 3", "ModeCFNC1 90 12 CodeB 3 FNC1 9 CodeC 11 CodeB A 3 CodeC FNC1 20 12 Pad (2)" }, - /* 8*/ { GS1_MODE, "[90]123A[91]123", -1, 0, 3, 70, "(15) 11 90 12 100 19 33 102 25 99 11 23 103 103 81 56", "ModeCFNC1 90 12 CodeB 3 A FNC1 9 CodeC 11 23 Pad (2)" }, - /* 9*/ { GS1_MODE | GS1PARENS_MODE, "(90)12", -1, 0, 2, 70, "(10) 4 90 12 103 103 103 103 103 79 62", "ModeCFNC1 90 12 Pad (5)" }, - /* 10*/ { UNICODE_MODE, "a0123456789", -1, 0, 2, 70, "(10) 5 65 1 23 45 67 89 103 27 86", "ModeC1SB a 01 23 45 67 89 Pad" }, - /* 11*/ { UNICODE_MODE, "ab0123456789", -1, 0, 2, 70, "(10) 6 65 66 1 23 45 67 89 19 42", "ModeC2SB a b 01 23 45 67 89" }, - /* 12*/ { UNICODE_MODE, "1234\037a", -1, 0, 2, 70, "(10) 2 12 34 101 95 98 65 103 67 53", "ModeC 12 34 CodeA US 1SB a Pad" }, - /* 13*/ { UNICODE_MODE, "\000\037ß", 4, 0, 2, 70, "(10) 0 64 95 101 63 103 103 103 75 11", "ModeA NUL US FNC4 ß Pad (3)" }, - /* 14*/ { UNICODE_MODE, "\000\037é", 4, 0, 2, 70, "(10) 0 64 95 101 98 73 103 103 75 6", "ModeA NUL US FNC4 1SB é Pad (2)" }, - /* 15*/ { UNICODE_MODE, "\000\037éa", 5, 0, 2, 70, "(10) 0 64 95 100 100 73 65 103 99 69", "ModeA NUL US CodeB FNC4 é a Pad" }, - /* 16*/ { UNICODE_MODE, "abß", -1, 0, 2, 70, "(10) 1 65 66 100 63 103 103 103 66 56", "ModeB a b FNC4 ß Pad (3)" }, - /* 17*/ { DATA_MODE, "\141\142\237", -1, 0, 2, 70, "(10) 1 65 66 100 98 95 103 103 6 71", "ModeB a b FNC4 1SA APC Pad (2)" }, - /* 18*/ { DATA_MODE, "\141\142\237\037", -1, 0, 2, 70, "(10) 1 65 66 101 101 95 95 103 72 93", "ModeB a b CodeA FNC4 APC US Pad" }, - /* 19*/ { UNICODE_MODE, "ééé", -1, 0, 2, 70, "(10) 1 100 73 100 73 100 73 103 105 106", "ModeB FNC4 é FNC4 é FNC4 é Pad" }, - /* 20*/ { UNICODE_MODE, "aééééb", -1, 0, 3, 70, "(15) 8 65 100 73 100 73 100 73 100 73 66 103 103 39 83", "ModeB a FNC4 é (4) b Pad (2)" }, - /* 21*/ { UNICODE_MODE, "aéééééb", -1, 0, 3, 70, "(15) 8 65 100 73 100 73 100 73 100 73 100 73 66 74 106", "ModeB a FNC4 é (5) b" }, - /* 22*/ { UNICODE_MODE, "aééééébcdeé", -1, 0, 4, 70, "(20) 15 65 100 73 100 73 100 73 100 73 100 73 66 67 68 69 100 73 14 69", "ModeB a FNC4 é (5) b c d e FNC4 é" }, + /* 0*/ { UNICODE_MODE, -1, "\037", -1, 0, 2, 70, "(10) 0 95 103 103 103 103 103 103 22 42", "ModeA US Pad (6)" }, + /* 1*/ { UNICODE_MODE, -1, "A", -1, 0, 2, 70, "(10) 1 33 103 103 103 103 103 103 52 82", "ModeB A Pad (6)" }, + /* 2*/ { UNICODE_MODE, -1, "12", -1, 0, 2, 70, "(10) 2 12 103 103 103 103 103 103 98 27", "ModeC 12 Pad (6)" }, + /* 3*/ { GS1_MODE, -1, "[90]A", -1, 0, 2, 70, "(10) 3 25 16 33 103 103 103 103 83 20", "ModeBFNC1 9 0 A Pad (4)" }, + /* 4*/ { GS1_MODE, -1, "[90]12", -1, 0, 2, 70, "(10) 4 90 12 103 103 103 103 103 79 62", "ModeCFNC1 90 12 Pad (5)" }, + /* 5*/ { GS1_MODE, -1, "[90]12[20]12", -1, 0, 2, 70, "(10) 4 90 12 102 20 12 103 103 9 72", "ModeCFNC1 90 12 FNC1 20 12 Pad (2)" }, + /* 6*/ { GS1_MODE, -1, "[90]123[20]12", -1, 0, 2, 70, "(15) 4 90 12 100 19 99 102 20 12 103 103 103 103 88 22", "ModeCFNC1 90 CodeB 3 CodeC FNC1 20 12 Pad (4)" }, + /* 7*/ { GS1_MODE, -1, "[90]123[91]1A3[20]12", -1, 0, 4, 70, "(20) 18 90 12 100 19 102 25 99 11 100 33 19 99 102 20 12 103 103 0 3", "ModeCFNC1 90 12 CodeB 3 FNC1 9 CodeC 11 CodeB A 3 CodeC FNC1 20 12 Pad (2)" }, + /* 8*/ { GS1_MODE, -1, "[90]123A[91]123", -1, 0, 3, 70, "(15) 11 90 12 100 19 33 102 25 99 11 23 103 103 81 56", "ModeCFNC1 90 12 CodeB 3 A FNC1 9 CodeC 11 23 Pad (2)" }, + /* 9*/ { GS1_MODE | GS1PARENS_MODE, -1, "(90)12", -1, 0, 2, 70, "(10) 4 90 12 103 103 103 103 103 79 62", "ModeCFNC1 90 12 Pad (5)" }, + /* 10*/ { UNICODE_MODE, -1, "a0123456789", -1, 0, 2, 70, "(10) 5 65 1 23 45 67 89 103 27 86", "ModeC1SB a 01 23 45 67 89 Pad" }, + /* 11*/ { UNICODE_MODE, -1, "ab0123456789", -1, 0, 2, 70, "(10) 6 65 66 1 23 45 67 89 19 42", "ModeC2SB a b 01 23 45 67 89" }, + /* 12*/ { UNICODE_MODE, -1, "1234\037a", -1, 0, 2, 70, "(10) 2 12 34 101 95 98 65 103 67 53", "ModeC 12 34 CodeA US 1SB a Pad" }, + /* 13*/ { UNICODE_MODE, -1, "\000\037ß", 4, 0, 2, 70, "(10) 0 64 95 101 63 103 103 103 75 11", "ModeA NUL US FNC4 ß Pad (3)" }, + /* 14*/ { UNICODE_MODE, -1, "\000\037é", 4, 0, 2, 70, "(10) 0 64 95 101 98 73 103 103 75 6", "ModeA NUL US FNC4 1SB é Pad (2)" }, + /* 15*/ { UNICODE_MODE, -1, "\000\037éa", 5, 0, 2, 70, "(10) 0 64 95 100 100 73 65 103 99 69", "ModeA NUL US CodeB FNC4 é a Pad" }, + /* 16*/ { UNICODE_MODE, -1, "abß", -1, 0, 2, 70, "(10) 1 65 66 100 63 103 103 103 66 56", "ModeB a b FNC4 ß Pad (3)" }, + /* 17*/ { DATA_MODE, -1, "\141\142\237", -1, 0, 2, 70, "(10) 1 65 66 100 98 95 103 103 6 71", "ModeB a b FNC4 1SA APC Pad (2)" }, + /* 18*/ { DATA_MODE, -1, "\141\142\237\037", -1, 0, 2, 70, "(10) 1 65 66 101 101 95 95 103 72 93", "ModeB a b CodeA FNC4 APC US Pad" }, + /* 19*/ { UNICODE_MODE, -1, "ééé", -1, 0, 2, 70, "(10) 1 100 73 100 73 100 73 103 105 106", "ModeB FNC4 é FNC4 é FNC4 é Pad" }, + /* 20*/ { UNICODE_MODE, -1, "aééééb", -1, 0, 3, 70, "(15) 8 65 100 73 100 73 100 73 100 73 66 103 103 39 83", "ModeB a FNC4 é (4) b Pad (2)" }, + /* 21*/ { UNICODE_MODE, -1, "aéééééb", -1, 0, 3, 70, "(15) 8 65 100 73 100 73 100 73 100 73 100 73 66 74 106", "ModeB a FNC4 é (5) b" }, + /* 22*/ { UNICODE_MODE, -1, "aééééébcdeé", -1, 0, 4, 70, "(20) 15 65 100 73 100 73 100 73 100 73 100 73 66 67 68 69 100 73 14 69", "ModeB a FNC4 é (5) b c d e FNC4 é" }, + /* 23*/ { UNICODE_MODE, -1, "123456789012345678901234", -1, 0, 3, 70, "(15) 9 12 34 56 78 90 12 34 56 78 90 12 34 71 42", "3 rows" }, + /* 24*/ { UNICODE_MODE, 2, "123456789012345678901234", -1, 0, 3, 70, "(15) 9 12 34 56 78 90 12 34 56 78 90 12 34 71 42", "Min 2 rows (no change)" }, + /* 25*/ { UNICODE_MODE, 3, "123456789012345678901234", -1, 0, 3, 70, "(15) 9 12 34 56 78 90 12 34 56 78 90 12 34 71 42", "Min 3 rows (no change)" }, + /* 26*/ { UNICODE_MODE, 4, "123456789012345678901234", -1, 0, 4, 70, "(20) 16 12 34 56 78 90 12 34 56 78 90 12 34 103 103 103 103 103 66 96", "Min 4 rows" }, + /* 27*/ { UNICODE_MODE, 5, "123456789012345678901234", -1, 0, 5, 70, "(25) 23 12 34 56 78 90 12 34 56 78 90 12 34 103 103 103 103 103 103 103 103 103 103 68 61", "Min 5 rows" }, + /* 28*/ { UNICODE_MODE, 16, "123456789012345678901234", -1, 0, 16, 70, "(80) 100 12 34 56 78 90 12 34 56 78 90 12 34 103 103 103 103 103 103 103 103 103 103 103", "Min 16 rows" }, + /* 29*/ { UNICODE_MODE, 1, "123456789012345678901234", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 424: Minimum number of rows out of range (2 to 16)", "" }, + /* 30*/ { UNICODE_MODE, 17, "123456789012345678901234", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 424: Minimum number of rows out of range (2 to 16)", "" }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -202,20 +211,21 @@ static void test_input(int index, int generate, int debug) { symbol->debug = ZINT_DEBUG_TEST; // Needed to get codeword dump in errtxt - length = testUtilSetSymbol(symbol, BARCODE_CODE16K, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, data[i].length, debug); + length = testUtilSetSymbol(symbol, BARCODE_CODE16K, data[i].input_mode, -1 /*eci*/, data[i].option_1, -1, -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, \"%s\", %d, %s, %d, %d, \"%s\", \"%s\" },\n", - i, testUtilInputModeName(data[i].input_mode), testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), data[i].length, + printf(" /*%3d*/ { %s, %d, \"%s\", %d, %s, %d, %d, \"%s\", \"%s\" },\n", + i, testUtilInputModeName(data[i].input_mode), data[i].option_1, + 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 { + assert_zero(strcmp((char *) symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected); 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); } } @@ -229,6 +239,7 @@ static void test_encode(int index, int generate, int debug) { struct item { int input_mode; + int option_1; char *data; int ret; @@ -238,16 +249,47 @@ static void test_encode(int index, int generate, int debug) { char *expected; }; struct item data[] = { - /* 0*/ { UNICODE_MODE, "ab0123456789", 0, 2, 70, "BS EN 12323:2005 Figure 3", + /* 0*/ { UNICODE_MODE, -1, "ab0123456789", 0, 2, 70, "BS EN 12323:2005 Figure 3", "1110010101100110111011010011110110111100100110010011000100100010001101" "1100110101000100111011110100110010010000100110100011010010001110011001" }, - /* 1*/ { UNICODE_MODE, "www.wikipedia.de", 0, 4, 70, "https://commons.wikimedia.org/wiki/File:Code_16K_wikipedia.png", + /* 1*/ { UNICODE_MODE, -1, "www.wikipedia.de", 0, 4, 70, "https://commons.wikimedia.org/wiki/File:Code_16K_wikipedia.png", "1110010101000110011000011010110000110101100001101011011001100010001101" "1100110100001101011011110010110011110110101111001011010110000110011001" "1101100101001101111011110110010111100101101101001111011001100010010011" "1000010101111011001010011011110010111101101100001011010001001110111101" }, + /* 2*/ { UNICODE_MODE, -1, "12345678901234567890123456789012", 0, 4, 70, "", + "1110010101100010011010011000110111010011100011101001001111010110001101" + "1100110100100001001010011000110111010011100011101001001111010110011001" + "1101100100100001001010011000110111010011100011101001001111010110010011" + "1000010100100001001010011000110010111101100001011101000111010010111101" + }, + /* 3*/ { UNICODE_MODE, 5, "12345678901234567890123456789012", 0, 5, 70, "Min 5 rows", + "1110010100010010001010011000110111010011100011101001001111010110001101" + "1100110100100001001010011000110111010011100011101001001111010110011001" + "1101100100100001001010011000110111010011100011101001001111010110010011" + "1000010100100001001010011000110010111101100101111011001011110110111101" + "1011100100101111011001011110110010111101101000010001011110011010100011" + }, + /* 4*/ { UNICODE_MODE, 16, "12345678901234567890123456789012", 0, 16, 70, "Min 16 rows", + "1110010101000010001010011000110111010011100011101001001111010110001101" + "1100110100100001001010011000110111010011100011101001001111010110011001" + "1101100100100001001010011000110111010011100011101001001111010110010011" + "1000010100100001001010011000110010111101100101111011001011110110111101" + "1011100100101111011001011110110010111101100101111011001011110110100011" + "1001110100101111011001011110110010111101100101111011001011110110110001" + "1010000100101111011001011110110010111101100101111011001011110110101111" + "1110100100101111011001011110110010111101100101111011001011110110001011" + "1110010100101111011001011110110010111101100101111011001011110110100011" + "1100110100101111011001011110110010111101100101111011001011110110110001" + "1101100100101111011001011110110010111101100101111011001011110110101111" + "1000010100101111011001011110110010111101100101111011001011110110001011" + "1011100100101111011001011110110010111101100101111011001011110110001101" + "1001110100101111011001011110110010111101100101111011001011110110011001" + "1010000100101111011001011110110010111101100101111011001011110110010011" + "1110100100101111011001011110110010111101100101110001001110010010111101" + }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -268,14 +310,15 @@ static void test_encode(int index, int generate, int debug) { symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); - length = testUtilSetSymbol(symbol, BARCODE_CODE16K, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug); + length = testUtilSetSymbol(symbol, BARCODE_CODE16K, data[i].input_mode, -1 /*eci*/, data[i].option_1, -1, -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, \"%s\", %s, %d, %d, \"%s\",\n", - i, testUtilInputModeName(data[i].input_mode), testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), + printf(" /*%3d*/ { %s, %d, \"%s\", %s, %d, %d, \"%s\",\n", + i, testUtilInputModeName(data[i].input_mode), data[i].option_1, + testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].comment); testUtilModulesPrint(symbol, " ", "\n"); printf(" },\n"); @@ -289,8 +332,8 @@ static void test_encode(int index, int generate, int debug) { 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, -1, -1, -1, debug)) { - ret = testUtilBwipp(i, symbol, -1, -1, -1, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf)); + if (do_bwipp && testUtilCanBwipp(i, symbol, data[i].option_1, -1, -1, debug)) { + ret = testUtilBwipp(i, symbol, data[i].option_1, -1, -1, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf)); 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); diff --git a/backend/tests/test_code49.c b/backend/tests/test_code49.c index bdea1cf4..bc473540 100644 --- a/backend/tests/test_code49.c +++ b/backend/tests/test_code49.c @@ -85,6 +85,7 @@ static void test_input(int index, int generate, int debug) { struct item { int input_mode; + int option_1; char *data; int length; int ret; @@ -96,21 +97,31 @@ static void test_input(int index, int generate, int debug) { // NUL U+0000, S1 SP (39) // US U+001F (\037, 31), S1 5 struct item data[] = { - /* 0*/ { UNICODE_MODE, "é", -1, ZINT_ERROR_INVALID_DATA, 0, 0, "Error 431: Invalid character in input data", "ASCII only" }, - /* 1*/ { UNICODE_MODE, "EXAMPLE 2", -1, 0, 2, 70, "(16) 14 33 10 22 25 21 14 41 38 2 35 14 18 13 0 22", "2.3.7 Symbol Example" }, - /* 2*/ { UNICODE_MODE, "12345", -1, 0, 2, 70, "(16) 5 17 9 48 48 48 48 27 48 48 13 23 0 13 2 0", "2.3 Example 1: Numeric Encodation (Start 2, Numeric)" }, - /* 3*/ { UNICODE_MODE, "123456", -1, 0, 2, 70, "(16) 5 17 9 6 48 48 48 34 48 48 36 9 23 41 2 11", "2.3 Example 1: Numeric Encodation" }, - /* 4*/ { UNICODE_MODE, "12345678", -1, 0, 2, 70, "(16) 5 17 9 14 6 48 48 0 48 48 25 42 2 17 2 37", "2.3 Example 1: Numeric Encodation" }, - /* 5*/ { UNICODE_MODE, "123456789", -1, 0, 2, 70, "(16) 5 17 9 46 16 37 48 31 48 48 7 26 9 39 2 32", "2.3 Example 1: Numeric Encodation" }, - /* 6*/ { UNICODE_MODE, "1234567", -1, 0, 2, 70, "(16) 43 45 2 11 39 48 48 40 48 48 33 36 38 6 2 15", "2.3 Example 1: Numeric Encodation" }, - /* 7*/ { UNICODE_MODE, "\037", -1, 0, 2, 70, "(16) 5 48 48 48 48 48 48 48 48 48 4 33 13 15 4 18", "US (Start 4, Alphanumeric S1)" }, - /* 8*/ { UNICODE_MODE, "\000\037", 2, 0, 2, 70, "(16) 38 43 5 48 48 48 48 33 48 48 45 7 38 43 4 37", "NUL S1 US (Start 4, Alphanumeric S1)" }, - /* 9*/ { UNICODE_MODE, "a\000", 2, 0, 2, 70, "(16) 10 43 38 48 48 48 48 38 48 48 32 33 14 15 5 48", "a S1 NUL (Start 5, Alphanumeric S2)" }, - /* 10*/ { UNICODE_MODE, "ab", -1, 0, 2, 70, "(16) 10 44 11 48 48 48 48 12 48 48 27 39 42 0 5 13", "a S2 b (Start 5, Alphanumeric S2)" }, - /* 11*/ { UNICODE_MODE, "\000A\000a\000", 5, 0, 2, 70, "(16) 38 10 43 38 44 10 43 30 38 48 25 23 38 32 4 12", "NUL A S1 NUL S2 a S1 (C18 30) NUL (Start 4, Alphanumeric S1)" }, - /* 12*/ { UNICODE_MODE, "1234\037aA12345A", -1, 0, 3, 70, "(24) 1 2 3 4 43 5 44 4 10 10 48 5 17 9 48 0 10 48 19 2 13 32 7 33", "1 2 3 4 S1 US S2 (C18 4) a A NS 12345 NS (C28 0) A (Start 0, Alpha)" }, - /* 13*/ { GS1_MODE, "[90]12345[91]AB12345", -1, 0, 4, 70, "(32) 45 48 47 15 4 7 9 28 48 45 9 1 10 11 48 25 5 17 9 48 48 48 48 27 48 48 37 39 26 8 14", "FNC1 NS 9012345 (C18 28) NS FNC1 9 1 A B NS (C28 25) 12345 Pad (4) (C38 27) (Start 0, Alpha)" }, - /* 14*/ { GS1_MODE | GS1PARENS_MODE, "(90)12345(91)AB12345", -1, 0, 4, 70, "(32) 45 48 47 15 4 7 9 28 48 45 9 1 10 11 48 25 5 17 9 48 48 48 48 27 48 48 37 39 26 8 14", "FNC1 NS 9012345 (C18 28) NS FNC1 9 1 A B NS (C28 25) 12345 Pad (4) (C38 27) (Start 0, Alpha)" }, + /* 0*/ { UNICODE_MODE, -1, "é", -1, ZINT_ERROR_INVALID_DATA, 0, 0, "Error 431: Invalid character in input data", "ASCII only" }, + /* 1*/ { UNICODE_MODE, -1, "EXAMPLE 2", -1, 0, 2, 70, "(16) 14 33 10 22 25 21 14 41 38 2 35 14 18 13 0 22", "2.3.7 Symbol Example" }, + /* 2*/ { UNICODE_MODE, -1, "12345", -1, 0, 2, 70, "(16) 5 17 9 48 48 48 48 27 48 48 13 23 0 13 2 0", "2.3 Example 1: Numeric Encodation (Start 2, Numeric)" }, + /* 3*/ { UNICODE_MODE, -1, "123456", -1, 0, 2, 70, "(16) 5 17 9 6 48 48 48 34 48 48 36 9 23 41 2 11", "2.3 Example 1: Numeric Encodation" }, + /* 4*/ { UNICODE_MODE, -1, "12345678", -1, 0, 2, 70, "(16) 5 17 9 14 6 48 48 0 48 48 25 42 2 17 2 37", "2.3 Example 1: Numeric Encodation" }, + /* 5*/ { UNICODE_MODE, -1, "123456789", -1, 0, 2, 70, "(16) 5 17 9 46 16 37 48 31 48 48 7 26 9 39 2 32", "2.3 Example 1: Numeric Encodation" }, + /* 6*/ { UNICODE_MODE, -1, "1234567", -1, 0, 2, 70, "(16) 43 45 2 11 39 48 48 40 48 48 33 36 38 6 2 15", "2.3 Example 1: Numeric Encodation" }, + /* 7*/ { UNICODE_MODE, -1, "\037", -1, 0, 2, 70, "(16) 5 48 48 48 48 48 48 48 48 48 4 33 13 15 4 18", "US (Start 4, Alphanumeric S1)" }, + /* 8*/ { UNICODE_MODE, -1, "\000\037", 2, 0, 2, 70, "(16) 38 43 5 48 48 48 48 33 48 48 45 7 38 43 4 37", "NUL S1 US (Start 4, Alphanumeric S1)" }, + /* 9*/ { UNICODE_MODE, -1, "a\000", 2, 0, 2, 70, "(16) 10 43 38 48 48 48 48 38 48 48 32 33 14 15 5 48", "a S1 NUL (Start 5, Alphanumeric S2)" }, + /* 10*/ { UNICODE_MODE, -1, "ab", -1, 0, 2, 70, "(16) 10 44 11 48 48 48 48 12 48 48 27 39 42 0 5 13", "a S2 b (Start 5, Alphanumeric S2)" }, + /* 11*/ { UNICODE_MODE, -1, "\000A\000a\000", 5, 0, 2, 70, "(16) 38 10 43 38 44 10 43 30 38 48 25 23 38 32 4 12", "NUL A S1 NUL S2 a S1 (C18 30) NUL (Start 4, Alphanumeric S1)" }, + /* 12*/ { UNICODE_MODE, -1, "1234\037aA12345A", -1, 0, 3, 70, "(24) 1 2 3 4 43 5 44 4 10 10 48 5 17 9 48 0 10 48 19 2 13 32 7 33", "1 2 3 4 S1 US S2 (C18 4) a A NS 12345 NS (C28 0) A (Start 0, Alpha)" }, + /* 13*/ { GS1_MODE, -1, "[90]12345[91]AB12345", -1, 0, 4, 70, "(32) 45 48 47 15 4 7 9 28 48 45 9 1 10 11 48 25 5 17 9 48 48 48 48 27 48 48 37 39 26 8 14", "FNC1 NS 9012345 (C18 28) NS FNC1 9 1 A B NS (C28 25) 12345 Pad (4) (C38 27) (Start 0, Alpha)" }, + /* 14*/ { GS1_MODE | GS1PARENS_MODE, -1, "(90)12345(91)AB12345", -1, 0, 4, 70, "(32) 45 48 47 15 4 7 9 28 48 45 9 1 10 11 48 25 5 17 9 48 48 48 48 27 48 48 37 39 26 8 14", "FNC1 NS 9012345 (C18 28) NS FNC1 9 1 A B NS (C28 25) 12345 Pad (4) (C38 27) (Start 0, Alpha)" }, + /* 15*/ { UNICODE_MODE, -1, "1234567890123456789012345678901234567890", -1, 0, 5, 70, "(40) 5 17 9 29 22 18 5 7 17 9 29 22 18 5 17 19 9 29 22 18 5 17 9 11 29 22 18 48 48 48 48 16", "" }, + /* 16*/ { UNICODE_MODE, 1, "1234567890123456789012345678901234567890", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 424: Minimum number of rows out of range (2 to 8)", "" }, + /* 17*/ { UNICODE_MODE, 9, "1234567890123456789012345678901234567890", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 424: Minimum number of rows out of range (2 to 8)", "" }, + /* 18*/ { UNICODE_MODE, 2, "1234567890123456789012345678901234567890", -1, 0, 5, 70, "(40) 5 17 9 29 22 18 5 7 17 9 29 22 18 5 17 19 9 29 22 18 5 17 9 11 29 22 18 48 48 48 48 16", "" }, + /* 19*/ { UNICODE_MODE, 3, "1234567890123456789012345678901234567890", -1, 0, 5, 70, "(40) 5 17 9 29 22 18 5 7 17 9 29 22 18 5 17 19 9 29 22 18 5 17 9 11 29 22 18 48 48 48 48 16", "" }, + /* 20*/ { UNICODE_MODE, 4, "1234567890123456789012345678901234567890", -1, 0, 5, 70, "(40) 5 17 9 29 22 18 5 7 17 9 29 22 18 5 17 19 9 29 22 18 5 17 9 11 29 22 18 48 48 48 48 16", "" }, + /* 21*/ { UNICODE_MODE, 5, "1234567890123456789012345678901234567890", -1, 0, 5, 70, "(40) 5 17 9 29 22 18 5 7 17 9 29 22 18 5 17 19 9 29 22 18 5 17 9 11 29 22 18 48 48 48 48 16", "" }, + /* 22*/ { UNICODE_MODE, 6, "1234567890123456789012345678901234567890", -1, 0, 6, 70, "(48) 5 17 9 29 22 18 5 7 17 9 29 22 18 5 17 19 9 29 22 18 5 17 9 11 29 22 18 48 48 48 48 16", "" }, + /* 23*/ { UNICODE_MODE, 7, "1234567890123456789012345678901234567890", -1, 0, 7, 70, "(56) 5 17 9 29 22 18 5 7 17 9 29 22 18 5 17 19 9 29 22 18 5 17 9 11 29 22 18 48 48 48 48 16", "" }, + /* 24*/ { UNICODE_MODE, 8, "1234567890123456789012345678901234567890", -1, 0, 8, 70, "(64) 5 17 9 29 22 18 5 7 17 9 29 22 18 5 17 19 9 29 22 18 5 17 9 11 29 22 18 48 48 48 48 16", "" }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -129,14 +140,15 @@ static void test_input(int index, int generate, int debug) { symbol->debug = ZINT_DEBUG_TEST; // Needed to get codeword dump in errtxt - length = testUtilSetSymbol(symbol, BARCODE_CODE49, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, data[i].length, debug); + length = testUtilSetSymbol(symbol, BARCODE_CODE49, data[i].input_mode, -1 /*eci*/, data[i].option_1, -1, -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, \"%s\", %d, %s, %d, %d, \"%s\", \"%s\" },\n", - i, testUtilInputModeName(data[i].input_mode), testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), data[i].length, + printf(" /*%3d*/ { %s, %d, \"%s\", %d, %s, %d, %d, \"%s\", \"%s\" },\n", + i, testUtilInputModeName(data[i].input_mode), data[i].option_1, + 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) { @@ -156,6 +168,7 @@ static void test_encode(int index, int generate, int debug) { struct item { int input_mode; + int option_1; char *data; int ret; @@ -165,17 +178,32 @@ static void test_encode(int index, int generate, int debug) { char *expected; }; struct item data[] = { - /* 0*/ { UNICODE_MODE, "MULTIPLE ROWS IN CODE 49", 0, 5, 70, "ANSI/AIM BC6-2000 Figure 1", + /* 0*/ { UNICODE_MODE, -1, "MULTIPLE ROWS IN CODE 49", 0, 5, 70, "ANSI/AIM BC6-2000 Figure 1", "1011111011001011101011100110000110111101011011111010111101000100001111" "1010100001000010001001111000101110100110001111010010001011100011001111" "1011001100000101101101110111000010110010110000111011101011110001101111" "1010011001100100001111010010001100101011101111110011010001001111101111" "1011001111001011101000000101001110111110111010001011010001101111101111" }, - /* 1*/ { UNICODE_MODE, "EXAMPLE 2", 0, 2, 70, "ANSI/AIM BC6-2000 Figure 3", + /* 1*/ { UNICODE_MODE, -1, "EXAMPLE 2", 0, 2, 70, "ANSI/AIM BC6-2000 Figure 3", "1011000111011100101111001001000110110011110010100010001111000100101111" "1011000100110010001100010110010000100001101001111010000001001011101111" }, + /* 2*/ { UNICODE_MODE, 3, "EXAMPLE 2", 0, 3, 70, "Min 3 rows", + "1011000111011100101111001001000110110011110010100010001111000100101111" + "1011000100110010001010111011111100110011110010111010111011001111101111" + "1011001111001011101110011111001010100001000010001010111001111001101111" + }, + /* 3*/ { UNICODE_MODE, 8, "EXAMPLE 2", 0, 8, 70, "Min 8 rows", + "1011000111011100101111001001000110110011110010100010001111000100101111" + "1011000100110010001010111011111100110011110010111010111011001111101111" + "1010101110111111001010111011111100110011110010111011001110110001001111" + "1011001111001011101100111100101110101011101111110010111001000001101111" + "1010101110111111001100111100101110101011101111110011001110110001001111" + "1011001111001011101010111011111100101011101111110011001110110001001111" + "1010101110111111001010111011111100101011101111110010111001000001101111" + "1011110110100100001010000100010000111010010011111011001000111011001111" + }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -196,14 +224,15 @@ static void test_encode(int index, int generate, int debug) { symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); - length = testUtilSetSymbol(symbol, BARCODE_CODE49, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug); + length = testUtilSetSymbol(symbol, BARCODE_CODE49, data[i].input_mode, -1 /*eci*/, data[i].option_1, -1, -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, \"%s\", %s, %d, %d, \"%s\",\n", - i, testUtilInputModeName(data[i].input_mode), testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), + printf(" /*%3d*/ { %s, %d, \"%s\", %s, %d, %d, \"%s\",\n", + i, testUtilInputModeName(data[i].input_mode), data[i].option_1, + testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].comment); testUtilModulesPrint(symbol, " ", "\n"); printf(" },\n"); @@ -217,8 +246,8 @@ static void test_encode(int index, int generate, int debug) { 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, -1, -1, -1, debug)) { - ret = testUtilBwipp(i, symbol, -1, -1, -1, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf)); + if (do_bwipp && testUtilCanBwipp(i, symbol, data[i].option_1, -1, -1, debug)) { + ret = testUtilBwipp(i, symbol, data[i].option_1, -1, -1, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf)); 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); diff --git a/backend/tests/test_composite.c b/backend/tests/test_composite.c index 995d7552..e4a06138 100644 --- a/backend/tests/test_composite.c +++ b/backend/tests/test_composite.c @@ -3289,117 +3289,129 @@ static void test_input(int index, int debug) { int symbology; int input_mode; int option_1; + int option_2; + int option_3; char *data; char *composite; int ret; + int expected_rows; + int expected_width; char *expected_errtxt; }; // s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<")) struct item data[] = { - /* 0*/ { BARCODE_EANX_CC, -1, -1, "1234567", "[20]12", 0, "" }, // EAN-8 - /* 1*/ { BARCODE_EANX_CC, -1, -1, "123456A", "[20]12", ZINT_ERROR_INVALID_DATA, "Error 284: Invalid character in data (digits and \"+\" only) in linear component" }, // EAN-8 - /* 2*/ { BARCODE_EANX_CC, GS1NOCHECK_MODE, -1, "123456A", "[20]12", ZINT_ERROR_INVALID_DATA, "Error 284: Invalid character in data (digits and \"+\" only) in linear component" }, // Linear component still checked - /* 3*/ { BARCODE_EANX_CC, -1, -1, "1234567", "[20]1A", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (20) position 2: Non-numeric character 'A' in 2D component" }, - /* 4*/ { BARCODE_EANX_CC, GS1NOCHECK_MODE, -1, "1234567", "[20]1A", 0, "" }, - /* 5*/ { BARCODE_EANX_CC, -1, -1, "1234567", "[02]12345678901234", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (02) position 14: Bad checksum '4', expected '1' in 2D component" }, - /* 6*/ { BARCODE_EANX_CC, GS1NOCHECK_MODE, -1, "1234567", "[02]12345678901234", 0, "" }, - /* 7*/ { BARCODE_EANX_CC, -1, -1, "12345671", "[20]12", 0, "" }, // EAN-13 for EANX_CC as length 8 only EAN-8 for EANX_CHK - /* 8*/ { BARCODE_EANX_CC, -1, -1, "123456789012", "[20]12", 0, "" }, // EAN-13 - /* 9*/ { BARCODE_EANX_CC, -1, -1, "1234567890128", "[20]12", 0, "" }, // EAN-13 - /* 10*/ { BARCODE_EANX_CC, -1, -1, "1234567890123", "[20]12", ZINT_ERROR_INVALID_CHECK, "Error 275: Invalid check digit '3', expecting '8' in linear component" }, - /* 11*/ { BARCODE_EANX_CC, GS1NOCHECK_MODE, -1, "1234567890123", "[20]12", ZINT_ERROR_INVALID_CHECK, "Error 275: Invalid check digit '3', expecting '8' in linear component" }, // Linear component still checked - /* 12*/ { BARCODE_EANX_CC, -1, -1, "12345678901234", "[20]12", ZINT_ERROR_TOO_LONG, "Error 448: Input too long (13 character maximum) in linear component" }, - /* 13*/ { BARCODE_EANX_CC, GS1NOCHECK_MODE, -1, "12345678901234", "[20]12", ZINT_ERROR_TOO_LONG, "Error 448: Input too long (13 character maximum) in linear component" }, - /* 14*/ { BARCODE_EANX_CC, -1, -1, "123456789012A", "[20]12", ZINT_ERROR_INVALID_DATA, "Error 284: Invalid character in data (digits and \"+\" only) in linear component" }, - /* 15*/ { BARCODE_EANX_CC, GS1NOCHECK_MODE, -1, "123456789012A", "[20]12", ZINT_ERROR_INVALID_DATA, "Error 284: Invalid character in data (digits and \"+\" only) in linear component" }, - /* 16*/ { BARCODE_EANX_CC, -1, -1, "1234567890128", "[20]1A", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (20) position 2: Non-numeric character 'A' in 2D component" }, // AI (20) should be 2 nos. - /* 17*/ { BARCODE_EANX_CC, GS1NOCHECK_MODE, -1, "1234567890128", "[20]1A", 0, "" }, - /* 18*/ { BARCODE_EANX_CC, -1, -1, "1234567890128", "[02]12345678901234", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (02) position 14: Bad checksum '4', expected '1' in 2D component" }, - /* 19*/ { BARCODE_EANX_CC, GS1NOCHECK_MODE, -1, "1234567890128", "[02]12345678901234", 0, "" }, - /* 20*/ { BARCODE_EANX_CC, -1, -1, "1234567890128", "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890123456789012345678901234567", 0, "" }, // Max CC-B for EAN-13 - /* 21*/ { BARCODE_EANX_CC, -1, -1, "1234567890128", "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]1234567890123456789012345678901234567890123456789012345678", ZINT_ERROR_TOO_LONG, "Error 444: Input too long for selected 2D component" }, - /* 22*/ { BARCODE_EANX_CC, -1, 3, "1234567890128", "[20]12", ZINT_ERROR_INVALID_OPTION, "Error 447: Invalid mode (CC-C only valid with GS1-128 linear component)" }, - /* 23*/ { BARCODE_EANX_CC, -1, -1, "123456789012345678901", "[20]12", ZINT_ERROR_TOO_LONG, "Error 449: Input wrong length in linear component" }, - /* 24*/ { BARCODE_DBAR_OMN_CC, -1, -1, "1234567890123", "[20]12", 0, "" }, - /* 25*/ { BARCODE_DBAR_OMN_CC, -1, -1, "12345678901231", "[20]12", 0, "" }, - /* 26*/ { BARCODE_DBAR_OMN_CC, -1, -1, "12345678901232", "[20]12", ZINT_ERROR_INVALID_CHECK, "Error 388: Invalid check digit '2', expecting '1' in linear component" }, - /* 27*/ { BARCODE_DBAR_OMN_CC, GS1NOCHECK_MODE, -1, "12345678901232", "[20]12", ZINT_ERROR_INVALID_CHECK, "Error 388: Invalid check digit '2', expecting '1' in linear component" }, // Linear component still checked - /* 28*/ { BARCODE_DBAR_OMN_CC, -1, -1, "123456789012312", "[20]12", ZINT_ERROR_TOO_LONG, "Error 380: Input too long (14 character maximum) in linear component" }, - /* 29*/ { BARCODE_DBAR_OMN_CC, GS1NOCHECK_MODE, -1, "123456789012312", "[20]12", ZINT_ERROR_TOO_LONG, "Error 380: Input too long (14 character maximum) in linear component" }, - /* 30*/ { BARCODE_DBAR_OMN_CC, -1, -1, "1234567890123A", "[20]12", ZINT_ERROR_INVALID_DATA, "Error 381: Invalid character in data (digits only) in linear component" }, - /* 31*/ { BARCODE_DBAR_OMN_CC, GS1NOCHECK_MODE, -1, "1234567890123A", "[20]12", ZINT_ERROR_INVALID_DATA, "Error 381: Invalid character in data (digits only) in linear component" }, - /* 32*/ { BARCODE_DBAR_OMN_CC, -1, -1, "12345678901231", "[20]1A", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (20) position 2: Non-numeric character 'A' in 2D component" }, // AI (20) should be 2 nos. - /* 33*/ { BARCODE_DBAR_OMN_CC, GS1NOCHECK_MODE, -1, "12345678901231", "[20]1A", 0, "" }, - /* 34*/ { BARCODE_DBAR_OMN_CC, -1, -1, "12345678901231", "[02]12345678901234", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (02) position 14: Bad checksum '4', expected '1' in 2D component" }, - /* 35*/ { BARCODE_DBAR_OMN_CC, GS1NOCHECK_MODE, -1, "12345678901231", "[02]12345678901234", 0, "" }, - /* 36*/ { BARCODE_DBAR_LTD_CC, -1, -1, "1234567890123", "[20]12", 0, "" }, - /* 37*/ { BARCODE_DBAR_LTD_CC, -1, -1, "12345678901231", "[20]12", 0, "" }, - /* 38*/ { BARCODE_DBAR_LTD_CC, -1, -1, "12345678901232", "[20]12", ZINT_ERROR_INVALID_CHECK, "Error 389: Invalid check digit '2', expecting '1' in linear component" }, - /* 39*/ { BARCODE_DBAR_LTD_CC, GS1NOCHECK_MODE, -1, "12345678901232", "[20]12", ZINT_ERROR_INVALID_CHECK, "Error 389: Invalid check digit '2', expecting '1' in linear component" }, // Linear component still checked - /* 40*/ { BARCODE_DBAR_LTD_CC, -1, -1, "123456789012345", "[20]12", ZINT_ERROR_TOO_LONG, "Error 382: Input too long (14 character maximum) in linear component" }, - /* 41*/ { BARCODE_DBAR_LTD_CC, GS1NOCHECK_MODE, -1, "123456789012345", "[20]12", ZINT_ERROR_TOO_LONG, "Error 382: Input too long (14 character maximum) in linear component" }, - /* 42*/ { BARCODE_DBAR_LTD_CC, -1, -1, "A1234567890123", "[20]12", ZINT_ERROR_INVALID_DATA, "Error 383: Invalid character in data (digits only) in linear component" }, - /* 43*/ { BARCODE_DBAR_LTD_CC, GS1NOCHECK_MODE, -1, "A1234567890123", "[20]12", ZINT_ERROR_INVALID_DATA, "Error 383: Invalid character in data (digits only) in linear component" }, - /* 44*/ { BARCODE_DBAR_LTD_CC, -1, -1, "12345678901231", "[20]1A", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (20) position 2: Non-numeric character 'A' in 2D component" }, // AI (20) should be 2 nos. - /* 45*/ { BARCODE_DBAR_LTD_CC, GS1NOCHECK_MODE, -1, "12345678901231", "[20]1A", 0, "" }, - /* 46*/ { BARCODE_DBAR_LTD_CC, -1, -1, "12345678901231", "[02]12345678901234", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (02) position 14: Bad checksum '4', expected '1' in 2D component" }, - /* 47*/ { BARCODE_DBAR_LTD_CC, GS1NOCHECK_MODE, -1, "12345678901231", "[02]12345678901234", 0, "" }, - /* 48*/ { BARCODE_UPCA_CC, -1, -1, "12345678901", "[20]12", 0, "" }, - /* 49*/ { BARCODE_UPCA_CC, -1, -1, "123456789012", "[20]12", 0, "" }, - /* 50*/ { BARCODE_UPCA_CC, -1, -1, "123456789013", "[20]12", ZINT_ERROR_INVALID_CHECK, "Error 270: Invalid check digit '3', expecting '2' in linear component" }, - /* 51*/ { BARCODE_UPCA_CC, GS1NOCHECK_MODE, -1, "123456789013", "[20]12", ZINT_ERROR_INVALID_CHECK, "Error 270: Invalid check digit '3', expecting '2' in linear component" }, // Linear component still checked - /* 52*/ { BARCODE_UPCA_CC, -1, -1, "1234567890123", "[20]12", ZINT_ERROR_TOO_LONG, "Error 289: Input wrong length (12 character maximum) in linear component" }, - /* 53*/ { BARCODE_UPCA_CC, GS1NOCHECK_MODE, -1, "1234567890123", "[20]12", ZINT_ERROR_TOO_LONG, "Error 289: Input wrong length (12 character maximum) in linear component" }, - /* 54*/ { BARCODE_UPCA_CC, -1, -1, "12345678901A", "[20]12", ZINT_ERROR_INVALID_DATA, "Error 284: Invalid character in data (digits and \"+\" only) in linear component" }, - /* 55*/ { BARCODE_UPCA_CC, GS1NOCHECK_MODE, -1, "12345678901A", "[20]12", ZINT_ERROR_INVALID_DATA, "Error 284: Invalid character in data (digits and \"+\" only) in linear component" }, - /* 56*/ { BARCODE_UPCA_CC, -1, -1, "123456789012", "[20]1A", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (20) position 2: Non-numeric character 'A' in 2D component" }, // AI (20) should be 2 nos. - /* 57*/ { BARCODE_UPCA_CC, GS1NOCHECK_MODE, -1, "123456789012", "[20]1A", 0, "" }, - /* 58*/ { BARCODE_UPCA_CC, -1, -1, "123456789012", "[02]12345678901234", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (02) position 14: Bad checksum '4', expected '1' in 2D component" }, - /* 59*/ { BARCODE_UPCA_CC, GS1NOCHECK_MODE, -1, "123456789012", "[02]12345678901234", 0, "" }, - /* 60*/ { BARCODE_UPCE_CC, -1, -1, "123456", "[20]12", 0, "" }, - /* 61*/ { BARCODE_UPCE_CC, -1, -1, "1234567", "[20]12", 0, "" }, - /* 62*/ { BARCODE_UPCE_CC, -1, -1, "12345670", "[20]12", 0, "" }, // Check digit can now be given for UPCE_CC, like UPCA_CC - /* 63*/ { BARCODE_UPCE_CC, -1, -1, "12345671", "[20]12", ZINT_ERROR_INVALID_CHECK, "Error 274: Invalid check digit '1', expecting '0' in linear component" }, - /* 64*/ { BARCODE_UPCE_CC, GS1NOCHECK_MODE, -1, "12345671", "[20]12", ZINT_ERROR_INVALID_CHECK, "Error 274: Invalid check digit '1', expecting '0' in linear component" }, // Linear component still checked - /* 65*/ { BARCODE_UPCE_CC, -1, -1, "123456712", "[20]12", ZINT_ERROR_TOO_LONG, "Error 291: Input wrong length (8 character maximum) in linear component" }, - /* 66*/ { BARCODE_UPCE_CC, GS1NOCHECK_MODE, -1, "123456712", "[20]12", ZINT_ERROR_TOO_LONG, "Error 291: Input wrong length (8 character maximum) in linear component" }, - /* 67*/ { BARCODE_UPCE_CC, -1, -1, "1234567A", "[20]12", ZINT_ERROR_INVALID_DATA, "Error 284: Invalid character in data (digits and \"+\" only) in linear component" }, - /* 68*/ { BARCODE_UPCE_CC, GS1NOCHECK_MODE, -1, "1234567A", "[20]12", ZINT_ERROR_INVALID_DATA, "Error 284: Invalid character in data (digits and \"+\" only) in linear component" }, - /* 69*/ { BARCODE_UPCE_CC, -1, -1, "1234567", "[20]1A", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (20) position 2: Non-numeric character 'A' in 2D component" }, // AI (20) should be 2 nos. - /* 70*/ { BARCODE_UPCE_CC, GS1NOCHECK_MODE, -1, "1234567", "[20]1A", 0, "" }, - /* 71*/ { BARCODE_UPCE_CC, -1, -1, "1234567", "[02]12345678901234", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (02) position 14: Bad checksum '4', expected '1' in 2D component" }, - /* 72*/ { BARCODE_UPCE_CC, GS1NOCHECK_MODE, -1, "1234567", "[02]12345678901234", 0, "" }, - /* 73*/ { BARCODE_DBAR_STK_CC, -1, -1, "1234567890123", "[20]12", 0, "" }, - /* 74*/ { BARCODE_DBAR_STK_CC, -1, -1, "12345678901231", "[20]12", 0, "" }, - /* 75*/ { BARCODE_DBAR_STK_CC, -1, -1, "12345678901232", "[20]12", ZINT_ERROR_INVALID_CHECK, "Error 388: Invalid check digit '2', expecting '1' in linear component" }, - /* 76*/ { BARCODE_DBAR_STK_CC, GS1NOCHECK_MODE, -1, "12345678901232", "[20]12", ZINT_ERROR_INVALID_CHECK, "Error 388: Invalid check digit '2', expecting '1' in linear component" }, // Linear component still checked - /* 77*/ { BARCODE_DBAR_STK_CC, -1, -1, "123456789012323", "[20]12", ZINT_ERROR_TOO_LONG, "Error 380: Input too long (14 character maximum) in linear component" }, - /* 78*/ { BARCODE_DBAR_STK_CC, GS1NOCHECK_MODE, -1, "123456789012323", "[20]12", ZINT_ERROR_TOO_LONG, "Error 380: Input too long (14 character maximum) in linear component" }, - /* 79*/ { BARCODE_DBAR_STK_CC, -1, -1, "1234567890123A", "[20]12", ZINT_ERROR_INVALID_DATA, "Error 381: Invalid character in data (digits only) in linear component" }, - /* 80*/ { BARCODE_DBAR_STK_CC, GS1NOCHECK_MODE, -1, "1234567890123A", "[20]12", ZINT_ERROR_INVALID_DATA, "Error 381: Invalid character in data (digits only) in linear component" }, - /* 81*/ { BARCODE_DBAR_STK_CC, -1, -1, "12345678901231", "[20]1A", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (20) position 2: Non-numeric character 'A' in 2D component" }, // AI (20) should be 2 nos. - /* 82*/ { BARCODE_DBAR_STK_CC, GS1NOCHECK_MODE, -1, "12345678901231", "[20]1A", 0, "" }, - /* 83*/ { BARCODE_DBAR_STK_CC, -1, -1, "12345678901231", "[02]12345678901234", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (02) position 14: Bad checksum '4', expected '1' in 2D component" }, - /* 84*/ { BARCODE_DBAR_STK_CC, GS1NOCHECK_MODE, -1, "12345678901231", "[02]12345678901234", 0, "" }, - /* 85*/ { BARCODE_DBAR_OMNSTK_CC, -1, -1, "1234567890123", "[20]12", 0, "" }, - /* 86*/ { BARCODE_DBAR_OMNSTK_CC, -1, -1, "12345678901231", "[20]12", 0, "" }, - /* 87*/ { BARCODE_DBAR_OMNSTK_CC, -1, -1, "12345678901232", "[20]12", ZINT_ERROR_INVALID_CHECK, "Error 388: Invalid check digit '2', expecting '1' in linear component" }, - /* 88*/ { BARCODE_DBAR_OMNSTK_CC, GS1NOCHECK_MODE, -1, "12345678901232", "[20]12", ZINT_ERROR_INVALID_CHECK, "Error 388: Invalid check digit '2', expecting '1' in linear component" }, // Linear component still checked - /* 89*/ { BARCODE_DBAR_OMNSTK_CC, -1, -1, "123456789012312", "[20]12", ZINT_ERROR_TOO_LONG, "Error 380: Input too long (14 character maximum) in linear component" }, - /* 90*/ { BARCODE_DBAR_OMNSTK_CC, GS1NOCHECK_MODE, -1, "123456789012312", "[20]12", ZINT_ERROR_TOO_LONG, "Error 380: Input too long (14 character maximum) in linear component" }, - /* 91*/ { BARCODE_DBAR_OMNSTK_CC, -1, -1, "1234567890123A", "[20]12", ZINT_ERROR_INVALID_DATA, "Error 381: Invalid character in data (digits only) in linear component" }, - /* 92*/ { BARCODE_DBAR_OMNSTK_CC, GS1NOCHECK_MODE, -1, "1234567890123A", "[20]12", ZINT_ERROR_INVALID_DATA, "Error 381: Invalid character in data (digits only) in linear component" }, - /* 93*/ { BARCODE_DBAR_OMNSTK_CC, -1, -1, "12345678901231", "[20]1A", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (20) position 2: Non-numeric character 'A' in 2D component" }, // AI (20) should be 2 nos. - /* 94*/ { BARCODE_DBAR_OMNSTK_CC, GS1NOCHECK_MODE, -1, "12345678901231", "[20]1A", 0, "" }, - /* 95*/ { BARCODE_DBAR_OMNSTK_CC, -1, -1, "12345678901231", "[02]12345678901234", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (02) position 14: Bad checksum '4', expected '1' in 2D component" }, - /* 96*/ { BARCODE_DBAR_OMNSTK_CC, GS1NOCHECK_MODE, -1, "12345678901231", "[02]12345678901234", 0, "" }, - /* 97*/ { BARCODE_GS1_128_CC, -1, -1, "", "[20]12", ZINT_ERROR_INVALID_OPTION, "Error 445: No primary (linear) message in 2D composite" }, - /* 98*/ { BARCODE_GS1_128_CC, -1, -1, "[01]12345678901231", "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[95]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[96]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[97]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[98]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[99]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "" }, // Tries CC-A then CC-B then CC-C - ensure errtxt empty - /* 99*/ { BARCODE_GS1_128_CC, -1, -1, "[01]12345678901231[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890123456789012345678901234", "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[95]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[96]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[97]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[98]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[99]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[95]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[96]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[97]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[98]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[99]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890123456789012345678901234567890123", 0, "" }, // Max linear and CC-C input - /*100*/ { BARCODE_GS1_128_CC, -1, -1, "[01]12345678901231[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890123456789012345678901234", "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[92]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[94]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[95]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[96]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[97]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[98]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[99]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[92]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[94]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[95]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[96]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL", ZINT_ERROR_TOO_LONG, "Error 442: Input too long for selected 2D component" }, // Max linear and oversized CC-C input - /*101*/ { BARCODE_GS1_128_CC, -1, -1, "[01]12345678901231", "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[92]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[94]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[95]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[96]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[97]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[98]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[99]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[92]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[94]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[95]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[96]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[92]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[92]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHI" "JKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLM", ZINT_ERROR_TOO_LONG, "Error 446: 2D component input data too long" }, // Reduced length 2291 - /*102*/ { BARCODE_GS1_128_CC, -1, -1, "[01]12345678901231", "[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012" "345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[11]121212[20]12", 0, "" }, // Reduced length 2372 digits (no FNC1s) with not recommended ECC 4 > 2361 digit limit given in ISO/IEC 24723:2010 4.1 (d)(2)(iii) + /* 0*/ { BARCODE_EANX_CC, -1, -1, -1, -1, "1234567", "[20]12", 0, 8, 72, "" }, // EAN-8 + /* 1*/ { BARCODE_EANX_CC, -1, -1, -1, -1, "123456A", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 284: Invalid character in data (digits and \"+\" only) in linear component" }, // EAN-8 + /* 2*/ { BARCODE_EANX_CC, GS1NOCHECK_MODE, -1, -1, -1, "123456A", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 284: Invalid character in data (digits and \"+\" only) in linear component" }, // Linear component still checked + /* 3*/ { BARCODE_EANX_CC, -1, -1, -1, -1, "1234567", "[20]1A", ZINT_WARN_NONCOMPLIANT, 8, 72, "Warning 261: AI (20) position 2: Non-numeric character 'A' in 2D component" }, + /* 4*/ { BARCODE_EANX_CC, GS1NOCHECK_MODE, -1, -1, -1, "1234567", "[20]1A", 0, 8, 72, "" }, + /* 5*/ { BARCODE_EANX_CC, -1, -1, -1, -1, "1234567", "[02]12345678901234", ZINT_WARN_NONCOMPLIANT, 8, 72, "Warning 261: AI (02) position 14: Bad checksum '4', expected '1' in 2D component" }, + /* 6*/ { BARCODE_EANX_CC, GS1NOCHECK_MODE, -1, -1, -1, "1234567", "[02]12345678901234", 0, 8, 72, "" }, + /* 7*/ { BARCODE_EANX_CC, -1, -1, -1, -1, "12345671", "[20]12", 0, 7, 99, "" }, // EAN-13 for EANX_CC as length 8 only EAN-8 for EANX_CHK + /* 8*/ { BARCODE_EANX_CC, -1, -1, -1, -1, "123456789012", "[20]12", 0, 7, 99, "" }, // EAN-13 + /* 9*/ { BARCODE_EANX_CC, -1, -1, -1, -1, "1234567890128", "[20]12", 0, 7, 99, "" }, // EAN-13 + /* 10*/ { BARCODE_EANX_CC, -1, -1, -1, -1, "1234567890123", "[20]12", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 275: Invalid check digit '3', expecting '8' in linear component" }, + /* 11*/ { BARCODE_EANX_CC, GS1NOCHECK_MODE, -1, -1, -1, "1234567890123", "[20]12", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 275: Invalid check digit '3', expecting '8' in linear component" }, // Linear component still checked + /* 12*/ { BARCODE_EANX_CC, -1, -1, -1, -1, "12345678901234", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 448: Input too long (13 character maximum) in linear component" }, + /* 13*/ { BARCODE_EANX_CC, GS1NOCHECK_MODE, -1, -1, -1, "12345678901234", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 448: Input too long (13 character maximum) in linear component" }, + /* 14*/ { BARCODE_EANX_CC, -1, -1, -1, -1, "123456789012A", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 284: Invalid character in data (digits and \"+\" only) in linear component" }, + /* 15*/ { BARCODE_EANX_CC, GS1NOCHECK_MODE, -1, -1, -1, "123456789012A", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 284: Invalid character in data (digits and \"+\" only) in linear component" }, + /* 16*/ { BARCODE_EANX_CC, -1, -1, -1, -1, "1234567890128", "[20]1A", ZINT_WARN_NONCOMPLIANT, 7, 99, "Warning 261: AI (20) position 2: Non-numeric character 'A' in 2D component" }, // AI (20) should be 2 nos. + /* 17*/ { BARCODE_EANX_CC, GS1NOCHECK_MODE, -1, -1, -1, "1234567890128", "[20]1A", 0, 7, 99, "" }, + /* 18*/ { BARCODE_EANX_CC, -1, -1, -1, -1, "1234567890128", "[02]12345678901234", ZINT_WARN_NONCOMPLIANT, 7, 99, "Warning 261: AI (02) position 14: Bad checksum '4', expected '1' in 2D component" }, + /* 19*/ { BARCODE_EANX_CC, GS1NOCHECK_MODE, -1, -1, -1, "1234567890128", "[02]12345678901234", 0, 7, 99, "" }, + /* 20*/ { BARCODE_EANX_CC, -1, -1, -1, -1, "1234567890128", "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890123456789012345678901234567", 0, 48, 99, "" }, // Max CC-B for EAN-13 + /* 21*/ { BARCODE_EANX_CC, -1, -1, -1, -1, "1234567890128", "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]1234567890123456789012345678901234567890123456789012345678", ZINT_ERROR_TOO_LONG, -1, -1, "Error 444: Input too long for selected 2D component" }, + /* 22*/ { BARCODE_EANX_CC, -1, 3, -1, -1, "1234567890128", "[20]12", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 447: Invalid mode (CC-C only valid with GS1-128 linear component)" }, + /* 23*/ { BARCODE_EANX_CC, -1, -1, -1, -1, "123456789012345678901", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 449: Input wrong length in linear component" }, + /* 24*/ { BARCODE_DBAR_OMN_CC, -1, -1, -1, -1, "1234567890123", "[20]12", 0, 5, 100, "" }, + /* 25*/ { BARCODE_DBAR_OMN_CC, -1, -1, -1, -1, "12345678901231", "[20]12", 0, 5, 100, "" }, + /* 26*/ { BARCODE_DBAR_OMN_CC, -1, -1, -1, -1, "12345678901232", "[20]12", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '2', expecting '1' in linear component" }, + /* 27*/ { BARCODE_DBAR_OMN_CC, GS1NOCHECK_MODE, -1, -1, -1, "12345678901232", "[20]12", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '2', expecting '1' in linear component" }, // Linear component still checked + /* 28*/ { BARCODE_DBAR_OMN_CC, -1, -1, -1, -1, "123456789012312", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input too long (14 character maximum) in linear component" }, + /* 29*/ { BARCODE_DBAR_OMN_CC, GS1NOCHECK_MODE, -1, -1, -1, "123456789012312", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input too long (14 character maximum) in linear component" }, + /* 30*/ { BARCODE_DBAR_OMN_CC, -1, -1, -1, -1, "1234567890123A", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character in data (digits only) in linear component" }, + /* 31*/ { BARCODE_DBAR_OMN_CC, GS1NOCHECK_MODE, -1, -1, -1, "1234567890123A", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character in data (digits only) in linear component" }, + /* 32*/ { BARCODE_DBAR_OMN_CC, -1, -1, -1, -1, "12345678901231", "[20]1A", ZINT_WARN_NONCOMPLIANT, 5, 100, "Warning 261: AI (20) position 2: Non-numeric character 'A' in 2D component" }, // AI (20) should be 2 nos. + /* 33*/ { BARCODE_DBAR_OMN_CC, GS1NOCHECK_MODE, -1, -1, -1, "12345678901231", "[20]1A", 0, 5, 100, "" }, + /* 34*/ { BARCODE_DBAR_OMN_CC, -1, -1, -1, -1, "12345678901231", "[02]12345678901234", ZINT_WARN_NONCOMPLIANT, 5, 100, "Warning 261: AI (02) position 14: Bad checksum '4', expected '1' in 2D component" }, + /* 35*/ { BARCODE_DBAR_OMN_CC, GS1NOCHECK_MODE, -1, -1, -1, "12345678901231", "[02]12345678901234", 0, 5, 100, "" }, + /* 36*/ { BARCODE_DBAR_LTD_CC, -1, -1, -1, -1, "1234567890123", "[20]12", 0, 6, 79, "" }, + /* 37*/ { BARCODE_DBAR_LTD_CC, -1, -1, -1, -1, "12345678901231", "[20]12", 0, 6, 79, "" }, + /* 38*/ { BARCODE_DBAR_LTD_CC, -1, -1, -1, -1, "12345678901232", "[20]12", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 389: Invalid check digit '2', expecting '1' in linear component" }, + /* 39*/ { BARCODE_DBAR_LTD_CC, GS1NOCHECK_MODE, -1, -1, -1, "12345678901232", "[20]12", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 389: Invalid check digit '2', expecting '1' in linear component" }, // Linear component still checked + /* 40*/ { BARCODE_DBAR_LTD_CC, -1, -1, -1, -1, "123456789012345", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 382: Input too long (14 character maximum) in linear component" }, + /* 41*/ { BARCODE_DBAR_LTD_CC, GS1NOCHECK_MODE, -1, -1, -1, "123456789012345", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 382: Input too long (14 character maximum) in linear component" }, + /* 42*/ { BARCODE_DBAR_LTD_CC, -1, -1, -1, -1, "A1234567890123", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 383: Invalid character in data (digits only) in linear component" }, + /* 43*/ { BARCODE_DBAR_LTD_CC, GS1NOCHECK_MODE, -1, -1, -1, "A1234567890123", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 383: Invalid character in data (digits only) in linear component" }, + /* 44*/ { BARCODE_DBAR_LTD_CC, -1, -1, -1, -1, "12345678901231", "[20]1A", ZINT_WARN_NONCOMPLIANT, 6, 79, "Warning 261: AI (20) position 2: Non-numeric character 'A' in 2D component" }, // AI (20) should be 2 nos. + /* 45*/ { BARCODE_DBAR_LTD_CC, GS1NOCHECK_MODE, -1, -1, -1, "12345678901231", "[20]1A", 0, 6, 79, "" }, + /* 46*/ { BARCODE_DBAR_LTD_CC, -1, -1, -1, -1, "12345678901231", "[02]12345678901234", ZINT_WARN_NONCOMPLIANT, 6, 79, "Warning 261: AI (02) position 14: Bad checksum '4', expected '1' in 2D component" }, + /* 47*/ { BARCODE_DBAR_LTD_CC, GS1NOCHECK_MODE, -1, -1, -1, "12345678901231", "[02]12345678901234", 0, 6, 79, "" }, + /* 48*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, "12345678901", "[20]12", 0, 7, 99, "" }, + /* 49*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, "123456789012", "[20]12", 0, 7, 99, "" }, + /* 50*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, "123456789013", "[20]12", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 270: Invalid check digit '3', expecting '2' in linear component" }, + /* 51*/ { BARCODE_UPCA_CC, GS1NOCHECK_MODE, -1, -1, -1, "123456789013", "[20]12", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 270: Invalid check digit '3', expecting '2' in linear component" }, // Linear component still checked + /* 52*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, "1234567890123", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 289: Input wrong length (12 character maximum) in linear component" }, + /* 53*/ { BARCODE_UPCA_CC, GS1NOCHECK_MODE, -1, -1, -1, "1234567890123", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 289: Input wrong length (12 character maximum) in linear component" }, + /* 54*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, "12345678901A", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 284: Invalid character in data (digits and \"+\" only) in linear component" }, + /* 55*/ { BARCODE_UPCA_CC, GS1NOCHECK_MODE, -1, -1, -1, "12345678901A", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 284: Invalid character in data (digits and \"+\" only) in linear component" }, + /* 56*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, "123456789012", "[20]1A", ZINT_WARN_NONCOMPLIANT, 7, 99, "Warning 261: AI (20) position 2: Non-numeric character 'A' in 2D component" }, // AI (20) should be 2 nos. + /* 57*/ { BARCODE_UPCA_CC, GS1NOCHECK_MODE, -1, -1, -1, "123456789012", "[20]1A", 0, 7, 99, "" }, + /* 58*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, "123456789012", "[02]12345678901234", ZINT_WARN_NONCOMPLIANT, 7, 99, "Warning 261: AI (02) position 14: Bad checksum '4', expected '1' in 2D component" }, + /* 59*/ { BARCODE_UPCA_CC, GS1NOCHECK_MODE, -1, -1, -1, "123456789012", "[02]12345678901234", 0, 7, 99, "" }, + /* 60*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, "123456", "[20]12", 0, 9, 55, "" }, + /* 61*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, "1234567", "[20]12", 0, 9, 55, "" }, + /* 62*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, "12345670", "[20]12", 0, 9, 55, "" }, // Check digit can now be given for UPCE_CC, like UPCA_CC + /* 63*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, "12345671", "[20]12", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 274: Invalid check digit '1', expecting '0' in linear component" }, + /* 64*/ { BARCODE_UPCE_CC, GS1NOCHECK_MODE, -1, -1, -1, "12345671", "[20]12", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 274: Invalid check digit '1', expecting '0' in linear component" }, // Linear component still checked + /* 65*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, "123456712", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 291: Input wrong length (8 character maximum) in linear component" }, + /* 66*/ { BARCODE_UPCE_CC, GS1NOCHECK_MODE, -1, -1, -1, "123456712", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 291: Input wrong length (8 character maximum) in linear component" }, + /* 67*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, "1234567A", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 284: Invalid character in data (digits and \"+\" only) in linear component" }, + /* 68*/ { BARCODE_UPCE_CC, GS1NOCHECK_MODE, -1, -1, -1, "1234567A", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 284: Invalid character in data (digits and \"+\" only) in linear component" }, + /* 69*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, "1234567", "[20]1A", ZINT_WARN_NONCOMPLIANT, 9, 55, "Warning 261: AI (20) position 2: Non-numeric character 'A' in 2D component" }, // AI (20) should be 2 nos. + /* 70*/ { BARCODE_UPCE_CC, GS1NOCHECK_MODE, -1, -1, -1, "1234567", "[20]1A", 0, 9, 55, "" }, + /* 71*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, "1234567", "[02]12345678901234", ZINT_WARN_NONCOMPLIANT, 9, 55, "Warning 261: AI (02) position 14: Bad checksum '4', expected '1' in 2D component" }, + /* 72*/ { BARCODE_UPCE_CC, GS1NOCHECK_MODE, -1, -1, -1, "1234567", "[02]12345678901234", 0, 9, 55, "" }, + /* 73*/ { BARCODE_DBAR_STK_CC, -1, -1, -1, -1, "1234567890123", "[20]12", 0, 9, 56, "" }, + /* 74*/ { BARCODE_DBAR_STK_CC, -1, -1, -1, -1, "12345678901231", "[20]12", 0, 9, 56, "" }, + /* 75*/ { BARCODE_DBAR_STK_CC, -1, -1, -1, -1, "12345678901232", "[20]12", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '2', expecting '1' in linear component" }, + /* 76*/ { BARCODE_DBAR_STK_CC, GS1NOCHECK_MODE, -1, -1, -1, "12345678901232", "[20]12", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '2', expecting '1' in linear component" }, // Linear component still checked + /* 77*/ { BARCODE_DBAR_STK_CC, -1, -1, -1, -1, "123456789012323", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input too long (14 character maximum) in linear component" }, + /* 78*/ { BARCODE_DBAR_STK_CC, GS1NOCHECK_MODE, -1, -1, -1, "123456789012323", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input too long (14 character maximum) in linear component" }, + /* 79*/ { BARCODE_DBAR_STK_CC, -1, -1, -1, -1, "1234567890123A", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character in data (digits only) in linear component" }, + /* 80*/ { BARCODE_DBAR_STK_CC, GS1NOCHECK_MODE, -1, -1, -1, "1234567890123A", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character in data (digits only) in linear component" }, + /* 81*/ { BARCODE_DBAR_STK_CC, -1, -1, -1, -1, "12345678901231", "[20]1A", ZINT_WARN_NONCOMPLIANT, 9, 56, "Warning 261: AI (20) position 2: Non-numeric character 'A' in 2D component" }, // AI (20) should be 2 nos. + /* 82*/ { BARCODE_DBAR_STK_CC, GS1NOCHECK_MODE, -1, -1, -1, "12345678901231", "[20]1A", 0, 9, 56, "" }, + /* 83*/ { BARCODE_DBAR_STK_CC, -1, -1, -1, -1, "12345678901231", "[02]12345678901234", ZINT_WARN_NONCOMPLIANT, 9, 56, "Warning 261: AI (02) position 14: Bad checksum '4', expected '1' in 2D component" }, + /* 84*/ { BARCODE_DBAR_STK_CC, GS1NOCHECK_MODE, -1, -1, -1, "12345678901231", "[02]12345678901234", 0, 9, 56, "" }, + /* 85*/ { BARCODE_DBAR_OMNSTK_CC, -1, -1, -1, -1, "1234567890123", "[20]12", 0, 11, 56, "" }, + /* 86*/ { BARCODE_DBAR_OMNSTK_CC, -1, -1, -1, -1, "12345678901231", "[20]12", 0, 11, 56, "" }, + /* 87*/ { BARCODE_DBAR_OMNSTK_CC, -1, -1, -1, -1, "12345678901232", "[20]12", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '2', expecting '1' in linear component" }, + /* 88*/ { BARCODE_DBAR_OMNSTK_CC, GS1NOCHECK_MODE, -1, -1, -1, "12345678901232", "[20]12", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '2', expecting '1' in linear component" }, // Linear component still checked + /* 89*/ { BARCODE_DBAR_OMNSTK_CC, -1, -1, -1, -1, "123456789012312", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input too long (14 character maximum) in linear component" }, + /* 90*/ { BARCODE_DBAR_OMNSTK_CC, GS1NOCHECK_MODE, -1, -1, -1, "123456789012312", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input too long (14 character maximum) in linear component" }, + /* 91*/ { BARCODE_DBAR_OMNSTK_CC, -1, -1, -1, -1, "1234567890123A", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character in data (digits only) in linear component" }, + /* 92*/ { BARCODE_DBAR_OMNSTK_CC, GS1NOCHECK_MODE, -1, -1, -1, "1234567890123A", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character in data (digits only) in linear component" }, + /* 93*/ { BARCODE_DBAR_OMNSTK_CC, -1, -1, -1, -1, "12345678901231", "[20]1A", ZINT_WARN_NONCOMPLIANT, 11, 56, "Warning 261: AI (20) position 2: Non-numeric character 'A' in 2D component" }, // AI (20) should be 2 nos. + /* 94*/ { BARCODE_DBAR_OMNSTK_CC, GS1NOCHECK_MODE, -1, -1, -1, "12345678901231", "[20]1A", 0, 11, 56, "" }, + /* 95*/ { BARCODE_DBAR_OMNSTK_CC, -1, -1, -1, -1, "12345678901231", "[02]12345678901234", ZINT_WARN_NONCOMPLIANT, 11, 56, "Warning 261: AI (02) position 14: Bad checksum '4', expected '1' in 2D component" }, + /* 96*/ { BARCODE_DBAR_OMNSTK_CC, GS1NOCHECK_MODE, -1, -1, -1, "12345678901231", "[02]12345678901234", 0, 11, 56, "" }, + /* 97*/ { BARCODE_GS1_128_CC, -1, -1, -1, -1, "", "[20]12", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 445: No primary (linear) message in 2D composite" }, + /* 98*/ { BARCODE_GS1_128_CC, -1, -1, -1, -1, "[01]12345678901231", "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[95]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[96]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[97]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[98]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[99]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, 31, 273, "" }, // Tries CC-A then CC-B then CC-C - ensure errtxt empty + /* 99*/ { BARCODE_GS1_128_CC, -1, -1, -1, -1, "[01]12345678901231[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890123456789012345678901234", "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[95]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[96]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[97]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[98]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[99]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[95]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[96]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[97]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[98]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[99]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890123456789012345678901234567890123", 0, 29, 702, "" }, // Max linear and CC-C input + /*100*/ { BARCODE_GS1_128_CC, -1, -1, -1, -1,"[01]12345678901231[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890123456789012345678901234", "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[92]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[94]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[95]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[96]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[97]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[98]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[99]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[92]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[94]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[95]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[96]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL", ZINT_ERROR_TOO_LONG, -1, -1, "Error 442: Input too long for selected 2D component" }, // Max linear and oversized CC-C input + /*101*/ { BARCODE_GS1_128_CC, -1, -1, -1, -1, "[01]12345678901231", "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[92]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[94]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[95]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[96]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[97]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[98]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[99]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[92]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[94]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[95]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[96]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[92]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[92]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHI" "JKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLM", ZINT_ERROR_TOO_LONG, -1, -1, "Error 446: 2D component input data too long" }, // Reduced length 2291 + /*102*/ { BARCODE_GS1_128_CC, -1, -1, -1, -1, "[01]12345678901231", "[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012" "345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[11]121212[20]12", 0, 32, 579, "" }, // Reduced length 2372 digits (no FNC1s) with not recommended ECC 4 > 2361 digit limit given in ISO/IEC 24723:2010 4.1 (d)(2)(iii) + /*103*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, -1, -1, "[91]1234567890123456789012345678901234", "[20]12", 0, 13, 102, "" }, + /*104*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, 1, -1, "[91]1234567890123456789012345678901234", "[20]12", 0, 13, 102, "" }, + /*105*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, 2, -1, "[91]1234567890123456789012345678901234", "[20]12", 0, 13, 102, "" }, + /*106*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, 3, -1, "[91]1234567890123456789012345678901234", "[20]12", 0, 9, 151, "" }, + /*107*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, 4, -1, "[91]1234567890123456789012345678901234", "[20]12", 0, 9, 200, "" }, + /*108*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, -1, 2, "[91]1234567890123456789012345678901234", "[20]12", 0, 9, 151, "" }, + /*109*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, -1, 3, "[91]1234567890123456789012345678901234", "[20]12", 0, 13, 102, "" }, + /*110*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, -1, 4, "[91]1234567890123456789012345678901234", "[20]12", 0, 13, 102, "" }, }; int data_size = ARRAY_SIZE(data); int i, length, composite_length, ret; @@ -3414,7 +3426,7 @@ static void test_input(int index, int debug) { symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); - length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, data[i].option_1, -1, -1, -1 /*output_options*/, data[i].data, -1, debug); + length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, data[i].option_3, -1 /*output_options*/, data[i].data, -1, debug); assert_zero(length >= 128, "i:%d length %d >= 128\n", i, length); strcpy(symbol->primary, data[i].data); @@ -3425,6 +3437,11 @@ static void test_input(int index, int debug) { assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt); + if (ret < ZINT_ERROR) { + assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (symbol->width %d)\n", i, symbol->rows, data[i].expected_rows, symbol->width); + assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width); + } + ZBarcode_Delete(symbol); } diff --git a/backend/tests/test_raster.c b/backend/tests/test_raster.c index a953f62a..c7426f5a 100644 --- a/backend/tests/test_raster.c +++ b/backend/tests/test_raster.c @@ -2618,6 +2618,169 @@ static void test_height(int index, int generate, int debug) { testFinish(); } +static void test_height_per_row(int index, int generate, int debug) { + + struct item { + int symbology; + int input_mode; + int option_1; + int option_2; + int option_3; + float height; + float scale; + char *data; + char *composite; + int ret; + + float expected_height; + int expected_rows; + int expected_width; + int expected_bitmap_width; + int expected_bitmap_height; + + const char *comment; + }; + struct item data[] = { + /* 0*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, "1234567890", "", 0, 21, 7, 103, 206, 42, "" }, + /* 1*/ { BARCODE_PDF417, HEIGHTPERROW_MODE, -1, -1, -1, 0.5, -1, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 3.5, 7, 103, 206, 7, "" }, + /* 2*/ { BARCODE_PDF417, HEIGHTPERROW_MODE, -1, -1, -1, 1, -1, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 7, 7, 103, 206, 14, "" }, + /* 3*/ { BARCODE_PDF417, HEIGHTPERROW_MODE, -1, -1, -1, 1.25, -1, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 10.5, 7, 103, 206, 21, "" }, + /* 4*/ { BARCODE_PDF417, HEIGHTPERROW_MODE, -1, -1, -1, 1.5, -1, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 10.5, 7, 103, 206, 21, "" }, + /* 5*/ { BARCODE_PDF417, HEIGHTPERROW_MODE, -1, -1, -1, 1.7, -1, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 10.5, 7, 103, 206, 21, "" }, + /* 6*/ { BARCODE_PDF417, HEIGHTPERROW_MODE, -1, -1, -1, 1.74, -1, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 10.5, 7, 103, 206, 21, "" }, + /* 7*/ { BARCODE_PDF417, HEIGHTPERROW_MODE, -1, -1, -1, 1.75, -1, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 14, 7, 103, 206, 28, "" }, + /* 8*/ { BARCODE_PDF417, HEIGHTPERROW_MODE, -1, -1, -1, 2, -1, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 14, 7, 103, 206, 28, "" }, + /* 9*/ { BARCODE_PDF417, HEIGHTPERROW_MODE, -1, -1, -1, 2.1, -1, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 14, 7, 103, 206, 28, "" }, + /* 10*/ { BARCODE_PDF417, HEIGHTPERROW_MODE, -1, -1, -1, 2.25, -1, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 17.5, 7, 103, 206, 35, "" }, + /* 11*/ { BARCODE_PDF417, HEIGHTPERROW_MODE, -1, -1, -1, 2.5, -1, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 17.5, 7, 103, 206, 35, "" }, + /* 12*/ { BARCODE_PDF417, HEIGHTPERROW_MODE, -1, -1, -1, 2.75, -1, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 21, 7, 103, 206, 42, "" }, + /* 13*/ { BARCODE_PDF417, HEIGHTPERROW_MODE, -1, -1, -1, 3, -1, "1234567890", "", 0, 21, 7, 103, 206, 42, "Default" }, + /* 14*/ { BARCODE_PDF417, HEIGHTPERROW_MODE, -1, -1, -1, 3.5, -1, "1234567890", "", 0, 24.5, 7, 103, 206, 49, "" }, + /* 15*/ { BARCODE_PDF417, HEIGHTPERROW_MODE, -1, -1, -1, 1000, -1, "1234567890", "", 0, 7000, 7, 103, 206, 14000, "" }, + /* 16*/ { BARCODE_PDF417, HEIGHTPERROW_MODE, -1, -1, 5, 0.5, -1, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 2.5, 5, 120, 240, 5, "5 rows" }, + /* 17*/ { BARCODE_PDF417COMP, HEIGHTPERROW_MODE, -1, -1, -1, 3.5, -1, "1234567890", "", 0, 24.5, 7, 69, 138, 49, "" }, + /* 18*/ { BARCODE_HIBC_PDF, HEIGHTPERROW_MODE, -1, -1, -1, 3.5, -1, "1234567890", "", 0, 28, 8, 103, 206, 56, "" }, + /* 19*/ { BARCODE_CODE16K, -1, -1, -1, -1, -1, -1, "1234567890", "", 0, 20, 2, 70, 162, 44, "" }, + /* 20*/ { BARCODE_CODE16K, HEIGHTPERROW_MODE, -1, -1, -1, 0.5, -1, "1234567890", "", 0, 1, 2, 70, 162, 6, "(0.5 * 2 rows + 2 binds) * 2 scale = 6 (separator will cover rows)" }, + /* 21*/ { BARCODE_CODE16K, HEIGHTPERROW_MODE, -1, -1, -1, 0.7, -1, "1234567890", "", 0, 1, 2, 70, 162, 6, "" }, + /* 22*/ { BARCODE_CODE16K, HEIGHTPERROW_MODE, -1, -1, -1, 0.75, -1, "1234567890", "", 0, 2, 2, 70, 162, 8, "" }, + /* 23*/ { BARCODE_CODE16K, HEIGHTPERROW_MODE, -1, -1, -1, 1, -1, "1234567890", "", 0, 2, 2, 70, 162, 8, "" }, + /* 24*/ { BARCODE_CODE16K, HEIGHTPERROW_MODE, -1, -1, -1, 1.1, -1, "1234567890", "", 0, 2, 2, 70, 162, 8, "" }, + /* 25*/ { BARCODE_CODE16K, HEIGHTPERROW_MODE, -1, -1, -1, 1.2, -1, "1234567890", "", 0, 2, 2, 70, 162, 8, "" }, + /* 26*/ { BARCODE_CODE16K, HEIGHTPERROW_MODE, -1, -1, -1, 1.25, -1, "1234567890", "", 0, 3, 2, 70, 162, 10, "" }, + /* 27*/ { BARCODE_CODE16K, HEIGHTPERROW_MODE, -1, -1, -1, 1.5, -1, "1234567890", "", 0, 3, 2, 70, 162, 10, "" }, + /* 28*/ { BARCODE_CODE16K, HEIGHTPERROW_MODE, -1, -1, -1, 2, -1, "1234567890", "", 0, 4, 2, 70, 162, 12, "" }, + /* 29*/ { BARCODE_CODE16K, HEIGHTPERROW_MODE, -1, -1, -1, 10, -1, "1234567890", "", 0, 20, 2, 70, 162, 44, "Default" }, + /* 30*/ { BARCODE_CODE16K, HEIGHTPERROW_MODE, -1, -1, -1, 10.5, -1, "1234567890", "", 0, 21, 2, 70, 162, 46, "" }, + /* 31*/ { BARCODE_CODE49, -1, -1, -1, -1, -1, -1, "12345678901234567890", "", 0, 30, 3, 70, 162, 64, "" }, + /* 32*/ { BARCODE_CODE49, HEIGHTPERROW_MODE, -1, -1, -1, 2, -1, "12345678901234567890", "", 0, 6, 3, 70, 162, 16, "(2 * 3 rows + 2 binds) * 2 scale = 16" }, + /* 33*/ { BARCODE_CODE49, HEIGHTPERROW_MODE, -1, -1, -1, 10, -1, "12345678901234567890", "", 0, 30, 3, 70, 162, 64, "Default" }, + /* 34*/ { BARCODE_CODE49, HEIGHTPERROW_MODE, -1, -1, -1, 10.5, -1, "12345678901234567890", "", 0, 31.5, 3, 70, 162, 67, "" }, + /* 35*/ { BARCODE_CODABLOCKF, -1, -1, -1, -1, -1, -1, "1234567890123456789", "", 0, 40, 4, 101, 242, 84, "" }, + /* 36*/ { BARCODE_CODABLOCKF, HEIGHTPERROW_MODE, -1, -1, -1, 0.5, -1, "1234567890123456789", "", 0, 2, 4, 101, 242, 8, "(0.5 * 4 rows + 2 binds) * 2 scale = 8" }, + /* 37*/ { BARCODE_CODABLOCKF, HEIGHTPERROW_MODE, -1, -1, -1, 1, -1, "1234567890123456789", "", 0, 4, 4, 101, 242, 12, "" }, + /* 38*/ { BARCODE_CODABLOCKF, HEIGHTPERROW_MODE, -1, -1, -1, 3, -1, "1234567890123456789", "", 0, 12, 4, 101, 242, 28, "" }, + /* 39*/ { BARCODE_CODABLOCKF, HEIGHTPERROW_MODE, -1, -1, -1, 10, -1, "1234567890123456789", "", 0, 40, 4, 101, 242, 84, "Default when <= 12 cols" }, + /* 40*/ { BARCODE_CODABLOCKF, -1, 2, -1, -1, -1, -1, "12345678901234567890123456", "", 0, 20, 2, 200, 440, 44, "2 rows" }, + /* 41*/ { BARCODE_CODABLOCKF, HEIGHTPERROW_MODE, 2, -1, -1, 10.15, -1, "12345678901234567890123456", "", 0, 20, 2, 200, 440, 44, "Default for 13 cols" }, + /* 42*/ { BARCODE_CODABLOCKF, HEIGHTPERROW_MODE, 2, -1, -1, 2000, -1, "12345678901234567890123456", "", 0, 4000, 2, 200, 440, 8004, "" }, + /* 43*/ { BARCODE_CODABLOCKF, HEIGHTPERROW_MODE, -1, -1, -1, 10.5, -1, "1234567890123456789", "", 0, 42, 4, 101, 242, 88, "" }, + /* 44*/ { BARCODE_HIBC_BLOCKF, HEIGHTPERROW_MODE, -1, -1, -1, 10.5, -1, "1234567890123456789", "", 0, 42, 4, 101, 242, 88, "" }, + /* 45*/ { BARCODE_MICROPDF417, -1, -1, -1, -1, -1, -1, "1234567890", "", 0, 12, 6, 82, 164, 24, "" }, + /* 46*/ { BARCODE_MICROPDF417, HEIGHTPERROW_MODE, -1, -1, -1, 0.5, -1, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 3, 6, 82, 164, 6, "" }, + /* 47*/ { BARCODE_MICROPDF417, HEIGHTPERROW_MODE, -1, -1, -1, 2, -1, "1234567890", "", 0, 12, 6, 82, 164, 24, "Default" }, + /* 48*/ { BARCODE_MICROPDF417, HEIGHTPERROW_MODE, -1, -1, -1, 2.5, -1, "1234567890", "", 0, 15, 6, 82, 164, 30, "" }, + /* 49*/ { BARCODE_MICROPDF417, HEIGHTPERROW_MODE, -1, -1, -1, 3, -1, "1234567890", "", 0, 18, 6, 82, 164, 36, "" }, + /* 50*/ { BARCODE_HIBC_MICPDF, HEIGHTPERROW_MODE, -1, -1, -1, 3, -1, "1234567890", "", 0, 42, 14, 38, 76, 84, "" }, + /* 51*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, -1, -1, -1, "[8110]106141416543213500110000310123196000", "", 0, 145, 13, 102, 204, 290, "" }, + /* 52*/ { BARCODE_DBAR_EXPSTK, HEIGHTPERROW_MODE, -1, -1, -1, 0.5, -1, "[8110]106141416543213500110000310123196000", "", 0, 11, 13, 102, 204, 22, "(0.5 * 4 rows + 9 seps) * 2 scale = 22" }, + /* 53*/ { BARCODE_DBAR_EXPSTK, HEIGHTPERROW_MODE, -1, -1, -1, 9, -1, "[8110]106141416543213500110000310123196000", "", 0, 45, 13, 102, 204, 90, "" }, + /* 54*/ { BARCODE_DBAR_EXPSTK, HEIGHTPERROW_MODE, -1, -1, -1, 9.5, -1, "[8110]106141416543213500110000310123196000", "", 0, 47, 13, 102, 204, 94, "" }, + /* 55*/ { BARCODE_DBAR_EXPSTK, HEIGHTPERROW_MODE, -1, -1, -1, 10, -1, "[8110]106141416543213500110000310123196000", "", 0, 49, 13, 102, 204, 98, "" }, + /* 56*/ { BARCODE_DBAR_EXPSTK, HEIGHTPERROW_MODE, -1, -1, -1, 34, -1, "[8110]106141416543213500110000310123196000", "", 0, 145, 13, 102, 204, 290, "Default" }, + /* 57*/ { BARCODE_DBAR_EXPSTK, HEIGHTPERROW_MODE, -1, -1, -1, 50, -1, "[8110]106141416543213500110000310123196000", "", 0, 209, 13, 102, 204, 418, "" }, + /* 58*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, -1, -1, -1, -1, "[8110]106141416543213500110000310123196000", "[8112]017777777666666223456789", 0, 154, 18, 102, 204, 308, "" }, + /* 59*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, -1, -1, 0.5, -1, "[8110]106141416543213500110000310123196000", "[8112]017777777666666223456789", 0, 20, 18, 102, 204, 40, "(0.5 * 4 rows + 10 seps + 2 * 4 cc) * 2 scale = 40" }, + /* 60*/ { BARCODE_DBAR_EXPSTK_CC, HEIGHTPERROW_MODE, -1, -1, -1, 34, -1, "[8110]106141416543213500110000310123196000", "[8112]017777777666666223456789", 0, 154, 18, 102, 204, 308, "Default" }, + /* 61*/ { BARCODE_DBAR_EXPSTK_CC, HEIGHTPERROW_MODE, -1, -1, -1, 35, -1, "[8110]106141416543213500110000310123196000", "[8112]017777777666666223456789", 0, 158, 18, 102, 204, 316, "" }, + /* 62*/ { BARCODE_PHARMA_TWO, -1, -1, -1, -1, -1, -1, "1234", "", 0, 10, 2, 13, 26, 20, "" }, + /* 63*/ { BARCODE_PHARMA_TWO, HEIGHTPERROW_MODE, -1, -1, -1, 0.5, -1, "1234", "", 0, 1, 2, 13, 26, 2, "" }, + /* 64*/ { BARCODE_PHARMA_TWO, HEIGHTPERROW_MODE, -1, -1, -1, 2.1, -1, "1234", "", 0, 4, 2, 13, 26, 8, "" }, + /* 65*/ { BARCODE_PHARMA_TWO, HEIGHTPERROW_MODE, -1, -1, -1, 2.2, -1, "1234", "", 0, 4, 2, 13, 26, 8, "" }, + /* 66*/ { BARCODE_PHARMA_TWO, HEIGHTPERROW_MODE, -1, -1, -1, 2.25, -1, "1234", "", 0, 5, 2, 13, 26, 10, "" }, + /* 67*/ { BARCODE_DBAR_OMNSTK, -1, -1, -1, -1, -1, -1, "1234567890123", "", 0, 69, 5, 50, 100, 138, "" }, + /* 68*/ { BARCODE_DBAR_OMNSTK, HEIGHTPERROW_MODE, -1, -1, -1, 0.5, -1, "1234567890123", "", 0, 4, 5, 50, 100, 8, "(0.5 * 2 rows + 3 separators) * 2 scale = 8" }, + /* 69*/ { BARCODE_DBAR_OMNSTK, HEIGHTPERROW_MODE, -1, -1, -1, 1, -1, "1234567890123", "", 0, 5, 5, 50, 100, 10, "" }, + /* 70*/ { BARCODE_DBAR_OMNSTK, HEIGHTPERROW_MODE, -1, -1, -1, 3.2, -1, "1234567890123", "", 0, 9, 5, 50, 100, 18, "" }, + /* 71*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, "123456789012", "[20]01", 0, 50, 7, 99, 234, 110, "" }, + /* 72*/ { BARCODE_EANX_CC, HEIGHTPERROW_MODE, -1, -1, -1, 0.5, -1, "123456789012", "[20]01", 0, 12.5, 7, 99, 234, 35, "(0.5 * 1 row + 2 * 3 seps + 2 * 3 cc rows + 5 guards) * 2 scale = 35" }, + /* 73*/ { BARCODE_EANX_CC, -1, -1, -1, -1, 0.5, -1, "123456789012", "[20]01", 0, 12.5, 7, 99, 234, 35, "0.5 height below fixed height" }, + /* 74*/ { BARCODE_EANX_CC, HEIGHTPERROW_MODE, -1, -1, -1, 4, -1, "123456789012", "[20]01", 0, 16, 7, 99, 234, 42, "" }, + /* 75*/ { BARCODE_EANX_CC, -1, -1, -1, -1, 4, -1, "123456789012", "[20]01", 0, 12.5, 7, 99, 234, 35, "4 height below fixed height" }, + }; + int data_size = ARRAY_SIZE(data); + int i, length, ret; + struct zint_symbol *symbol; + + char *text; + + testStart("test_height_per_row"); + + for (i = 0; i < data_size; i++) { + + if (index != -1 && i != index) continue; + if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d\n", i); + + symbol = ZBarcode_Create(); + assert_nonnull(symbol, "Symbol not created\n"); + + if (data[i].height != -1) { + symbol->height = data[i].height; + } + if (data[i].scale != -1) { + symbol->scale = data[i].scale; + } + symbol->show_hrt = 0; // Note: disabling HRT + + if (strlen(data[i].composite)) { + text = data[i].composite; + strcpy(symbol->primary, data[i].data); + } else { + text = data[i].data; + } + length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, data[i].option_3, -1 /*output_options*/, text, -1, debug); + + ret = ZBarcode_Encode(symbol, (unsigned char *) text, length); + assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode(%s) ret %d != %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, data[i].ret, symbol->errtxt); + + ret = ZBarcode_Buffer(symbol, 0); + assert_zero(ret, "i:%d ZBarcode_Buffer(%s) ret %d != 0 (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, symbol->errtxt); + assert_nonnull(symbol->bitmap, "i:%d ZBarcode_Buffer(%s) bitmap NULL\n", i, testUtilBarcodeName(data[i].symbology)); + + if (index != -1 && (debug & ZINT_DEBUG_TEST_PRINT)) testUtilBitmapPrint(symbol, NULL, NULL); + + if (generate) { + printf(" /*%3d*/ { %s, %s, %d, %d, %d, %.5g, %.5g, \"%s\", \"%s\", %s, %.8g, %d, %d, %d, %d, \"%s\" },\n", + i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), + data[i].option_1, data[i].option_2, data[i].option_3, data[i].height, data[i].scale, + data[i].data, data[i].composite, testUtilErrorName(data[i].ret), + symbol->height, symbol->rows, symbol->width, symbol->bitmap_width, symbol->bitmap_height, data[i].comment); + } else { + assert_equal(symbol->height, data[i].expected_height, "i:%d (%s) symbol->height %.8g != %.8g\n", i, testUtilBarcodeName(data[i].symbology), symbol->height, data[i].expected_height); + assert_equal(symbol->rows, data[i].expected_rows, "i:%d (%s) symbol->rows %d != %d\n", i, testUtilBarcodeName(data[i].symbology), symbol->rows, data[i].expected_rows); + assert_equal(symbol->width, data[i].expected_width, "i:%d (%s) symbol->width %d != %d\n", i, testUtilBarcodeName(data[i].symbology), symbol->width, data[i].expected_width); + assert_equal(symbol->bitmap_width, data[i].expected_bitmap_width, "i:%d (%s) symbol->bitmap_width %d != %d\n", + i, testUtilBarcodeName(data[i].symbology), symbol->bitmap_width, data[i].expected_bitmap_width); + assert_equal(symbol->bitmap_height, data[i].expected_bitmap_height, "i:%d (%s) symbol->bitmap_height %d != %d\n", + i, testUtilBarcodeName(data[i].symbology), symbol->bitmap_height, data[i].expected_bitmap_height); + } + + ZBarcode_Delete(symbol); + } + + testFinish(); +} + #include #define TEST_PERF_ITER_MILLES 1 @@ -2754,6 +2917,7 @@ int main(int argc, char *argv[]) { { "test_quiet_zones", test_quiet_zones, 1, 0, 1 }, { "test_buffer_plot", test_buffer_plot, 1, 1, 1 }, { "test_height", test_height, 1, 1, 1 }, + { "test_height_per_row", test_height_per_row, 1, 1, 1 }, { "test_perf_scale", test_perf_scale, 1, 0, 1 }, }; diff --git a/backend/tests/test_rss.c b/backend/tests/test_rss.c index 4c2931ca..9e6a5137 100644 --- a/backend/tests/test_rss.c +++ b/backend/tests/test_rss.c @@ -186,6 +186,7 @@ static void test_examples(int index, int generate, int debug) { int symbology; int input_mode; int option_2; + int option_3; char *data; int ret; @@ -197,109 +198,109 @@ static void test_examples(int index, int generate, int debug) { }; // Verified manually against GS1 General Specifications 21.0.1 (GGS) and ISO/IEC 24724:2011, and verified via bwipp_dump.ps against BWIPP struct item data[] = { - /* 0*/ { BARCODE_DBAR_OMN, -1, -1, "0950110153001", 0, 1, 96, 1, "GGS Figure 5.5.2.1.1-1. GS1 DataBar Omnidirectional", + /* 0*/ { BARCODE_DBAR_OMN, -1, -1, -1, "0950110153001", 0, 1, 96, 1, "GGS Figure 5.5.2.1.1-1. GS1 DataBar Omnidirectional", "010000010100000101000111110000010111101101011100100011011101000101100000000111001110110111001101" }, - /* 1*/ { BARCODE_DBAR_EXP, -1, -1, "[01]90614141000015[3202]000150", 0, 1, 151, 1, "GGS Figure 5.5.2.3.1-1. GS1 DataBar Expanded", + /* 1*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90614141000015[3202]000150", 0, 1, 151, 1, "GGS Figure 5.5.2.3.1-1. GS1 DataBar Expanded", "0101100011001100001011111111000010100100010000111101110011100010100010111100000011100111010111111011010100000100000110001111110000101000000100011010010" }, - /* 2*/ { BARCODE_DBAR_EXPSTK, -1, -1, "[01]90614141000015[3202]000150", 0, 5, 102, 1, "GGS Figure 5.5.2.3.2-1. GS1 DataBar Expanded Stacked, same (tec-it separator differs)", + /* 2*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[01]90614141000015[3202]000150", 0, 5, 102, 1, "GGS Figure 5.5.2.3.2-1. GS1 DataBar Expanded Stacked, same (tec-it separator differs)", "010110001100110000101111111100001010010001000011110111001110001010001011110000001110011101011111101101" "000001110011001111010000000010100101101110111100001000110001110101110100001010100001100010100000010000" "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" "000001011111011111001010000001010010111111011100100000000000000000000000000000000000000000000000000000" "001010100000100000110001111110000101000000100011010010000000000000000000000000000000000000000000000000" }, - /* 3*/ { BARCODE_DBAR_OMN, -1, -1, "2001234567890", 0, 1, 96, 1, "24724:2011 Figure 1 — GS1 DataBar Omnidirectional", + /* 3*/ { BARCODE_DBAR_OMN, -1, -1, -1, "2001234567890", 0, 1, 96, 1, "24724:2011 Figure 1 — GS1 DataBar Omnidirectional", "010100011101000001001111111000010100110110111110110000010010100101100000000111000110110110001101" }, - /* 4*/ { BARCODE_DBAR_OMN, -1, -1, "0441234567890", 0, 1, 96, 1, "24724:2011 Figure 2 — GS1 DataBar Omnidirectional", + /* 4*/ { BARCODE_DBAR_OMN, -1, -1, -1, "0441234567890", 0, 1, 96, 1, "24724:2011 Figure 2 — GS1 DataBar Omnidirectional", "010010001000010001000111000000010101000001100110101100100100000101111110000011000010100011100101" }, - /* 5*/ { BARCODE_DBAR_OMN, -1, -1, "0001234567890", 0, 1, 96, 1, "24724:2011 Figure 4 — GS1 DataBar Truncated", + /* 5*/ { BARCODE_DBAR_OMN, -1, -1, -1, "0001234567890", 0, 1, 96, 1, "24724:2011 Figure 4 — GS1 DataBar Truncated", "010101001000000001001111111000010111001011011110111001010110000101111111000111001100111101110101" }, - /* 6*/ { BARCODE_DBAR_STK, -1, -1, "0001234567890", 0, 3, 50, 1, "24724:2011 Figure 5 — GS1 DataBar Stacked NOTE: Figure 5 separator differs from GGS Figure 5.5.2.1.3-1. which has ends set", + /* 6*/ { BARCODE_DBAR_STK, -1, -1, -1, "0001234567890", 0, 3, 50, 1, "24724:2011 Figure 5 — GS1 DataBar Stacked NOTE: Figure 5 separator differs from GGS Figure 5.5.2.1.3-1. which has ends set", "01010100100000000100111111100001011100101101111010" "00001010101011111010000000111010100011010010000000" "10111001010110000101111111000111001100111101110101" }, - /* 7*/ { BARCODE_DBAR_OMNSTK, -1, -1, "0003456789012", 0, 5, 50, 1, "24724:2011 Figure 6 — GS1 DataBar Stacked Omnidirectional", + /* 7*/ { BARCODE_DBAR_OMNSTK, -1, -1, -1, "0003456789012", 0, 5, 50, 1, "24724:2011 Figure 6 — GS1 DataBar Stacked Omnidirectional", "01010100100000000100111110000001010011100110011010" "00001011011111111010000001010100101100011001100000" "00000101010101010101010101010101010101010101010000" "00001000100010111010010101010000111101001101110000" "10110111011101000101100000000111000010110010001101" }, - /* 8*/ { BARCODE_DBAR_LTD, -1, -1, "1501234567890", 0, 1, 79, 1, "24724:2011 Figure 7 — GS1 DataBar Limited", + /* 8*/ { BARCODE_DBAR_LTD, -1, -1, -1, "1501234567890", 0, 1, 79, 1, "24724:2011 Figure 7 — GS1 DataBar Limited", "0100011001100011011010100111010010101101001101001001011000110111001100110100000" }, - /* 9*/ { BARCODE_DBAR_LTD, -1, -1, "0031234567890", 0, 1, 79, 1, "24724:2011 Figure 8 — (a) GS1 DataBar Limited", + /* 9*/ { BARCODE_DBAR_LTD, -1, -1, -1, "0031234567890", 0, 1, 79, 1, "24724:2011 Figure 8 — (a) GS1 DataBar Limited", "0101010000010010001000010111001010110110100101011000001010010010110000010100000" }, - /* 10*/ { BARCODE_DBAR_EXP, -1, -1, "[01]98898765432106[3202]012345[15]991231", 0, 1, 200, 1, "24724:2011 Figure 10 — GS1 DataBar Expanded", + /* 10*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]98898765432106[3202]012345[15]991231", 0, 1, 200, 1, "24724:2011 Figure 10 — GS1 DataBar Expanded", "01001000011000110110111111110000101110000110010100011010000001100010101111110000111010011100000010010100111110111001100011111100001011101100000100100100011110010110001011111111001110001101111010000101" }, - /* 11*/ { BARCODE_DBAR_EXP, -1, -1, "[01]90012345678908[3103]001750", 0, 1, 151, 1, "24724:2011 Figure 11 — GS1 DataBar Expanded", + /* 11*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3103]001750", 0, 1, 151, 1, "24724:2011 Figure 11 — GS1 DataBar Expanded", "0101110010000010011011111111000010111000010011000101011110111001100010111100000011100101110001110111011110101111000110001111110000101011000010011111010" }, - /* 12*/ { BARCODE_DBAR_EXPSTK, -1, -1, "[01]98898765432106[3202]012345[15]991231", 0, 5, 102, 1, "24724:2011 Figure 12 — GS1 DataBar Expanded Stacked symbol", + /* 12*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[01]98898765432106[3202]012345[15]991231", 0, 5, 102, 1, "24724:2011 Figure 12 — GS1 DataBar Expanded Stacked symbol", "010010000110001101101111111100001011100001100101000110100000011000101011111100001110100111000000100101" "000001111001110010010000000010100100011110011010111001011111100111010100000010100001011000111111010000" "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" "000011101000010011100001000000001011100101100001110110110111110010001001010000001010011000100000110000" "101000010111101100011100111111110100011010011110001001001000001101110100001111110001100111011111001010" }, - /* 13*/ { BARCODE_DBAR_EXPSTK, -1, -1, "[01]95012345678903[3103]000123", 0, 5, 102, 1, "24724:2011 Figure 13 — GS1 DataBar Expanded Stacked", + /* 13*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[01]95012345678903[3103]000123", 0, 5, 102, 1, "24724:2011 Figure 13 — GS1 DataBar Expanded Stacked", "010100010001111000101111111100001010111000001100010111000110001001101011110000001110010111000111011101" "000011101110000111010000000010100101000111110011101000111001110110010100001010100001101000111000100000" "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" "000000001010000111001010000001010010111011011111100000000000000000000000000000000000000000000000000000" "001011110101111000110001111110000101000100100000011010000000000000000000000000000000000000000000000000" }, - /* 14*/ { BARCODE_DBAR_LTD, -1, -1, "0009876543210", 0, 1, 79, 1, "24724:2011 Figure F.2 — GS1 DataBar Limited", + /* 14*/ { BARCODE_DBAR_LTD, -1, -1, -1, "0009876543210", 0, 1, 79, 1, "24724:2011 Figure F.2 — GS1 DataBar Limited", "0101010010010011000011000001010110100101100101000100010100010000010010010100000" }, - /* 15*/ { BARCODE_DBAR_EXP, -1, -1, "[10]12A", 0, 1, 102, 1, "24724:2011 Figure F.3 — GS1 DataBar Expanded", + /* 15*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[10]12A", 0, 1, 102, 1, "24724:2011 Figure F.3 — GS1 DataBar Expanded", "010100000110100000101111111100001010001000000010110101111100100111001011110000000010011101111111010101" }, - /* 16*/ { BARCODE_DBAR_STK, -1, -1, "0000000000000", 0, 3, 50, 1, "#183 GS1 DataBar Stacked separator alternation; verified manually against tec-it.com", + /* 16*/ { BARCODE_DBAR_STK, -1, -1, -1, "0000000000000", 0, 3, 50, 1, "#183 GS1 DataBar Stacked separator alternation; verified manually against tec-it.com", "01010100100000000100011111111001011111110010101010" "00000101011111111010100000001010100000001101010000" "10101010110000000101111111110111011111111011010101" }, - /* 17*/ { BARCODE_DBAR_EXP, -1, -1, "[255]95011015340010123456789", 0, 1, 232, 1, "GGS 2.6.2.1 Example 1", + /* 17*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[255]95011015340010123456789", 0, 1, 232, 1, "GGS 2.6.2.1 Example 1", "0100011000110001011011111111000010100000010101100001100001100111001010111110000001100100001110100001001000011011111010001111110000101001011111100111011001000111100100101111111100111011111001100100110010011100010111100011110000001010" }, - /* 18*/ { BARCODE_DBAR_EXP, -1, -1, "[255]95011015340010123456789[3900]000", 0, 1, 298, 1, "GGS 2.6.2.1 Example 2", + /* 18*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[255]95011015340010123456789[3900]000", 0, 1, 298, 1, "GGS 2.6.2.1 Example 2", "0101100011111010001011111111000010100001000001001101100001100111001010111110000001100100001110100001001000011011111010001111110000101001011111100111011001000111100100101111111100111011111001100100110010011100010111100011000000001010111111011101000100001000110001101011111111100110011110010010001101" }, - /* 19*/ { BARCODE_DBAR_EXP, -1, -1, "[255]9501101534001[17]160531[3902]050", 0, 1, 281, 1, "GGS 2.6.2.1 Example 3", + /* 19*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[255]9501101534001[17]160531[3902]050", 0, 1, 281, 1, "GGS 2.6.2.1 Example 3", "01011001000110011110111111110000101000000101011000011000011001110010101111100000011001000011101000010010000110111110100011111100001010010111111001110111000010010100001011111111001110000100001100110100010000001101001000110000000010111010011110011101110010110001100010111111111001101" }, - /* 20*/ { BARCODE_DBAR_EXPSTK, -1, 3, "[255]9501101534001012345[8111]0500", 0, 5, 151, 1, "GGS 2.6.2.1 Example 4, same (tec-it separator differs)", + /* 20*/ { BARCODE_DBAR_EXPSTK, -1, 3, -1, "[255]9501101534001012345[8111]0500", 0, 5, 151, 1, "GGS 2.6.2.1 Example 4, same (tec-it separator differs)", "0101100111100011001011111111000010100000010101100001100001100111001010111110000001100100001110100001001000011011111010001111110000101001011111100111010" "0000011000011100110100000000101001011111101010011110011110011000110101000001010100011011110001011110110111100100000101010000001010010110100000011000000" "0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000" "0000110111000011011010000000010000100000100111011001100001100100010010100101010100101110110001111001011101100011101110100000000010000000000000000000000" "1011001000111100100101111111100111011111011000100110011110011011101100011000000001010001001110000110100010011100010001011111111100110100000000000000000" }, - /* 21*/ { BARCODE_DBAR_EXPSTK, -1, 3, "[255]9501101534001[3941]0035", 0, 5, 151, 1, "GGS 2.6.2.1 Example 5, same (tec-it separator differs)", + /* 21*/ { BARCODE_DBAR_EXPSTK, -1, 3, -1, "[255]9501101534001[3941]0035", 0, 5, 151, 1, "GGS 2.6.2.1 Example 5, same (tec-it separator differs)", "0100001101011000011011111111000010100000010101100001100001100111001010111110000001100100001110100001001000011011111010001111110000101001011111100111010" "0000110010100111100100000000101001011111101010011110011110011000110101000001010100011011110001011110110111100100000101010000001010010110100000011000000" "0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000" "0000011011111011111010000000010000111100101011111001000100011100111010100001010100000000000000000000000000000000000000000000000000000000000000000000000" "1010100100000100000101111111100111000011010100000110111011100011000100011110000001010000000000000000000000000000000000000000000000000000000000000000000" }, - /* 22*/ { BARCODE_DBAR_OMN, -1, -1, "0950110153000", 0, 1, 96, 1, "https://www.gs1.org/standards/barcodes/databar, same, verified manually against tec-it", + /* 22*/ { BARCODE_DBAR_OMN, -1, -1, -1, "0950110153000", 0, 1, 96, 1, "https://www.gs1.org/standards/barcodes/databar, same, verified manually against tec-it", "010000010100000101000111111110010111101101011100100011011011000101111110000011001110110111001101" }, - /* 23*/ { BARCODE_DBAR_STK, -1, -1, "0950110153000", 0, 3, 50, 1, "https://www.gs1.org/standards/barcodes/databar, same, verified manually against tec-it", + /* 23*/ { BARCODE_DBAR_STK, -1, -1, -1, "0950110153000", 0, 3, 50, 1, "https://www.gs1.org/standards/barcodes/databar, same, verified manually against tec-it", "01000001010000010100011111111001011110110101110010" "00001100101101101010100001010100100001001010100000" "10100011011011000101111110000011001110110111001101" }, - /* 24*/ { BARCODE_DBAR_EXPSTK, -1, -1, "[01]09501101530003[17]140704[10]AB-123", 0, 9, 102, 1, "https://www.gs1.org/standards/barcodes/databar, same (tec-it separator differs)", + /* 24*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[01]09501101530003[17]140704[10]AB-123", 0, 9, 102, 1, "https://www.gs1.org/standards/barcodes/databar, same (tec-it separator differs)", "010101111100001001101111111100001011100001110110010100000011011010001011111000000110011010000001001101" "000010000011110110010000000010100100011110001001101011111100100101110100000101010001100101111110110000" "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" @@ -310,64 +311,64 @@ static void test_examples(int index, int generate, int debug) { "000010111101011110010100101010100100111100110010111001001100011111010100000000010000000000000000000000" "010001000010100001100011000000001011000011001101000110110011100000101011111111100110100000000000000000" }, - /* 25*/ { BARCODE_DBAR_EXP, -1, -1, "[01]09501101530003[17]140704[10]AB-123", 0, 1, 281, 1, "https://www.gs1.org/standards/barcodes/databar, same, verified manually against tec-it", + /* 25*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]09501101530003[17]140704[10]AB-123", 0, 1, 281, 1, "https://www.gs1.org/standards/barcodes/databar, same, verified manually against tec-it", "01010111110000100110111111110000101110000111011001010000001101101000101111100000011001101000000100110001110100010001100011111100001010100000111100100100100111000001001011111111001110000011011001000100010000101000011000110000000010110000110011010001101100111000001010111111111001101" }, - /* 26*/ { BARCODE_DBAR_STK, -1, -1, "07010001234567", 0, 3, 50, 1, "https://www.gs1.no/support/standardbibliotek/datafangst/gs1-databar, same, verified manually against tec-it", + /* 26*/ { BARCODE_DBAR_STK, -1, -1, -1, "07010001234567", 0, 3, 50, 1, "https://www.gs1.no/support/standardbibliotek/datafangst/gs1-databar, same, verified manually against tec-it", "01000100001010000100011100000001011000100110001010" "00000011010101011010101011111010100111010101010000" "10111100101110100101100000000111011000001000110101" }, - /* 27*/ { BARCODE_DBAR_OMNSTK, -1, -1, "12380000000008", 0, 5, 50, 1, "Example with finder values 3 & 3; for bottom row see 5.3.2.2, same as BWIPP (tec-it and IDAutomation differ (ie no shift))", + /* 27*/ { BARCODE_DBAR_OMNSTK, -1, -1, -1, "12380000000008", 0, 5, 50, 1, "Example with finder values 3 & 3; for bottom row see 5.3.2.2, same as BWIPP (tec-it and IDAutomation differ (ie no shift))", "01011101001000000100010000000001010000001101011010" "00000010110111111010101010101010101111110010100000" "00000101010101010101010101010101010101010101010000" "00001101100011001010000000000100101100111011110000" "10100010011100110101111111110111010011000100001101" }, - /* 28*/ { BARCODE_DBAR_OMNSTK, -1, -1, "99991234912372", 0, 5, 50, 1, "Example with finder values 8 & 6, same as BWIPP, verified manually against tec-it and IDAutomation", + /* 28*/ { BARCODE_DBAR_OMNSTK, -1, -1, -1, "99991234912372", 0, 5, 50, 1, "Example with finder values 8 & 6, same as BWIPP, verified manually against tec-it and IDAutomation", "01001011101110000101110000000001011111011100101010" "00000100010001111010001010101010100000100011010000" "00000101010101010101010101010101010101010101010000" "00001000100011001010000000010100100001000100100000" "10100111011100110101111111100011011110111011011101" }, - /* 29*/ { BARCODE_DBAR_OMNSTK, -1, -1, "32219876543217", 0, 5, 50, 1, "Example with finder values 6 & 1, same as BWIPP, verified manually against tec-it and IDAutomation", + /* 29*/ { BARCODE_DBAR_OMNSTK, -1, -1, -1, "32219876543217", 0, 5, 50, 1, "Example with finder values 6 & 1, same as BWIPP, verified manually against tec-it and IDAutomation", "01001011000010001100111000000001011100010101000010" "00000100111101110010000101010100100011101010110000" "00000101010101010101010101010101010101010101010000" "00001110011100101010000010101000110100001000010000" "10110001100011010101111100000111001011110111100101" }, - /* 30*/ { BARCODE_DBAR_OMNSTK, -1, -1, "32219876543255", 0, 5, 50, 1, "Example with finder values 7 & 7, same as BWIPP, verified manually against tec-it and IDAutomation", + /* 30*/ { BARCODE_DBAR_OMNSTK, -1, -1, -1, "32219876543255", 0, 5, 50, 1, "Example with finder values 7 & 7, same as BWIPP, verified manually against tec-it and IDAutomation", "01001011000010001101111100000001011100010101000010" "00000100111101110010000010101010100011101010110000" "00000101010101010101010101010101010101010101010000" "00000111001110101010000000101010110100001000010000" "10111000110001010101111111000001001011110111100101" }, - /* 31*/ { BARCODE_DBAR_OMNSTK, -1, -1, "04072912296211", 0, 5, 50, 1, "Example with finder values 7 & 8, same as BWIPP, verified manually against tec-it and IDAutomation", + /* 31*/ { BARCODE_DBAR_OMNSTK, -1, -1, -1, "04072912296211", 0, 5, 50, 1, "Example with finder values 7 & 8, same as BWIPP, verified manually against tec-it and IDAutomation", "01001001000000010101111100000001011111000100101010" "00000110111111101010000010101010100000111011010000" "00000101010101010101010101010101010101010101010000" "00001110100010111010000000001010111010000111010000" "10110001011101000101111111110001000101111000101101" }, - /* 32*/ { BARCODE_DBAR_OMNSTK, -1, -1, "06666666666666", 0, 5, 50, 1, "Example with finder values 6 & 4, same as BWIPP, verified manually against tec-it and IDAutomation", + /* 32*/ { BARCODE_DBAR_OMNSTK, -1, -1, -1, "06666666666666", 0, 5, 50, 1, "Example with finder values 6 & 4, same as BWIPP, verified manually against tec-it and IDAutomation", "01000100010010000100111000000001011110111100101010" "00001011101101111010000101010100100001000011010000" "00000101010101010101010101010101010101010101010000" "00000100011111001010000101010100101001100001110000" "10101011100000110101111000000011010110011110000101" }, - /* 33*/ { BARCODE_DBAR_EXPSTK, -1, -1, "[90]12345678901234567", 0, 5, 102, 1, "Example with 7 chars, 1 full row, bottom 3 chars", + /* 33*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[90]12345678901234567", 0, 5, 102, 1, "Example with 7 chars, 1 full row, bottom 3 chars", "010010100001111000101111111100001010000010001110110100111110001011101011111100001110001111010011000101" "000001011110000111010000000010100101111101110001001011000001110100010100000010100001110000101100110000" "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" "000000100000000101111110110001101011110001110011010100101000000101000010010111000000000000000000000000" "101110011111111010000001001110010100001110001100101010000111111000111101101000111101000000000000000000" }, - /* 34*/ { BARCODE_DBAR_EXPSTK, -1, -1, "[90]123456789012345678901234567", 0, 9, 102, 1, "Example with 10 chars, 2 full rows, bottom 2 chars", + /* 34*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[90]123456789012345678901234567", 0, 9, 102, 1, "Example with 10 chars, 2 full rows, bottom 2 chars", "010000111100100010101111111100001010001000100000110100111110001011101011111000000110001111010011000101" "000011000011011101010000000010100101110111011111001011000001110100010100000101010001110000101100110000" "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" @@ -378,7 +379,7 @@ static void test_examples(int index, int generate, int debug) { "000010000110110001010100001010100100000111010011000000000000000000000000000000000000000000000000000000" "010001111001001110100011110000001011111000101100100100000000000000000000000000000000000000000000000000" }, - /* 35*/ { BARCODE_DBAR_EXPSTK, -1, -1, "[90]123456789012345678901234567890", 0, 9, 102, 1, "Example with 11 chars, 2 full rows, bottom 3 chars", + /* 35*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[90]123456789012345678901234567890", 0, 9, 102, 1, "Example with 11 chars, 2 full rows, bottom 3 chars", "010111011100010001101111111100001010000010001110110100111110001011101011111000000110001111010011000101" "000000100011101110010000000010100101111101110001001011000001110100010100000101010001110000101100110000" "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" @@ -389,7 +390,7 @@ static void test_examples(int index, int generate, int debug) { "000010000110110001010100101010100100111000100011011011000110001101110100000000010000000000000000000000" "010001111001001110100011000000001011000111011100100100111001110010001011111111100110100000000000000000" }, - /* 36*/ { BARCODE_DBAR_EXPSTK, -1, -1, "[91]1234567890123456789012345678901234", 0, 9, 102, 1, "Example with 12 chars, 3 full rows", + /* 36*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[91]1234567890123456789012345678901234", 0, 9, 102, 1, "Example with 12 chars, 3 full rows", "010100010011111001101111111100001011001000010000010100111110001011101011111000000110001111010011000101" "000011101100000110010000000010100100110111101111101011000001110100010100000101010001110000101100110000" "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" @@ -400,7 +401,7 @@ static void test_examples(int index, int generate, int debug) { "000010000110110001010100101010100100111000100011011011000110001110110100000000010001101110100001000000" "010001111001001110100011000000001011000111011100100100111001110001001011111111100110010001011110111101" }, - /* 37*/ { BARCODE_DBAR_EXPSTK, -1, -1, "[91]123456789012345678901234567890123456789012", 0, 13, 102, 1, "Example with 15 chars, 3 full rows, bottom 7 chars", + /* 37*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[91]123456789012345678901234567890123456789012", 0, 13, 102, 1, "Example with 15 chars, 3 full rows, bottom 7 chars", "010010000111101011101111111100001011100000101100010100111110001011101011110000000010001111010011000101" "000001111000010100010000000010100100011111010011101011000001110100010100001010101001110000101100110000" "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" @@ -415,7 +416,7 @@ static void test_examples(int index, int generate, int debug) { "000000100000000101001001111101100011000010000110010100101010100101011111011100100000000000000000000000" "101110011111111010110110000010011100111101111001101010000000011000100000100011011101000000000000000000" }, - /* 38*/ { BARCODE_DBAR_EXPSTK, -1, 3, "[91]123456789012345678901234567890123456789012", 0, 9, 151, 1, "Example with 15 chars, 2 full rows, bottom 3 chars", + /* 38*/ { BARCODE_DBAR_EXPSTK, -1, 3, -1, "[91]123456789012345678901234567890123456789012", 0, 9, 151, 1, "Example with 15 chars, 2 full rows, bottom 3 chars", "0100100001111010111011111111000010111000001011000101001111100010111010111100000000100011110100110001011110001011011110001111110000101010011000111000010" "0000011110000101000100000000101001000111110100111010110000011101000101000010101010011100001011001110100001110100100001010000001010010101100111000110000" "0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000" @@ -426,7 +427,7 @@ static void test_examples(int index, int generate, int debug) { "0000001001110111110101001010101001010011000010000110001101111100100101000000001000000000000000000000000000000000000000000000000000000000000000000000000" "0101110110001000001000110000000010101100111101111001110010000011011010111111110011101000000000000000000000000000000000000000000000000000000000000000000" }, - /* 39*/ { BARCODE_DBAR_EXPSTK, -1, -1, "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", 0, 17, 102, 1, "Example with 19 chars, 4 full rows, bottom 3 chars", + /* 39*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", 0, 17, 102, 1, "Example with 19 chars, 4 full rows, bottom 3 chars", "010101111100011101101111111100001011100000101100010101111110011110101011110000000010111000111110010101" "000010000011100010010000000010100100011111010011101010000001100001010100001010101001000111000001100000" "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" @@ -445,7 +446,7 @@ static void test_examples(int index, int generate, int debug) { "000010011111000111010001010101010101000111001111011011110100110000110100000000010000000000000000000000" "010101100000111000100110000000001010111000110000100100001011001111001011111111100110100000000000000000" }, - /* 40*/ { BARCODE_DBAR_EXPSTK, -1, -1, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 0, 21, 102, 1, "Example with 22 chars, 5 full rows, bottom 2 chars", + /* 40*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 0, 21, 102, 1, "Example with 22 chars, 5 full rows, bottom 2 chars", "010101011110111111101111111100001011001000000101000100111110001011101011110000000010001111010011000101" "000010100001000000010000000010100100110111111010111011000001110100010100001010101001110000101100110000" "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" @@ -468,7 +469,7 @@ static void test_examples(int index, int generate, int debug) { "000001000111010000101000101010101010100001011000110000000000000000000000000000000000000000000000000000" "001000111000101111010011000000000101011110100111000010000000000000000000000000000000000000000000000000" }, - /* 41*/ { BARCODE_DBAR_EXPSTK, -1, 3, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 0, 13, 151, 1, "Example with 22 chars, 3 full rows, bottom 4 chars", + /* 41*/ { BARCODE_DBAR_EXPSTK, -1, 3, -1, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 0, 13, 151, 1, "Example with 22 chars, 3 full rows, bottom 4 chars", "0101010111101111111011111111000010110010000001010001001111100010111010111100000000100011110100110001011110001011011110001111110000101010011000111000010" "0000101000010000000100000000101001001101111110101110110000011101000101000010101010011100001011001110100001110100100001010000001010010101100111000110000" "0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000" @@ -483,7 +484,7 @@ static void test_examples(int index, int generate, int debug) { "0000101110001000111010000000001000101111101000110001110001110100001010001010101010101000010110001100000000000000000000000000000000000000000000000000000" "1010010001110111000101111111110011010000010111001110001110001011110100110000000001010111101001110000100000000000000000000000000000000000000000000000000" }, - /* 42*/ { BARCODE_DBAR_EXPSTK, -1, 4, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 0, 9, 200, 1, "Example with 22 chars, 2 full rows, bottom 6 chars", + /* 42*/ { BARCODE_DBAR_EXPSTK, -1, 4, -1, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 0, 9, 200, 1, "Example with 22 chars, 2 full rows, bottom 6 chars", "01010101111011111110111111110000101100100000010100010011111000101110101111000000001000111101001100010111100010110111100011111100001010100110001110000101001110000010001011110000001110001110001000100101" "00001010000100000001000000001010010011011111101011101100000111010001010000101010100111000010110011101000011101001000010100000010100101011001110001111010110001111101110100001010100001110001110111010000" "00000101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" @@ -494,7 +495,7 @@ static void test_examples(int index, int generate, int debug) { "00000011000110001001000000010101010000011110011010101101110001000111010000000001000101111101000110001110001110100001010001010101010101000010110001100000000000000000000000000000000000000000000000000000" "01011100111001110110011111100000101111100001100101010010001110111000101111111110011010000010111001110001110001011110100110000000001010111101001110000100000000000000000000000000000000000000000000000000" }, - /* 43*/ { BARCODE_DBAR_EXPSTK, -1, 5, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 0, 9, 249, 1, "Example with 22 chars, 2 full rows, bottom 2 chars", + /* 43*/ { BARCODE_DBAR_EXPSTK, -1, 5, -1, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 0, 9, 249, 1, "Example with 22 chars, 2 full rows, bottom 2 chars", "010101011110111111101111111100001011001000000101000100111110001011101011110000000010001111010011000101111000101101111000111111000010101001100011100001010011100000100010111100000011100011100010001001000111100100111010001111000000101100011101110010010" "000010100001000000010000000010100100110111111010111011000001110100010100001010101001110000101100111010000111010010000101000000101001010110011100011110101100011111011101000010101000011100011101110110111000011011000101010000101010010011100010001100000" "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000" @@ -505,45 +506,45 @@ static void test_examples(int index, int generate, int debug) { "000010001110100001010001010101010101000010110001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" "010001110001011110100110000000001010111101001110000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" }, - /* 44*/ { BARCODE_DBAR_EXPSTK, -1, 6, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 0, 5, 298, 1, "Example with 22 chars, 1 full row, bottom 10 chars", + /* 44*/ { BARCODE_DBAR_EXPSTK, -1, 6, -1, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 0, 5, 298, 1, "Example with 22 chars, 1 full row, bottom 10 chars", "0101010111101111111011111111000010110010000001010001001111100010111010111100000000100011110100110001011110001011011110001111110000101010011000111000010100111000001000101111000000111000111000100010010001111001001110100011110000001011000111011100100100111001110001001011111111001110100001011110111101" "0000101000010000000100000000101001001101111110101110110000011101000101000010101010011100001011001110100001110100100001010000001010010101100111000111101011000111110111010000101010000111000111011101101110000110110001010100001010100100111000100011011011000110001110110100000000100001011110100001000000" "0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" "0000000100111011111010100101010100101001100001000011000100010111101110100000101010001100000110011010010001100011000100100000001010101000001111001101010110111000100011101000000000100010111110100011000111000111010000101000101010101010100001011000110000000000000000000000000000000000000000000000000000" "0010111011000100000100011000000001010110011110111100111011101000010001011111000000110011111001100101101110011100111011001111110000010111110000110010101001000111011100010111111111001101000001011100111000111000101111010011000000000101011110100111000010000000000000000000000000000000000000000000000000" }, - /* 45*/ { BARCODE_DBAR_EXPSTK, -1, 7, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 0, 5, 347, 1, "Example with 22 chars, 1 full row, bottom 8 chars", + /* 45*/ { BARCODE_DBAR_EXPSTK, -1, 7, -1, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 0, 5, 347, 1, "Example with 22 chars, 1 full row, bottom 8 chars", "01010101111011111110111111110000101100100000010100010011111000101110101111000000001000111101001100010111100010110111100011111100001010100110001110000101001110000010001011110000001110001110001000100100011110010011101000111100000010110001110111001001001110011100010010111111110011101000010111101111011101100010000010001100000000101011001111011110010" "00001010000100000001000000001010010011011111101011101100000111010001010000101010100111000010110011101000011101001000010100000010100101011001110001111010110001111101110100001010100001110001110111011011100001101100010101000010101001001110001000110110110001100011101101000000001000010111101000010000100010011101111101010010101010010100110000100000000" "00000101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000" "00000100010111101110100000101010001100000110011010010001100011000100100000001010101000001111001101010110111000100011101000000000100010111110100011000111000111010000101000101010101010100001011000110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" "10111011101000010001011111000000110011111001100101101110011100111011001111110000010111110000110010101001000111011100010111111111001101000001011100111000111000101111010011000000000101011110100111000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" }, - /* 46*/ { BARCODE_DBAR_EXPSTK, -1, 8, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 0, 5, 396, 1, "Example with 22 chars, 1 full row, bottom 6 chars", + /* 46*/ { BARCODE_DBAR_EXPSTK, -1, 8, -1, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 0, 5, 396, 1, "Example with 22 chars, 1 full row, bottom 6 chars", "010101011110111111101111111100001011001000000101000100111110001011101011110000000010001111010011000101111000101101111000111111000010101001100011100001010011100000100010111100000011100011100010001001000111100100111010001111000000101100011101110010010011100111000100101111111100111010000101111011110111011000100000100011000000001010110011110111100111011101000010001011111000000110011111001100101101" "000010100001000000010000000010100100110111111010111011000001110100010100001010101001110000101100111010000111010010000101000000101001010110011100011110101100011111011101000010101000011100011101110110111000011011000101010000101010010011100010001101101100011000111011010000000010000101111010000100001000100111011111010100101010100101001100001000011000100010111101110100000101010001100000110011010000" "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" "000000011000110001001000000010101010000011110011010101101110001000111010000000001000101111101000110001110001110100001010001010101010101000010110001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" "001011100111001110110011111100000101111100001100101010010001110111000101111111110011010000010111001110001110001011110100110000000001010111101001110000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" }, - /* 47*/ { BARCODE_DBAR_EXPSTK, -1, 9, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 0, 5, 445, 1, "Example with 22 chars, 1 full row, bottom 4 chars", + /* 47*/ { BARCODE_DBAR_EXPSTK, -1, 9, -1, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 0, 5, 445, 1, "Example with 22 chars, 1 full row, bottom 4 chars", "0101010111101111111011111111000010110010000001010001001111100010111010111100000000100011110100110001011110001011011110001111110000101010011000111000010100111000001000101111000000111000111000100010010001111001001110100011110000001011000111011100100100111001110001001011111111001110100001011110111101110110001000001000110000000010101100111101111001110111010000100010111110000001100111110011001011011100111001110110011111100000101111100001100101010" "0000101000010000000100000000101001001101111110101110110000011101000101000010101010011100001011001110100001110100100001010000001010010101100111000111101011000111110111010000101010000111000111011101101110000110110001010100001010100100111000100011011011000110001110110100000000100001011110100001000010001001110111110101001010101001010011000010000110001000101111011101000001010100011000001100110100100011000110001001000000010101010000011110011010000" "0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000" "0000101110001000111010000000001000101111101000110001110001110100001010001010101010101000010110001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" "1010010001110111000101111111110011010000010111001110001110001011110100110000000001010111101001110000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" }, - /* 48*/ { BARCODE_DBAR_EXPSTK, -1, 10, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 0, 5, 494, 1, "Example with 22 chars, 1 full row, bottom 2 chars", + /* 48*/ { BARCODE_DBAR_EXPSTK, -1, 10, -1, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 0, 5, 494, 1, "Example with 22 chars, 1 full row, bottom 2 chars", "01010101111011111110111111110000101100100000010100010011111000101110101111000000001000111101001100010111100010110111100011111100001010100110001110000101001110000010001011110000001110001110001000100100011110010011101000111100000010110001110111001001001110011100010010111111110011101000010111101111011101100010000010001100000000101011001111011110011101110100001000101111100000011001111100110010110111001110011101100111111000001011111000011001010100100011101110001011111111100110100000101110011101" "00001010000100000001000000001010010011011111101011101100000111010001010000101010100111000010110011101000011101001000010100000010100101011001110001111010110001111101110100001010100001110001110111011011100001101100010101000010101001001110001000110110110001100011101101000000001000010111101000010000100010011101111101010010101010010100110000100001100010001011110111010000010101000110000011001101001000110001100010010000000101010100000111100110101011011100010001110100000000010001011111010001100000" "00000101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" "00000100011101000010100010101010101010000101100011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" "00100011100010111101001100000000010101111010011100001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" }, - /* 49*/ { BARCODE_DBAR_EXPSTK, -1, 11, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 0, 1, 543, 1, "Example with 22 chars, 1 row", + /* 49*/ { BARCODE_DBAR_EXPSTK, -1, 11, -1, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 0, 1, 543, 1, "Example with 22 chars, 1 row", "010101011110111111101111111100001011001000000101000100111110001011101011110000000010001111010011000101111000101101111000111111000010101001100011100001010011100000100010111100000011100011100010001001000111100100111010001111000000101100011101110010010011100111000100101111111100111010000101111011110111011000100000100011000000001010110011110111100111011101000010001011111000000110011111001100101101110011100111011001111110000010111110000110010101001000111011100010111111111001101000001011100111000111000101111010011000000000101011110100111000010" }, - /* 50*/ { BARCODE_DBAR_EXPSTK, -1, 1, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 0, 41, 53, 1, "Example with 22 chars, 11 rows", + /* 50*/ { BARCODE_DBAR_EXPSTK, -1, 1, -1, "[91]12345678901234567890123456789012345678901234567890123456789012345678", 0, 41, 53, 1, "Example with 22 chars, 11 rows", "01010101111011111110111111110000101100100000010100010" "00001010000100000001000000001010010011011111101010000" "00000101010101010101010101010101010101010101010100000" @@ -586,14 +587,14 @@ static void test_examples(int index, int generate, int debug) { "00001000111010000101000101010101010100001011000110000" "01000111000101111010011000000000101011110100111000010" }, - /* 51*/ { BARCODE_DBAR_EXPSTK, -1, 6, "[01]98898765432106[3202]012345[15]991231[3203]001234[17]010203", 0, 5, 298, 1, "#200 Daniel Gredler mostly empty last row, 16 chars, 2 rows, bottom row 4 chars", + /* 51*/ { BARCODE_DBAR_EXPSTK, -1, 6, -1, "[01]98898765432106[3202]012345[15]991231[3203]001234[17]010203", 0, 5, 298, 1, "#200 Daniel Gredler mostly empty last row, 16 chars, 2 rows, bottom row 4 chars", "0100011101110001011011111111000010110000100101111101101000000110001010111100000000101001110000001001010011111011100110001111110000101110101000011000011010011100011000101111000000111001111000111101010111110010110000100011110000001010110010000010000111011111000100101011111100001110011110011000100101" "0000100010001110100100000000101001001111011010000010010111111001110101000010101010010110001111110110101100000100011001010000001010010001010111100111100101100011100111010000101010000110000111000010101000001101001111010100001010100101001101111101111000100000111011010100000010100001100001100111010000" "0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" "0000110000010010011000010000000010111110011010001001111010011011100010010101010010101110100011111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" "1010001111101101100111001111111101000001100101110110000101100100011101000000001100010001011100000110100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" }, - /* 52*/ { BARCODE_DBAR_EXPSTK, -1, 3, "[01]98898765432106[3202]012345[15]991231[3203]001234[17]010203", 0, 9, 151, 1, "#200 16 chars, 3 rows, bottom row 4 chars", + /* 52*/ { BARCODE_DBAR_EXPSTK, -1, 3, -1, "[01]98898765432106[3202]012345[15]991231[3203]001234[17]010203", 0, 9, 151, 1, "#200 16 chars, 3 rows, bottom row 4 chars", "0100011101110001011011111111000010110000100101111101101000000110001010111100000000101001110000001001010011111011100110001111110000101110101000011000010" "0000100010001110100100000000101001001111011010000010010111111001110101000010101010010110001111110110101100000100011001010000001010010001010111100110000" "0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000" @@ -604,173 +605,201 @@ static void test_examples(int index, int generate, int debug) { "0000011111000101110101001010101001000111011001011110010001011001111101000000001000011001001000001100000000000000000000000000000000000000000000000000000" "0101100000111010001000110000000010111000100110100001101110100110000010111111110011100110110111110001010000000000000000000000000000000000000000000000000" }, - /* 53*/ { BARCODE_DBAR_EXPSTK, -1, 4, "[01]98898765432106[3202]012345[15]991231[3203]001234[17]010203", 0, 5, 200, 1, "#200 16 chars, 2 full rows", + /* 53*/ { BARCODE_DBAR_EXPSTK, -1, 4, -1, "[01]98898765432106[3202]012345[15]991231[3203]001234[17]010203", 0, 5, 200, 1, "#200 16 chars, 2 full rows", "01000111011100010110111111110000101100001001011111011010000001100010101111000000001010011100000010010100111110111001100011111100001011101010000110000110100111000110001011110000001110011110001111010101" "00001000100011101001000000001010010011110110100000100101111110011101010000101010100101100011111101101011000001000110010100000010100100010101111001111001011000111001110100001010100001100001110000100000" "00000101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" "00001100000100100110000100000000101111100110100010011110100110111000100101010100101011101000111110010110111001100001100001010000001010110111000001000111101111101100101001010100001010111100101100000000" "10100011111011011001110011111111010000011001011101100001011001000111010000000011000100010111000001101001000110011110011100001111110101001000111110111000010000010011010100000011110001000011010011111010" }, - /* 54*/ { BARCODE_DBAR_EXPSTK, -1, 5, "[01]98898765432106[3202]012345[15]991231[3203]001234[17]010203", 0, 5, 249, 1, "#200 16 chars, 2 rows, bottom row 6 chars", + /* 54*/ { BARCODE_DBAR_EXPSTK, -1, 5, -1, "[01]98898765432106[3202]012345[15]991231[3203]001234[17]010203", 0, 5, 249, 1, "#200 16 chars, 2 rows, bottom row 6 chars", "010001110111000101101111111100001011000010010111110110100000011000101011110000000010100111000000100101001111101110011000111111000010111010100001100001101001110001100010111100000011100111100011110101011111001011000010001111000000101011001000001000010" "000010001000111010010000000010100100111101101000001001011111100111010100001010101001011000111111011010110000010001100101000000101001000101011110011110010110001110011101000010101000011000011100001010100000110100111101010000101010010100110111110110000" "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000" "000001000001110110101000000101000011000011001110110100111110001011101010010101010010001110110010111100100010110011111010000000010000110010010000011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" "101110111110001001010111111000011100111100110001001011000001110100010001100000000101110001001101000011011101001100000101111111100111001101101111100010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" }, - /* 55*/ { BARCODE_DBAR_EXPSTK, -1, 7, "[01]98898765432106[3202]012345[15]991231[3203]001234[17]010203", 0, 5, 347, 1, "#200 16 chars, 2 rows, bottom row 2 chars", + /* 55*/ { BARCODE_DBAR_EXPSTK, -1, 7, -1, "[01]98898765432106[3202]012345[15]991231[3203]001234[17]010203", 0, 5, 347, 1, "#200 16 chars, 2 rows, bottom row 2 chars", "01000111011100010110111111110000101100001001011111011010000001100010101111000000001010011100000010010100111110111001100011111100001011101010000110000110100111000110001011110000001110011110001111010101111100101100001000111100000010101100100000100001110111110001001010111111000011100111100110001001011000001110100010001100000000101110001001101000010" "00001000100011101001000000001010010011110110100000100101111110011101010000101010100101100011111101101011000001000110010100000010100100010101111001111001011000111001110100001010100001100001110000101010000011010011110101000010101001010011011111011110001000001110110101000000101000011000011001110110100111110001011101010010101010010001110110010110000" "00000101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000" "00001000101100111110100000000100001100100100000110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" "10110111010011000001011111111001110011011011111000101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" }, - /* 56*/ { BARCODE_DBAR_EXPSTK, -1, 8, "[01]98898765432106[3202]012345[15]991231[3203]001234[17]010203", 0, 1, 396, 1, "#200 16 chars, 1 row", + /* 56*/ { BARCODE_DBAR_EXPSTK, -1, 8, -1, "[01]98898765432106[3202]012345[15]991231[3203]001234[17]010203", 0, 1, 396, 1, "#200 16 chars, 1 row", "010001110111000101101111111100001011000010010111110110100000011000101011110000000010100111000000100101001111101110011000111111000010111010100001100001101001110001100010111100000011100111100011110101011111001011000010001111000000101011001000001000011101111100010010101111110000111001111001100010010110000011101000100011000000001011100010011010000110111010011000001011111111001110011011011111000101" }, - /* 57*/ { BARCODE_DBAR_EXP, -1, -1, "[01]00012345678905[10]ABC123", 0, 1, 232, 1, "24724:2011 7.2.5.4.1, encoding method 1 '1'", + /* 57*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]00012345678905[10]ABC123", 0, 1, 232, 1, "24724:2011 7.2.5.4.1, encoding method 1 '1'", "0100011000001011011011111111000010110011000010111101011110011011111010111110000001100010110000110111000111101101011110001111110000101110001100100001010011101111110110101111111100111001011011111101110011011100101111100011110000001010" }, - /* 58*/ { BARCODE_DBAR_EXP, -1, -1, "[01]90012345678908[3103]001750", 0, 1, 151, 1, "24724:2011 7.2.5.4.2, encoding method 3 '0100'", + /* 58*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3103]001750", 0, 1, 151, 1, "24724:2011 7.2.5.4.2, encoding method 3 '0100'", "0101110010000010011011111111000010111000010011000101011110111001100010111100000011100101110001110111011110101111000110001111110000101011000010011111010" }, - /* 59*/ { BARCODE_DBAR_EXP, -1, -1, "[01]90012345678908[3103]032767", 0, 1, 151, 1, "Encoding method 3 '0100' with weight = 32767", + /* 59*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3103]032767", 0, 1, 151, 1, "Encoding method 3 '0100' with weight = 32767", "0101001000111000011011111111000010111000010011000101011110111001100010111100000011100101110001110111011110111011000110001111110000101101111101110111010" }, - /* 60*/ { BARCODE_DBAR_EXP, -1, -1, "[01]90012345678908[3103]032768", 0, 1, 200, 1, "Possible encoding method 3 '0100' but weight > 32767 so encoding method 7 '0111000' with dummy date", + /* 60*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3103]032768", 0, 1, 200, 1, "Possible encoding method 3 '0100' but weight > 32767 so encoding method 7 '0111000' with dummy date", "01001100000101001110111111110000101000110111000010010111100110111110101111110000111000101100001101110001111011010111100011111100001011000110100110000110100000100110001011111111001110011001111010000101" }, - /* 61*/ { BARCODE_DBAR_EXP, -1, -1, "[01]90012345678908[3202]000156", 0, 1, 151, 1, "24724:2011 7.2.5.4.3, encoding method 4 '0101'", + /* 61*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3202]000156", 0, 1, 151, 1, "24724:2011 7.2.5.4.3, encoding method 4 '0101'", "0101001000111100001011111111000010100111000100001101011110111001100010111100000011100101110001110111011110101111000110001111110000101100001000001010010" }, - /* 62*/ { BARCODE_DBAR_EXP, -1, -1, "[01]90012345678908[3202]009999", 0, 1, 151, 1, "Encoding method 4 '0101' with weight = 9999", + /* 62*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3202]009999", 0, 1, 151, 1, "Encoding method 4 '0101' with weight = 9999", "0101110001000100011011111111000010100111000100001101011110111001100010111100000011100101110001110111011110110100011110001111110000101100111110010001010" }, - /* 63*/ { BARCODE_DBAR_EXP, -1, -1, "[01]90012345678908[3202]010000", 0, 1, 200, 1, "Possible encoding method 4 '0101' but weight > 9999 so encoding method 8 with dummy date", + /* 63*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3202]010000", 0, 1, 200, 1, "Possible encoding method 4 '0101' but weight > 9999 so encoding method 8 with dummy date", "01001000101110000110111111110000101110100011000010010111100110111110101111110000111000101100001101110001111011010111100011111100001010000011101001100111101101001110001011111111001110011001111010000101" }, - /* 64*/ { BARCODE_DBAR_EXP, -1, -1, "[01]90012345678908[3203]022767", 0, 1, 151, 1, "Encoding method 4 '0101' with weight = 22767", + /* 64*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3203]022767", 0, 1, 151, 1, "Encoding method 4 '0101' with weight = 22767", "0101110010011000001011111111000010100111000100001101011110111001100010111100000011100101110001110111011110111011000110001111110000101101111101110111010" }, - /* 65*/ { BARCODE_DBAR_EXP, -1, -1, "[01]90012345678908[3203]022768", 0, 1, 200, 1, "Possible encoding method 4 '0101' but weight > 22767 so encoding method 8 with dummy date", + /* 65*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3203]022768", 0, 1, 200, 1, "Possible encoding method 4 '0101' but weight > 22767 so encoding method 8 with dummy date", "01000110111000100010111111110000101110100011000010010111100110111110101111110000111000101100001101110001111011010111100011111100001010011100010110000100001101000001101011111111001110011001111010000101" }, - /* 66*/ { BARCODE_DBAR_EXP, -1, -1, "[01]90012345678908[3922]795", 0, 1, 183, 1, "24724:2011 7.2.5.4.5, encoding method 5 '01100XX', no following AIs", + /* 66*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3922]795", 0, 1, 183, 1, "24724:2011 7.2.5.4.5, encoding method 5 '01100XX', no following AIs", "010110000010001011101111111100001010011100000101100101111001101111101011111100001110001011000011011100011110110101111000111111000010100111101110100001100011011100100010111111110011101" }, - /* 67*/ { BARCODE_DBAR_EXP, -1, -1, "[01]90012345678908[3922]795[20]01", 0, 1, 200, 1, "Encoding method 5 '01100XX' with following AI", + /* 67*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3922]795[20]01", 0, 1, 200, 1, "Encoding method 5 '01100XX' with following AI", "01000110110000110010111111110000101111000100001010010111100110111110101111110000111000101100001101110001111011010111100011111100001010011110111010000110001110001011001011111111001110100111110001110101" }, - /* 68*/ { BARCODE_DBAR_EXP, -1, -1, "[01]90012345678908[3932]0081234", 0, 1, 200, 1, "24724:2011 7.2.5.4.6, encoding method 6 '01101XX', no following AIs", + /* 68*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3932]0081234", 0, 1, 200, 1, "24724:2011 7.2.5.4.6, encoding method 6 '01101XX', no following AIs", "01001110000101100010111111110000101110100000110010010111100110111110101111110000111000101100001101110001111011010111100011111100001011000011010111100100111110001011101011111111001110001101111001011101" }, - /* 69*/ { BARCODE_DBAR_EXP, -1, -1, "[01]90012345678908[3932]0081234[20]01", 0, 1, 232, 1, "Encoding method 6 '01101XX' with following AI", + /* 69*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3932]0081234[20]01", 0, 1, 232, 1, "Encoding method 6 '01101XX' with following AI", "0100001101000100111011111111000010110000101000111001011110011011111010111110000001100010110000110111000111101101011110001111110000101100001101011110010011111000101110101111111100111000100110011110010011101111001000100011110000001010" }, - /* 70*/ { BARCODE_DBAR_EXP, -1, -1, "[01]90012345678908[3932]A401234", ZINT_WARN_NONCOMPLIANT, 1, 232, 0, "Possible encoding method 6 '01101XX' but invalid currency code so encoding method 1; BWIPP no check (craps out)", + /* 70*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3932]A401234", ZINT_WARN_NONCOMPLIANT, 1, 232, 0, "Possible encoding method 6 '01101XX' but invalid currency code so encoding method 1; BWIPP no check (craps out)", "0100011000010011011011111111000010100100011111001101011110011011111010111110000001100010110000110111000111101101011110001111110000101100011001111001010001011011000000101111111100111001101011111110110001111001001110100011110000001010" }, - /* 71*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, "[01]90012345678908[3932]A401234", 0, 1, 232, 0, "Possible encoding method 6 '01101XX' but invalid currency code so encoding method 1; BWIPP no check (craps out)", + /* 71*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, -1, "[01]90012345678908[3932]A401234", 0, 1, 232, 0, "Possible encoding method 6 '01101XX' but invalid currency code so encoding method 1; BWIPP no check (craps out)", "0100011000010011011011111111000010100100011111001101011110011011111010111110000001100010110000110111000111101101011110001111110000101100011001111001010001011011000000101111111100111001101011111110110001111001001110100011110000001010" }, - /* 72*/ { BARCODE_DBAR_EXP, -1, -1, "[01]90012345678908[3102]099999[11]201209", 0, 1, 200, 1, "Encoding method 7 '0111000' with weight <= 99999 and valid date", + /* 72*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3102]099999[11]201209", 0, 1, 200, 1, "Encoding method 7 '0111000' with weight <= 99999 and valid date", "01000101111001000010111111110000101000110111000010010111100110111110101111110000111000101100001101110001111011010111100011111100001010111100100001000100000011100101001011111111001110010000100100011101" }, - /* 73*/ { BARCODE_DBAR_EXP, -1, -1, "[01]90012345678908[3102]099999", 0, 1, 200, 1, "Encoding method 7 '0111000' with weight <= 99999 but no date", + /* 73*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3102]099999", 0, 1, 200, 1, "Encoding method 7 '0111000' with weight <= 99999 but no date", "01000111011000010010111111110000101000110111000010010111100110111110101111110000111000101100001101110001111011010111100011111100001010111100100001000110100100011000001011111111001110011001111010000101" }, - /* 74*/ { BARCODE_DBAR_EXP, -1, -1, "[01]90012345678908[3102]100000[11]201209", 0, 1, 281, 1, "Possible encoding method 7 '0111000' but weight > 99999 so encoding method 1", + /* 74*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3102]100000[11]201209", 0, 1, 281, 1, "Possible encoding method 7 '0111000' but weight > 99999 so encoding method 1", "01010011110001110010111111110000101001000111110011010111100110111110101111100000011000101100001101110001111011010111100011111100001010010110001110000110010000011110101011111111001110000011100110101100001001110100011000110000000010100101100000100001011100011001111010111111111001101" }, - /* 75*/ { BARCODE_DBAR_EXP, -1, -1, "[01]90012345678908[3102]099999[11]200000", ZINT_WARN_NONCOMPLIANT, 1, 281, 0, "Possible encoding method 7 '0111000' with weight <= 99999 but date invalid so encoding method 1; BWIPP requires `dontlint` (GS1NOCHECK_MODE)", + /* 75*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3102]099999[11]200000", ZINT_WARN_NONCOMPLIANT, 1, 281, 0, "Possible encoding method 7 '0111000' with weight <= 99999 but date invalid so encoding method 1; BWIPP requires `dontlint` (GS1NOCHECK_MODE)", "01011001110001001110111111110000101001000111110011010111100110111110101111100000011000101100001101110001111011010111100011111100001010010110001110000110010011110100001011111111001110110011100010111100001001110100011000110000000010101100001000000101010111101111110010111111111001101" }, - /* 76*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, "[01]90012345678908[3102]099999[11]200000", 0, 1, 281, 1, "Possible encoding method 7 '0111000' with weight <= 99999 but date invalid so encoding method 1", + /* 76*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, -1, "[01]90012345678908[3102]099999[11]200000", 0, 1, 281, 1, "Possible encoding method 7 '0111000' with weight <= 99999 but date invalid so encoding method 1", "01011001110001001110111111110000101001000111110011010111100110111110101111100000011000101100001101110001111011010111100011111100001010010110001110000110010011110100001011111111001110110011100010111100001001110100011000110000000010101100001000000101010111101111110010111111111001101" }, - /* 77*/ { BARCODE_DBAR_EXP, -1, -1, "[01]90012345678908[3201]099999[11]201209", 0, 1, 200, 1, "Encoding method 8 '0111001' with weight <= 99999 and valid date", + /* 77*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3201]099999[11]201209", 0, 1, 200, 1, "Encoding method 8 '0111001' with weight <= 99999 and valid date", "01001000001101001110111111110000101110100011000010010111100110111110101111110000111000101100001101110001111011010111100011111100001011000100001101100111010111001110001011111111001110010000100100011101" }, - /* 78*/ { BARCODE_DBAR_EXP, -1, -1, "[01]90012345678908[3201]099999", 0, 1, 200, 1, "Encoding method 8 '0111001' with weight <= 99999 but no date", + /* 78*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3201]099999", 0, 1, 200, 1, "Encoding method 8 '0111001' with weight <= 99999 but no date", "01000101110010000110111111110000101110100011000010010111100110111110101111110000111000101100001101110001111011010111100011111100001011000100001101100111010000111011101011111111001110011001111010000101" }, - /* 79*/ { BARCODE_DBAR_EXP, -1, -1, "[01]90012345678908[3201]100000[11]201209", 0, 1, 281, 1, "Possible encoding method 8 '0111001' but weight > 99999 so encoding method 1", + /* 79*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3201]100000[11]201209", 0, 1, 281, 1, "Possible encoding method 8 '0111001' but weight > 99999 so encoding method 1", "01011101100011000110111111110000101001000111110011010111100110111110101111100000011000101100001101110001111011010111100011111100001011101010000110000111011110001100101011111111001110000011100110101100001001110100011000110000000010100101100000100001011100011001111010111111111001101" }, - /* 80*/ { BARCODE_DBAR_EXP, -1, -1, "[01]90012345678908[3201]099999[11]000000", ZINT_WARN_NONCOMPLIANT, 1, 281, 0, "Possible encoding method 8 '0111001' but date invalid so encoding method 1; BWIPP requires `dontlint` (GS1NOCHECK_MODE)", + /* 80*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3201]099999[11]000000", ZINT_WARN_NONCOMPLIANT, 1, 281, 0, "Possible encoding method 8 '0111001' but date invalid so encoding method 1; BWIPP requires `dontlint` (GS1NOCHECK_MODE)", "01011110100001001110111111110000101001000111110011010111100110111110101111100000011000101100001101110001111011010111100011111100001011101010000110000111000011110101101011111111001110110011100010111100001110100001011000110000000010101100001000000101010111101111110010111111111001101" }, - /* 81*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, "[01]90012345678908[3201]099999[11]000000", 0, 1, 281, 1, "Possible encoding method 8 '0111001' but date invalid so encoding method 1", + /* 81*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, -1, "[01]90012345678908[3201]099999[11]000000", 0, 1, 281, 1, "Possible encoding method 8 '0111001' but date invalid so encoding method 1", "01011110100001001110111111110000101001000111110011010111100110111110101111100000011000101100001101110001111011010111100011111100001011101010000110000111000011110101101011111111001110110011100010111100001110100001011000110000000010101100001000000101010111101111110010111111111001101" }, - /* 82*/ { BARCODE_DBAR_EXP, -1, -1, "[01]90012345678908[3100]099999[13]201209", 0, 1, 200, 1, "Encoding method 9 '0111010' with weight <= 99999 and valid date", + /* 82*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3100]099999[13]201209", 0, 1, 200, 1, "Encoding method 9 '0111010' with weight <= 99999 and valid date", "01001000001101001110111111110000101111001010000010010111100110111110101111110000111000101100001101110001111011010111100011111100001011000111000001010111010000110110001011111111001110010000100100011101" }, - /* 83*/ { BARCODE_DBAR_EXP, -1, -1, "[01]90012345678908[3204]099999[13]201209", 0, 1, 200, 1, "Encoding method 10 '0111011' with weight <= 99999 and valid date", + /* 83*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3204]099999[13]201209", 0, 1, 200, 1, "Encoding method 10 '0111011' with weight <= 99999 and valid date", "01001000111000010110111111110000101100101000001110010111100110111110101111110000111000101100001101110001111011010111100011111100001010011101000011110101110000101111101011111111001110010000100100011101" }, - /* 84*/ { BARCODE_DBAR_EXP, -1, -1, "[01]90012345678908[3103]012233[15]991231", 0, 1, 200, 1, "24724:2011 7.2.5.4.4, encoding method 11 '0111100' with weight <= 99999 and valid date", + /* 84*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3103]012233[15]991231", 0, 1, 200, 1, "24724:2011 7.2.5.4.4, encoding method 11 '0111100' with weight <= 99999 and valid date", "01001100000100111010111111110000101011100100000110010111100110111110101111110000111000101100001101110001111011010111100011111100001011000011010110000111001100110001001011111111001110001101111010000101" }, - /* 85*/ { BARCODE_DBAR_EXP, -1, -1, "[01]90012345678908[3205]099999[15]201209", 0, 1, 200, 1, "Encoding method 12 '0111101' with weight <= 99999 and valid date", + /* 85*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3205]099999[15]201209", 0, 1, 200, 1, "Encoding method 12 '0111101' with weight <= 99999 and valid date", "01001110000010011010111111110000101000001101110100010111100110111110101111110000111000101100001101110001111011010111100011111100001011110011010001100101001100011000001011111111001110010000100100011101" }, - /* 86*/ { BARCODE_DBAR_EXP, -1, -1, "[01]90012345678908[3105]099999[17]201209", 0, 1, 200, 1, "Encoding method 13 '0111110' with weight <= 99999 and valid date", + /* 86*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3105]099999[17]201209", 0, 1, 200, 1, "Encoding method 13 '0111110' with weight <= 99999 and valid date", "01000111010000110010111111110000101110000100110100010111100110111110101111110000111000101100001101110001111011010111100011111100001011110011010001100101001100011000001011111111001110010000100100011101" }, - /* 87*/ { BARCODE_DBAR_EXP, -1, -1, "[01]90012345678908[3200]099999[17]201209", 0, 1, 200, 1, "Encoding method 14 '0111111' with weight <= 99999 and valid date", + /* 87*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]90012345678908[3200]099999[17]201209", 0, 1, 200, 1, "Encoding method 14 '0111111' with weight <= 99999 and valid date", "01001110000010100110111111110000101111000100010100010111100110111110101111110000111000101100001101110001111011010111100011111100001011000111000001010111010000110110001011111111001110010000100100011101" }, - /* 88*/ { BARCODE_DBAR_EXPSTK, -1, 4, "[8110]106141416543213500110000310123196000", 0, 5, 200, 1, "North American Coupon Application Guideline (NACAG) Figure 1 (& Appendix C: Example 6)", + /* 88*/ { BARCODE_DBAR_EXPSTK, -1, 4, -1, "[8110]106141416543213500110000310123196000", 0, 5, 200, 1, "North American Coupon Application Guideline (NACAG) Figure 1 (& Appendix C: Example 6)", "01001100101110001110111111110000101000001101000001010111100110111000101111100000011011010001000000110000111100001010100011111100001010000010101111000111010000011001101011111111001110000001101101000101" "00000011010001110001000000001010010111110010111110101000011001000111010000010101000100101110111111001111000011110101010100000010100101111101010000111000101111100110010100000000100001111110010010110000" "00000101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" "00000100010110000110100000001010101010111100111101110010110001110011101000000000100010000011010010000100011110111011001000101010101010011101111111010000000000000000000000000000000000000000000000000000" "00100011101001111001001111110000010101000011000010001101001110001100010111111111001101111100101101111011100001000100110011000000000101100010000000101010000000000000000000000000000000000000000000000000" }, - /* 89*/ { BARCODE_DBAR_EXPSTK, -1, 3, "[8110]10614141011111275110111", 0, 5, 151, 1, "NACAG Figure 3", + /* 89*/ { BARCODE_DBAR_EXPSTK, -1, -1, 2, "[8110]106141416543213500110000310123196000", 0, 5, 200, 1, "NACAG Figure 1 (& Appendix C: Example 6) specifying max rows", + "01001100101110001110111111110000101000001101000001010111100110111000101111100000011011010001000000110000111100001010100011111100001010000010101111000111010000011001101011111111001110000001101101000101" + "00000011010001110001000000001010010111110010111110101000011001000111010000010101000100101110111111001111000011110101010100000010100101111101010000111000101111100110010100000000100001111110010010110000" + "00000101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" + "00000100010110000110100000001010101010111100111101110010110001110011101000000000100010000011010010000100011110111011001000101010101010011101111111010000000000000000000000000000000000000000000000000000" + "00100011101001111001001111110000010101000011000010001101001110001100010111111111001101111100101101111011100001000100110011000000000101100010000000101010000000000000000000000000000000000000000000000000" + }, + /* 90*/ { BARCODE_DBAR_EXPSTK, -1, 3, -1, "[8110]10614141011111275110111", 0, 5, 151, 1, "NACAG Figure 3", "0101011110011100001011111111000010100000110100000101011110011011100010111110000001101101000100000011000011100001101010001111110000101010000011000111010" "0000100001100011110100000000101001011111001011111010100001100100011101000001010100010010111011111100111100011110010101010000001010010101111100111000000" "0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000" "0000001000100001011010000000010000111001101101100001100111100100100010100001010100100001101011111000000000000000000000000000000000000000000000000000000" "1011110111011110100101111111100111000110010010011110011000011011011100011110000001011110010100000100100000000000000000000000000000000000000000000000000" }, - /* 90*/ { BARCODE_DBAR_EXPSTK, -1, 6, "[8110]106141410222223100110222111101231023456721104561045678991201", 0, 5, 298, 1, "NACAG Figure 4", + /* 91*/ { BARCODE_DBAR_EXPSTK, -1, -1, 2, "[8110]10614141011111275110111", 0, 5, 151, 1, "NACAG Figure 3 specifying max rows", + "0101011110011100001011111111000010100000110100000101011110011011100010111110000001101101000100000011000011100001101010001111110000101010000011000111010" + "0000100001100011110100000000101001011111001011111010100001100100011101000001010100010010111011111100111100011110010101010000001010010101111100111000000" + "0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000" + "0000001000100001011010000000010000111001101101100001100111100100100010100001010100100001101011111000000000000000000000000000000000000000000000000000000" + "1011110111011110100101111111100111000110010010011110011000011011011100011110000001011110010100000100100000000000000000000000000000000000000000000000000" + }, + /* 92*/ { BARCODE_DBAR_EXPSTK, -1, 6, -1, "[8110]106141410222223100110222111101231023456721104561045678991201", 0, 5, 298, 1, "NACAG Figure 4", "0100101111101001111011111111000010110010000011001101011110011011100010111100000000101101000100000011000011100001101010001111110000101011000011100001010111000011011110101111000000111010011111000101110001110110011001100011110000001011100110000101000110101111110111001011111111001110011010011100001101" "0000010000010110000100000000101001001101111100110010100001100100011101000010101010010010111011111100111100011110010101010000001010010100111100011110101000111100100001010000101010000101100000111010001110001001100110010100001010100100011001111010111001010000001000110100000000100001100101100011110000" "0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" "0000011010011011100010100101010100100111000100000101010000111000110010100000101010001111000101110100011001110001101000100000001010101011011110000111010111110001101011101000000000100011110100100010000110101100111000001000101010101000000000000000000000000000000000000000000000000000000000000000000000" "0010000101100100011100011000000001011000111011111010101111000111001101011111000000110000111010001011100110001110010111001111110000010100100001111000101000001110010100010111111111001100001011011101111001010011000111110011000000000101000000000000000000000000000000000000000000000000000000000000000000" }, - /* 91*/ { BARCODE_DBAR_EXPSTK, -1, 5, "[8110]1061414165432131501101201211014092110256100126663101231", 0, 5, 249, 1, "NACAG Appendix C: Example 1", + /* 93*/ { BARCODE_DBAR_EXPSTK, -1, -1, 2, "[8110]106141410222223100110222111101231023456721104561045678991201", 0, 5, 298, 1, "NACAG Figure 4, specifying max rows", + "0100101111101001111011111111000010110010000011001101011110011011100010111100000000101101000100000011000011100001101010001111110000101011000011100001010111000011011110101111000000111010011111000101110001110110011001100011110000001011100110000101000110101111110111001011111111001110011010011100001101" + "0000010000010110000100000000101001001101111100110010100001100100011101000010101010010010111011111100111100011110010101010000001010010100111100011110101000111100100001010000101010000101100000111010001110001001100110010100001010100100011001111010111001010000001000110100000000100001100101100011110000" + "0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" + "0000011010011011100010100101010100100111000100000101010000111000110010100000101010001111000101110100011001110001101000100000001010101011011110000111010111110001101011101000000000100011110100100010000110101100111000001000101010101000000000000000000000000000000000000000000000000000000000000000000000" + "0010000101100100011100011000000001011000111011111010101111000111001101011111000000110000111010001011100110001110010111001111110000010100100001111000101000001110010100010111111111001100001011011101111001010011000111110011000000000101000000000000000000000000000000000000000000000000000000000000000000" + }, + /* 94*/ { BARCODE_DBAR_EXPSTK, -1, 5, -1, "[8110]1061414165432131501101201211014092110256100126663101231", 0, 5, 249, 1, "NACAG Appendix C: Example 1", "010111101100011011101111111100001011001000001100110101111001101110001011110000000010110100010000001100001111000010101000111111000010100000101011110001110100000110011010111100000011101001111000101111000111011001001110001111000000101011001000001110010" "000000010011100100010000000010100100110111110011001010000110010001110100001010101001001011101111110011110000111101010101000000101001011111010100001110001011111001100101000010101000010110000111010000111000100110110001010000101010010100110111110000000" "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000" "000001110000100101101000000101000011110100100011100111100001001101001010010101010010011111110101101100010010110011111010000010101000111101010000010001110001001100110010001010101010100011000111001011000010011010000010100000000010000000000000000000000" "101110001111011010010111111000011100001011011100011000011110110010110001100000000101100000001010010011101101001100000101111100000011000010101111101110001110110011001100110000000001011100111000110100111101100101111101011111111100110100000000000000000" }, - /* 92*/ { BARCODE_DBAR_EXPSTK, -1, 4, "[8110]106141410012342501106501013085093101231", 0, 5, 200, 1, "NACAG Appendix C: Example 2", + /* 95*/ { BARCODE_DBAR_EXPSTK, -1, -1, 2, "[8110]1061414165432131501101201211014092110256100126663101231", 0, 5, 249, 1, "NACAG Appendix C: Example 1, specifying max row", + "010111101100011011101111111100001011001000001100110101111001101110001011110000000010110100010000001100001111000010101000111111000010100000101011110001110100000110011010111100000011101001111000101111000111011001001110001111000000101011001000001110010" + "000000010011100100010000000010100100110111110011001010000110010001110100001010101001001011101111110011110000111101010101000000101001011111010100001110001011111001100101000010101000010110000111010000111000100110110001010000101010010100110111110000000" + "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000" + "000001110000100101101000000101000011110100100011100111100001001101001010010101010010011111110101101100010010110011111010000010101000111101010000010001110001001100110010001010101010100011000111001011000010011010000010100000000010000000000000000000000" + "101110001111011010010111111000011100001011011100011000011110110010110001100000000101100000001010010011101101001100000101111100000011000010101111101110001110110011001100110000000001011100111000110100111101100101111101011111111100110100000000000000000" + }, + /* 96*/ { BARCODE_DBAR_EXPSTK, -1, 4, -1, "[8110]106141410012342501106501013085093101231", 0, 5, 200, 1, "NACAG Appendix C: Example 2", "01001100101110001110111111110000101000001101000001010111100110111000101111100000011011010001000000110000111000011010100011111100001010000110011000110111001110000010101011111111001110011110010001100101" "00000011010001110001000000001010010111110010111110101000011001000111010000010101000100101110111111001111000111100101010100000010100101111001100111001000110001111101010100000000100001100001101110010000" "00000101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" "00000100100001001110100000001010101011111101001011110000110001001011101000000000100010111000110010000111011001101000001000101010101010011011001000010000000000000000000000000000000000000000000000000000" "00100011011110110001001111110000010100000010110100001111001110110100010111111111001101000111001101111000100110010111110011000000000101100100110111100010000000000000000000000000000000000000000000000000" }, - /* 93*/ { BARCODE_DBAR_EXPSTK, -1, 5, "[8110]106141410012471011076011110850921108609310123191000", 0, 5, 249, 1, "NACAG Appendix C: Example 3", + /* 97*/ { BARCODE_DBAR_EXPSTK, -1, 5, -1, "[8110]106141410012471011076011110850921108609310123191000", 0, 5, 249, 1, "NACAG Appendix C: Example 3", "010101111101111000101111111100001010000011000101000101111001101110001011110000000010110100010000001100001110000110101000111111000010100001100110001101001000010000111010111100000011100011100011011001011100001001101110001111000000101001100010000111010" "000010000010000111010000000010100101111100111010111010000110010001110100001010101001001011101111110011110001111001010101000000101001011110011001110010110111101111000101000010101000011100011100100110100011110110010001010000101010010110011101111000000" "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000" "000010000001000010101000000101000011110111011110110111101101011100001010010101010010101000011111011101111101110011001010000010101000101001111001110001000001100110001010000000101010100111111101101000000000000000000000000000000000000000000000000000000" "101001111110111101010111111000011100001000100001001000010010100011110001100000000101010111100000100010000010001100110101111100000011010110000110001110111110011001110100111111000001011000000010010100100000000000000000000000000000000000000000000000000" }, - /* 94*/ { BARCODE_DBAR_EXPSTK, -1, 6, "[8110]106141411234562891101201212085010048000214025610048000310123191000", 0, 5, 298, 1, "NACAG Appendix C: Example 4", + /* 98*/ { BARCODE_DBAR_EXPSTK, -1, 6, -1, "[8110]106141411234562891101201212085010048000214025610048000310123191000", 0, 5, 298, 1, "NACAG Appendix C: Example 4", "0100111111001110101011111111000010100000110001010001011110011011100010111100000000101101000100000011000011100001101010001111110000101010011000111000010101110001000000101111000000111001000001001110010011000011011101100011110000001010000010010110000100011001011000001011111111001110001110101100111101" "0000000000110001010100000000101001011111001110101110100001100100011101000010101010010010111011111100111100011110010101010000001010010101100111000111101010001110111111010000101010000110111110110001101100111100100010010100001010100101111101101001111011100110100111110100000000100001110001010011000000" "0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" "0000001110011100111010100101010100101001111011111101000100011101100010100000101010001110110010001000010111101100001110100000001010101000011101111010110010111110001001101000000000100011100001011000010111001010111000001000101010101010001111001001100000000000000000000000000000000000000000000000000000" "0010110001100011000100011000000001010110000100000010111011100010011101011111000000110001001101110111101000010011110001001111110000010111100010000101001101000001110110010111111111001100011110100111101000110101000111110011000000000101110000110110011010000000000000000000000000000000000000000000000000" }, - /* 95*/ { BARCODE_DBAR_EXPSTK, -1, 5, "[8110]1061414154321031501101201211014092110256100126663101231", 0, 5, 249, 1, "NACAG Appendix C: Example 5", + /* 99*/ { BARCODE_DBAR_EXPSTK, -1, 5, -1, "[8110]1061414154321031501101201211014092110256100126663101231", 0, 5, 249, 1, "NACAG Appendix C: Example 5", "010100111111010011101111111100001011001000001100110101111001101110001011110000000010110100010000001100001111000010101000111111000010101100100000001001100011101011000010111100000011101001111000101111000111011001001110001111000000101011001000001110010" "000011000000101100010000000010100100110111110011001010000110010001110100001010101001001011101111110011110000111101010101000000101001010011011111110110011100010100111101000010101000010110000111010000111000100110110001010000101010010100110111110000000" "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000" @@ -797,14 +826,15 @@ static void test_examples(int index, int generate, int debug) { symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); - length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug); + length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, data[i].option_3, -1 /*output_options*/, data[i].data, -1, debug); ret = ZBarcode_Encode(symbol, (const 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, %s, %d, \"%s\", %d, %d, %d, %d, \"%s\",\n", - i, testUtilBarcodeName(symbol->symbology), testUtilInputModeName(data[i].input_mode), data[i].option_2, + printf(" /*%3d*/ { %s, %s, %d, %d, \"%s\", %d, %d, %d, %d, \"%s\",\n", + i, testUtilBarcodeName(symbol->symbology), testUtilInputModeName(data[i].input_mode), + data[i].option_2, data[i].option_3, data[i].data, data[i].ret, symbol->rows, symbol->width, data[i].bwipp_cmp, data[i].comment); testUtilModulesPrint(symbol, " ", "\n"); printf(" },\n"); @@ -817,11 +847,11 @@ static void test_examples(int index, int generate, int debug) { ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row); assert_zero(ret, "i:%d %s testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, width, row, data[i].data); - if (do_bwipp && testUtilCanBwipp(i, symbol, -1, data[i].option_2, -1, debug)) { + if (do_bwipp && testUtilCanBwipp(i, symbol, -1, data[i].option_2, data[i].option_3, 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, -1, data[i].option_2, -1, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf)); + ret = testUtilBwipp(i, symbol, -1, data[i].option_2, data[i].option_3, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf)); 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); @@ -1247,6 +1277,7 @@ static void test_input(int index, int debug) { int symbology; int input_mode; int option_2; + int option_3; char *data; int ret; int expected_rows; @@ -1255,60 +1286,117 @@ static void test_input(int index, int debug) { }; // s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<")) struct item data[] = { - /* 0*/ { BARCODE_DBAR_OMN, -1, -1, "1234567890123", 0, 1, 96, "" }, - /* 1*/ { BARCODE_DBAR_OMN, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character in data (digits only)" }, - /* 2*/ { BARCODE_DBAR_OMN, GS1NOCHECK_MODE, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character in data (digits only)" }, - /* 3*/ { BARCODE_DBAR_OMN, -1, -1, "12345678901234", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '4', expecting '1'" }, - /* 4*/ { BARCODE_DBAR_OMN, GS1NOCHECK_MODE, -1, "12345678901234", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '4', expecting '1'" }, // Still checked - /* 5*/ { BARCODE_DBAR_OMN, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input too long (14 character maximum)" }, - /* 6*/ { BARCODE_DBAR_OMN, GS1NOCHECK_MODE, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input too long (14 character maximum)" }, - /* 7*/ { BARCODE_DBAR_LTD, -1, -1, "1234567890123", 0, 1, 79, "" }, - /* 8*/ { BARCODE_DBAR_LTD, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 383: Invalid character in data (digits only)" }, - /* 9*/ { BARCODE_DBAR_LTD, GS1NOCHECK_MODE, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 383: Invalid character in data (digits only)" }, - /* 10*/ { BARCODE_DBAR_LTD, -1, -1, "12345678901235", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 389: Invalid check digit '5', expecting '1'" }, - /* 11*/ { BARCODE_DBAR_LTD, GS1NOCHECK_MODE, -1, "12345678901235", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 389: Invalid check digit '5', expecting '1'" }, // Still checked - /* 12*/ { BARCODE_DBAR_LTD, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 382: Input too long (14 character maximum)" }, - /* 13*/ { BARCODE_DBAR_LTD, GS1NOCHECK_MODE, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 382: Input too long (14 character maximum)" }, - /* 14*/ { BARCODE_DBAR_LTD, -1, -1, "2234567890123", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 384: Input out of range (0 to 1999999999999)" }, - /* 15*/ { BARCODE_DBAR_LTD, GS1NOCHECK_MODE, -1, "2234567890123", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 384: Input out of range (0 to 1999999999999)" }, - /* 16*/ { BARCODE_DBAR_LTD, -1, -1, "22345678901238", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 384: Input out of range (0 to 1999999999999)" }, - /* 17*/ { BARCODE_DBAR_LTD, GS1NOCHECK_MODE, -1, "22345678901238", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 384: Input out of range (0 to 1999999999999)" }, - /* 18*/ { BARCODE_DBAR_EXP, -1, -1, "[01]12345678901234", ZINT_WARN_NONCOMPLIANT, 1, 134, "Warning 261: AI (01) position 14: Bad checksum '4', expected '1'" }, - /* 19*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, "[01]12345678901234", 0, 1, 134, "" }, - /* 20*/ { BARCODE_DBAR_EXP, -1, -1, "[01]12345678901231", 0, 1, 134, "" }, - /* 21*/ { BARCODE_DBAR_EXP, -1, -1, "[01]1234567890123A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 385: Invalid character in Compressed Field data (digits only)" }, - /* 22*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, "[01]1234567890123A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 385: Invalid character in Compressed Field data (digits only)" }, - /* 23*/ { BARCODE_DBAR_EXP, -1, -1, "[01]123456789012315", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 259: Invalid data length for AI (01)" }, - /* 24*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, "[01]123456789012315", 0, 1, 151, "" }, - /* 25*/ { BARCODE_DBAR_EXP, -1, -1, "[01]12345678901234", ZINT_WARN_NONCOMPLIANT, 1, 134, "Warning 261: AI (01) position 14: Bad checksum '4', expected '1'" }, - /* 26*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, "[01]12345678901234", 0, 1, 134, "" }, - /* 27*/ { BARCODE_DBAR_EXP, -1, -1, "[01]12345678901231[91]!\"%&'()*+,-./:;<=>?_ ", ZINT_WARN_NONCOMPLIANT, 1, 526, "Warning 261: AI (91) position 21: Invalid CSET 82 character ' '" }, // ISOIEC punc - /* 28*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, "[01]12345678901231[91]!\"%&'()*+,-./:;<=>?_ ", 0, 1, 526, "" }, - /* 29*/ { BARCODE_DBAR_EXP, -1, -1, "[01]12345678901231[91]!\"%&'()*+,-./:;<=>?_", 0, 1, 494, "" }, // ISOIEC punc less space - /* 30*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, "[01]12345678901231[91]!\"%&'()*+,-./:;<=>?_", 0, 1, 494, "" }, - /* 31*/ { BARCODE_DBAR_STK, -1, -1, "1234567890123", 0, 3, 50, "" }, - /* 32*/ { BARCODE_DBAR_STK, GS1NOCHECK_MODE, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character in data (digits only)" }, - /* 33*/ { BARCODE_DBAR_STK, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character in data (digits only)" }, - /* 34*/ { BARCODE_DBAR_STK, GS1NOCHECK_MODE, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character in data (digits only)" }, - /* 35*/ { BARCODE_DBAR_STK, -1, -1, "12345678901235", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '5', expecting '1'" }, - /* 36*/ { BARCODE_DBAR_STK, GS1NOCHECK_MODE, -1, "12345678901235", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '5', expecting '1'" }, // Still checked - /* 37*/ { BARCODE_DBAR_STK, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input too long (14 character maximum)" }, - /* 38*/ { BARCODE_DBAR_STK, GS1NOCHECK_MODE, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input too long (14 character maximum)" }, - /* 39*/ { BARCODE_DBAR_OMNSTK, -1, -1, "1234567890123", 0, 5, 50, "" }, - /* 40*/ { BARCODE_DBAR_OMNSTK, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character in data (digits only)" }, - /* 41*/ { BARCODE_DBAR_OMNSTK, GS1NOCHECK_MODE, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character in data (digits only)" }, - /* 42*/ { BARCODE_DBAR_OMNSTK, -1, -1, "12345678901236", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '6', expecting '1'" }, - /* 43*/ { BARCODE_DBAR_OMNSTK, GS1NOCHECK_MODE, -1, "12345678901236", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '6', expecting '1'" }, // Still checked - /* 44*/ { BARCODE_DBAR_OMNSTK, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input too long (14 character maximum)" }, - /* 45*/ { BARCODE_DBAR_OMNSTK, GS1NOCHECK_MODE, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input too long (14 character maximum)" }, - /* 46*/ { BARCODE_DBAR_EXPSTK, -1, -1, "[01]12345678901234", ZINT_WARN_NONCOMPLIANT, 5, 102, "Warning 261: AI (01) position 14: Bad checksum '4', expected '1'" }, - /* 47*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, -1, "[01]12345678901234", 0, 5, 102, "" }, - /* 48*/ { BARCODE_DBAR_EXPSTK, -1, -1, "[01]12345678901231", 0, 5, 102, "" }, - /* 49*/ { BARCODE_DBAR_EXPSTK, -1, -1, "[01]1234567890123A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 385: Invalid character in Compressed Field data (digits only)" }, - /* 50*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, -1, "[01]1234567890123A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 385: Invalid character in Compressed Field data (digits only)" }, - /* 51*/ { BARCODE_DBAR_EXPSTK, -1, -1, "[01]123456789012315", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 259: Invalid data length for AI (01)" }, - /* 52*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, -1, "[01]123456789012315", 0, 5, 102, "" }, - /* 53*/ { BARCODE_DBAR_EXPSTK, -1, 1, "[01]12345678901231", 0, 9, 53, "" }, + /* 0*/ { BARCODE_DBAR_OMN, -1, -1, -1, "1234567890123", 0, 1, 96, "" }, + /* 1*/ { BARCODE_DBAR_OMN, -1, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character in data (digits only)" }, + /* 2*/ { BARCODE_DBAR_OMN, GS1NOCHECK_MODE, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character in data (digits only)" }, + /* 3*/ { BARCODE_DBAR_OMN, -1, -1, -1, "12345678901234", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '4', expecting '1'" }, + /* 4*/ { BARCODE_DBAR_OMN, GS1NOCHECK_MODE, -1, -1, "12345678901234", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '4', expecting '1'" }, // Still checked + /* 5*/ { BARCODE_DBAR_OMN, -1, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input too long (14 character maximum)" }, + /* 6*/ { BARCODE_DBAR_OMN, GS1NOCHECK_MODE, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input too long (14 character maximum)" }, + /* 7*/ { BARCODE_DBAR_LTD, -1, -1, -1, "1234567890123", 0, 1, 79, "" }, + /* 8*/ { BARCODE_DBAR_LTD, -1, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 383: Invalid character in data (digits only)" }, + /* 9*/ { BARCODE_DBAR_LTD, GS1NOCHECK_MODE, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 383: Invalid character in data (digits only)" }, + /* 10*/ { BARCODE_DBAR_LTD, -1, -1, -1, "12345678901235", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 389: Invalid check digit '5', expecting '1'" }, + /* 11*/ { BARCODE_DBAR_LTD, GS1NOCHECK_MODE, -1, -1, "12345678901235", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 389: Invalid check digit '5', expecting '1'" }, // Still checked + /* 12*/ { BARCODE_DBAR_LTD, -1, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 382: Input too long (14 character maximum)" }, + /* 13*/ { BARCODE_DBAR_LTD, GS1NOCHECK_MODE, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 382: Input too long (14 character maximum)" }, + /* 14*/ { BARCODE_DBAR_LTD, -1, -1, -1, "2234567890123", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 384: Input out of range (0 to 1999999999999)" }, + /* 15*/ { BARCODE_DBAR_LTD, GS1NOCHECK_MODE, -1, -1, "2234567890123", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 384: Input out of range (0 to 1999999999999)" }, + /* 16*/ { BARCODE_DBAR_LTD, -1, -1, -1, "22345678901238", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 384: Input out of range (0 to 1999999999999)" }, + /* 17*/ { BARCODE_DBAR_LTD, GS1NOCHECK_MODE, -1, -1, "22345678901238", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 384: Input out of range (0 to 1999999999999)" }, + /* 18*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]12345678901234", ZINT_WARN_NONCOMPLIANT, 1, 134, "Warning 261: AI (01) position 14: Bad checksum '4', expected '1'" }, + /* 19*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, -1, "[01]12345678901234", 0, 1, 134, "" }, + /* 20*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]12345678901231", 0, 1, 134, "" }, + /* 21*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]1234567890123A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 385: Invalid character in Compressed Field data (digits only)" }, + /* 22*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, -1, "[01]1234567890123A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 385: Invalid character in Compressed Field data (digits only)" }, + /* 23*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]123456789012315", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 259: Invalid data length for AI (01)" }, + /* 24*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, -1, "[01]123456789012315", 0, 1, 151, "" }, + /* 25*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]12345678901234", ZINT_WARN_NONCOMPLIANT, 1, 134, "Warning 261: AI (01) position 14: Bad checksum '4', expected '1'" }, + /* 26*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, -1, "[01]12345678901234", 0, 1, 134, "" }, + /* 27*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]12345678901231[91]!\"%&'()*+,-./:;<=>?_ ", ZINT_WARN_NONCOMPLIANT, 1, 526, "Warning 261: AI (91) position 21: Invalid CSET 82 character ' '" }, // ISOIEC punc + /* 28*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, -1, "[01]12345678901231[91]!\"%&'()*+,-./:;<=>?_ ", 0, 1, 526, "" }, + /* 29*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]12345678901231[91]!\"%&'()*+,-./:;<=>?_", 0, 1, 494, "" }, // ISOIEC punc less space + /* 30*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, -1, "[01]12345678901231[91]!\"%&'()*+,-./:;<=>?_", 0, 1, 494, "" }, + /* 31*/ { BARCODE_DBAR_STK, -1, -1, -1, "1234567890123", 0, 3, 50, "" }, + /* 32*/ { BARCODE_DBAR_STK, GS1NOCHECK_MODE, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character in data (digits only)" }, + /* 33*/ { BARCODE_DBAR_STK, -1, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character in data (digits only)" }, + /* 34*/ { BARCODE_DBAR_STK, GS1NOCHECK_MODE, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character in data (digits only)" }, + /* 35*/ { BARCODE_DBAR_STK, -1, -1, -1, "12345678901235", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '5', expecting '1'" }, + /* 36*/ { BARCODE_DBAR_STK, GS1NOCHECK_MODE, -1, -1, "12345678901235", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '5', expecting '1'" }, // Still checked + /* 37*/ { BARCODE_DBAR_STK, -1, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input too long (14 character maximum)" }, + /* 38*/ { BARCODE_DBAR_STK, GS1NOCHECK_MODE, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input too long (14 character maximum)" }, + /* 39*/ { BARCODE_DBAR_OMNSTK, -1, -1, -1, "1234567890123", 0, 5, 50, "" }, + /* 40*/ { BARCODE_DBAR_OMNSTK, -1, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character in data (digits only)" }, + /* 41*/ { BARCODE_DBAR_OMNSTK, GS1NOCHECK_MODE, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character in data (digits only)" }, + /* 42*/ { BARCODE_DBAR_OMNSTK, -1, -1, -1, "12345678901236", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '6', expecting '1'" }, + /* 43*/ { BARCODE_DBAR_OMNSTK, GS1NOCHECK_MODE, -1, -1, "12345678901236", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '6', expecting '1'" }, // Still checked + /* 44*/ { BARCODE_DBAR_OMNSTK, -1, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input too long (14 character maximum)" }, + /* 45*/ { BARCODE_DBAR_OMNSTK, GS1NOCHECK_MODE, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input too long (14 character maximum)" }, + /* 46*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[01]12345678901234", ZINT_WARN_NONCOMPLIANT, 5, 102, "Warning 261: AI (01) position 14: Bad checksum '4', expected '1'" }, + /* 47*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, -1, -1, "[01]12345678901234", 0, 5, 102, "" }, + /* 48*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[01]12345678901231", 0, 5, 102, "" }, + /* 49*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[01]1234567890123A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 385: Invalid character in Compressed Field data (digits only)" }, + /* 50*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, -1, -1, "[01]1234567890123A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 385: Invalid character in Compressed Field data (digits only)" }, + /* 51*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[01]123456789012315", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 259: Invalid data length for AI (01)" }, + /* 52*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, -1, -1, "[01]123456789012315", 0, 5, 102, "" }, + /* 53*/ { BARCODE_DBAR_EXPSTK, -1, 12, -1, "[01]12345678901231", 0, 5, 102, "" }, // Cols > 11 ignored + /* 54*/ { BARCODE_DBAR_EXPSTK, -1, -1, 12, "[01]12345678901231", 0, 5, 102, "" }, // Rows > 11 ignored + /* 55*/ { BARCODE_DBAR_EXPSTK, -1, 1, -1, "[01]12345678901231", 0, 9, 53, "" }, + /* 56*/ { BARCODE_DBAR_EXPSTK, -1, 2, -1, "[01]12345678901231", 0, 5, 102, "" }, + /* 57*/ { BARCODE_DBAR_EXPSTK, -1, 3, -1, "[01]12345678901231", 0, 1, 134, "" }, + /* 58*/ { BARCODE_DBAR_EXPSTK, -1, 4, -1, "[01]12345678901231", 0, 1, 134, "" }, + /* 59*/ { BARCODE_DBAR_EXPSTK, -1, -1, 2, "[01]12345678901231", 0, 5, 102, "" }, + /* 60*/ { BARCODE_DBAR_EXPSTK, -1, -1, 3, "[01]12345678901231", 0, 5, 102, "" }, + /* 61*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[8110]106141416543213500110000310123196000", 0, 13, 102, "" }, + /* 62*/ { BARCODE_DBAR_EXPSTK, -1, 1, -1, "[8110]106141416543213500110000310123196000", 0, 25, 53, "" }, + /* 63*/ { BARCODE_DBAR_EXPSTK, -1, 2, -1, "[8110]106141416543213500110000310123196000", 0, 13, 102, "" }, + /* 64*/ { BARCODE_DBAR_EXPSTK, -1, 3, -1, "[8110]106141416543213500110000310123196000", 0, 9, 151, "" }, + /* 65*/ { BARCODE_DBAR_EXPSTK, -1, 4, -1, "[8110]106141416543213500110000310123196000", 0, 5, 200, "" }, + /* 66*/ { BARCODE_DBAR_EXPSTK, -1, 5, -1, "[8110]106141416543213500110000310123196000", 0, 5, 249, "" }, + /* 67*/ { BARCODE_DBAR_EXPSTK, -1, -1, 2, "[8110]106141416543213500110000310123196000", 0, 5, 200, "" }, + /* 68*/ { BARCODE_DBAR_EXPSTK, -1, -1, 3, "[8110]106141416543213500110000310123196000", 0, 9, 151, "" }, + /* 69*/ { BARCODE_DBAR_EXPSTK, -1, -1, 4, "[8110]106141416543213500110000310123196000", 0, 13, 102, "" }, + /* 70*/ { BARCODE_DBAR_EXPSTK, -1, -1, 5, "[8110]106141416543213500110000310123196000", 0, 13, 102, "" }, + /* 71*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[91]123456789012345678901", 0, 9, 102, "" }, + /* 72*/ { BARCODE_DBAR_EXPSTK, -1, 1, -1, "[91]123456789012345678901", 0, 17, 53, "" }, + /* 73*/ { BARCODE_DBAR_EXPSTK, -1, 2, -1, "[91]123456789012345678901", 0, 9, 102, "" }, + /* 74*/ { BARCODE_DBAR_EXPSTK, -1, 3, -1, "[91]123456789012345678901", 0, 5, 151, "" }, + /* 75*/ { BARCODE_DBAR_EXPSTK, -1, 4, -1, "[91]123456789012345678901", 0, 5, 200, "" }, + /* 76*/ { BARCODE_DBAR_EXPSTK, -1, -1, 2, "[91]123456789012345678901", 0, 5, 151, "" }, + /* 77*/ { BARCODE_DBAR_EXPSTK, -1, -1, 3, "[91]123456789012345678901", 0, 9, 102, "" }, + /* 78*/ { BARCODE_DBAR_EXPSTK, -1, -1, 4, "[91]123456789012345678901", 0, 9, 102, "" }, + /* 79*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[91]123456789012345678901", 0, 9, 102, "" }, + /* 80*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[91]1234567890123456789012345678901234567890123456789", 0, 17, 102, "" }, + /* 81*/ { BARCODE_DBAR_EXPSTK, -1, 1, -1, "[91]1234567890123456789012345678901234567890123456789", 0, 33, 53, "" }, + /* 82*/ { BARCODE_DBAR_EXPSTK, -1, 2, -1, "[91]1234567890123456789012345678901234567890123456789", 0, 17, 102, "" }, + /* 83*/ { BARCODE_DBAR_EXPSTK, -1, 3, -1, "[91]1234567890123456789012345678901234567890123456789", 0, 9, 151, "" }, + /* 84*/ { BARCODE_DBAR_EXPSTK, -1, 4, -1, "[91]1234567890123456789012345678901234567890123456789", 0, 9, 200, "" }, + /* 85*/ { BARCODE_DBAR_EXPSTK, -1, 4, -1, "[91]1234567890123456789012345678901234567890123456789", 0, 9, 200, "" }, + /* 86*/ { BARCODE_DBAR_EXPSTK, -1, 5, -1, "[91]1234567890123456789012345678901234567890123456789", 0, 5, 249, "" }, + /* 87*/ { BARCODE_DBAR_EXPSTK, -1, 6, -1, "[91]1234567890123456789012345678901234567890123456789", 0, 5, 298, "" }, + /* 88*/ { BARCODE_DBAR_EXPSTK, -1, 7, -1, "[91]1234567890123456789012345678901234567890123456789", 0, 5, 347, "" }, + /* 89*/ { BARCODE_DBAR_EXPSTK, -1, 8, -1, "[91]1234567890123456789012345678901234567890123456789", 0, 5, 396, "" }, + /* 90*/ { BARCODE_DBAR_EXPSTK, -1, 9, -1, "[91]1234567890123456789012345678901234567890123456789", 0, 1, 428, "" }, + /* 91*/ { BARCODE_DBAR_EXPSTK, -1, -1, 2, "[91]1234567890123456789012345678901234567890123456789", 0, 5, 249, "" }, + /* 92*/ { BARCODE_DBAR_EXPSTK, -1, -1, 3, "[91]1234567890123456789012345678901234567890123456789", 0, 9, 151, "" }, + /* 93*/ { BARCODE_DBAR_EXPSTK, -1, -1, 4, "[91]1234567890123456789012345678901234567890123456789", 0, 9, 151, "" }, + /* 94*/ { BARCODE_DBAR_EXPSTK, -1, -1, 5, "[91]1234567890123456789012345678901234567890123456789", 0, 17, 102, "" }, + /* 95*/ { BARCODE_DBAR_EXPSTK, -1, -1, 6, "[91]1234567890123456789012345678901234567890123456789", 0, 17, 102, "" }, + /* 96*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 21, 102, "" }, + /* 97*/ { BARCODE_DBAR_EXPSTK, -1, 1, -1, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 41, 53, "" }, + /* 98*/ { BARCODE_DBAR_EXPSTK, -1, 2, -1, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 21, 102, "" }, + /* 99*/ { BARCODE_DBAR_EXPSTK, -1, 3, -1, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 13, 151, "" }, + /*100*/ { BARCODE_DBAR_EXPSTK, -1, 4, -1, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 9, 200, "" }, + /*101*/ { BARCODE_DBAR_EXPSTK, -1, 5, -1, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 9, 249, "" }, + /*102*/ { BARCODE_DBAR_EXPSTK, -1, 6, -1, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 5, 298, "" }, + /*103*/ { BARCODE_DBAR_EXPSTK, -1, 7, -1, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 5, 347, "" }, + /*104*/ { BARCODE_DBAR_EXPSTK, -1, -1, 1, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 21, 102, "" }, + /*105*/ { BARCODE_DBAR_EXPSTK, -1, -1, 2, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 5, 298, "" }, + /*106*/ { BARCODE_DBAR_EXPSTK, -1, -1, 3, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 9, 200, "" }, + /*107*/ { BARCODE_DBAR_EXPSTK, -1, -1, 4, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 13, 151, "" }, + /*108*/ { BARCODE_DBAR_EXPSTK, -1, -1, 5, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 13, 151, "" }, + /*109*/ { BARCODE_DBAR_EXPSTK, -1, -1, 6, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 21, 102, "" }, + /*110*/ { BARCODE_DBAR_EXPSTK, -1, -1, 7, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 21, 102, "" }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -1323,14 +1411,14 @@ static void test_input(int index, int debug) { symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); - length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug); + length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, data[i].option_3, -1 /*output_options*/, data[i].data, -1, debug); ret = ZBarcode_Encode(symbol, (const 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); assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt); if (ret < ZINT_ERROR) { - assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d\n", i, symbol->rows, data[i].expected_rows); + assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (symbol->width %d)\n", i, symbol->rows, data[i].expected_rows, symbol->width); assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width); } diff --git a/backend/tests/test_vector.c b/backend/tests/test_vector.c index d230dbce..acc357ab 100644 --- a/backend/tests/test_vector.c +++ b/backend/tests/test_vector.c @@ -2128,6 +2128,167 @@ static void test_height(int index, int generate, int debug) { testFinish(); } +static void test_height_per_row(int index, int generate, int debug) { + + struct item { + int symbology; + int input_mode; + int option_1; + int option_2; + int option_3; + float height; + float scale; + char *data; + char *composite; + int ret; + + float expected_height; + int expected_rows; + int expected_width; + float expected_vector_width; + float expected_vector_height; + + const char *comment; + }; + struct item data[] = { + /* 0*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, "1234567890", "", 0, 21, 7, 103, 206, 42, "" }, + /* 1*/ { BARCODE_PDF417, HEIGHTPERROW_MODE, -1, -1, -1, 0.5, -1, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 3.5, 7, 103, 206, 7, "" }, + /* 2*/ { BARCODE_PDF417, HEIGHTPERROW_MODE, -1, -1, -1, 1, -1, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 7, 7, 103, 206, 14, "" }, + /* 3*/ { BARCODE_PDF417, HEIGHTPERROW_MODE, -1, -1, -1, 1.25, -1, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 8.75, 7, 103, 206, 17.5, "" }, + /* 4*/ { BARCODE_PDF417, HEIGHTPERROW_MODE, -1, -1, -1, 1.5, -1, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 10.5, 7, 103, 206, 21, "" }, + /* 5*/ { BARCODE_PDF417, HEIGHTPERROW_MODE, -1, -1, -1, 1.7, -1, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 11.900001, 7, 103, 206, 23.800001, "" }, + /* 6*/ { BARCODE_PDF417, HEIGHTPERROW_MODE, -1, -1, -1, 1.74, -1, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 12.18, 7, 103, 206, 24.360001, "" }, + /* 7*/ { BARCODE_PDF417, HEIGHTPERROW_MODE, -1, -1, -1, 1.75, -1, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 12.25, 7, 103, 206, 24.5, "" }, + /* 8*/ { BARCODE_PDF417, HEIGHTPERROW_MODE, -1, -1, -1, 2, -1, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 14, 7, 103, 206, 28, "" }, + /* 9*/ { BARCODE_PDF417, HEIGHTPERROW_MODE, -1, -1, -1, 2.1, -1, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 14.699999, 7, 103, 206, 29.399998, "" }, + /* 10*/ { BARCODE_PDF417, HEIGHTPERROW_MODE, -1, -1, -1, 2.25, -1, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 15.75, 7, 103, 206, 31.5, "" }, + /* 11*/ { BARCODE_PDF417, HEIGHTPERROW_MODE, -1, -1, -1, 2.5, -1, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 17.5, 7, 103, 206, 35, "" }, + /* 12*/ { BARCODE_PDF417, HEIGHTPERROW_MODE, -1, -1, -1, 2.75, -1, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 19.25, 7, 103, 206, 38.5, "" }, + /* 13*/ { BARCODE_PDF417, HEIGHTPERROW_MODE, -1, -1, -1, 3, -1, "1234567890", "", 0, 21, 7, 103, 206, 42, "Default" }, + /* 14*/ { BARCODE_PDF417, HEIGHTPERROW_MODE, -1, -1, -1, 3.5, -1, "1234567890", "", 0, 24.5, 7, 103, 206, 49, "" }, + /* 15*/ { BARCODE_PDF417, HEIGHTPERROW_MODE, -1, -1, -1, 1000, -1, "1234567890", "", 0, 7000, 7, 103, 206, 14000, "" }, + /* 16*/ { BARCODE_PDF417, HEIGHTPERROW_MODE, -1, -1, 5, 0.5, -1, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 2.5, 5, 120, 240, 5, "5 rows" }, + /* 17*/ { BARCODE_PDF417COMP, HEIGHTPERROW_MODE, -1, -1, -1, 3.5, -1, "1234567890", "", 0, 24.5, 7, 69, 138, 49, "" }, + /* 18*/ { BARCODE_HIBC_PDF, HEIGHTPERROW_MODE, -1, -1, -1, 3.5, -1, "1234567890", "", 0, 28, 8, 103, 206, 56, "" }, + /* 19*/ { BARCODE_CODE16K, -1, -1, -1, -1, -1, -1, "1234567890", "", 0, 20, 2, 70, 162, 44, "" }, + /* 20*/ { BARCODE_CODE16K, HEIGHTPERROW_MODE, -1, -1, -1, 0.5, -1, "1234567890", "", 0, 1, 2, 70, 162, 6, "(0.5 * 2 rows + 2 binds) * 2 scale = 6 (separator will cover rows)" }, + /* 21*/ { BARCODE_CODE16K, HEIGHTPERROW_MODE, -1, -1, -1, 0.7, -1, "1234567890", "", 0, 1.4, 2, 70, 162, 6.8000002, "" }, + /* 22*/ { BARCODE_CODE16K, HEIGHTPERROW_MODE, -1, -1, -1, 0.75, -1, "1234567890", "", 0, 1.5, 2, 70, 162, 7, "" }, + /* 23*/ { BARCODE_CODE16K, HEIGHTPERROW_MODE, -1, -1, -1, 1, -1, "1234567890", "", 0, 2, 2, 70, 162, 8, "" }, + /* 24*/ { BARCODE_CODE16K, HEIGHTPERROW_MODE, -1, -1, -1, 1.1, -1, "1234567890", "", 0, 2.2, 2, 70, 162, 8.3999996, "" }, + /* 25*/ { BARCODE_CODE16K, HEIGHTPERROW_MODE, -1, -1, -1, 1.2, -1, "1234567890", "", 0, 2.4000001, 2, 70, 162, 8.8000002, "" }, + /* 26*/ { BARCODE_CODE16K, HEIGHTPERROW_MODE, -1, -1, -1, 1.25, -1, "1234567890", "", 0, 2.5, 2, 70, 162, 9, "" }, + /* 27*/ { BARCODE_CODE16K, HEIGHTPERROW_MODE, -1, -1, -1, 1.5, -1, "1234567890", "", 0, 3, 2, 70, 162, 10, "" }, + /* 28*/ { BARCODE_CODE16K, HEIGHTPERROW_MODE, -1, -1, -1, 2, -1, "1234567890", "", 0, 4, 2, 70, 162, 12, "" }, + /* 29*/ { BARCODE_CODE16K, HEIGHTPERROW_MODE, -1, -1, -1, 10, -1, "1234567890", "", 0, 20, 2, 70, 162, 44, "Default" }, + /* 30*/ { BARCODE_CODE16K, HEIGHTPERROW_MODE, -1, -1, -1, 10.5, -1, "1234567890", "", 0, 21, 2, 70, 162, 46, "" }, + /* 31*/ { BARCODE_CODE49, -1, -1, -1, -1, -1, -1, "12345678901234567890", "", 0, 30, 3, 70, 162, 64, "" }, + /* 32*/ { BARCODE_CODE49, HEIGHTPERROW_MODE, -1, -1, -1, 2, -1, "12345678901234567890", "", 0, 6, 3, 70, 162, 16, "(2 * 3 rows + 2 binds) * 2 scale = 16" }, + /* 33*/ { BARCODE_CODE49, HEIGHTPERROW_MODE, -1, -1, -1, 10, -1, "12345678901234567890", "", 0, 30, 3, 70, 162, 64, "Default" }, + /* 34*/ { BARCODE_CODE49, HEIGHTPERROW_MODE, -1, -1, -1, 10.5, -1, "12345678901234567890", "", 0, 31.5, 3, 70, 162, 67, "" }, + /* 35*/ { BARCODE_CODABLOCKF, -1, -1, -1, -1, -1, -1, "1234567890123456789", "", 0, 40, 4, 101, 242, 84, "" }, + /* 36*/ { BARCODE_CODABLOCKF, HEIGHTPERROW_MODE, -1, -1, -1, 0.5, -1, "1234567890123456789", "", 0, 2, 4, 101, 242, 8, "(0.5 * 4 rows + 2 binds) * 2 scale = 8" }, + /* 37*/ { BARCODE_CODABLOCKF, HEIGHTPERROW_MODE, -1, -1, -1, 1, -1, "1234567890123456789", "", 0, 4, 4, 101, 242, 12, "" }, + /* 38*/ { BARCODE_CODABLOCKF, HEIGHTPERROW_MODE, -1, -1, -1, 3, -1, "1234567890123456789", "", 0, 12, 4, 101, 242, 28, "" }, + /* 39*/ { BARCODE_CODABLOCKF, HEIGHTPERROW_MODE, -1, -1, -1, 10, -1, "1234567890123456789", "", 0, 40, 4, 101, 242, 84, "Default when <= 12 cols" }, + /* 40*/ { BARCODE_CODABLOCKF, -1, 2, -1, -1, -1, -1, "12345678901234567890123456", "", 0, 20, 2, 200, 440, 44, "2 rows" }, + /* 41*/ { BARCODE_CODABLOCKF, HEIGHTPERROW_MODE, 2, -1, -1, 10.15, -1, "12345678901234567890123456", "", 0, 20.299999, 2, 200, 440, 44.599998, "Default for 13 cols" }, + /* 42*/ { BARCODE_CODABLOCKF, HEIGHTPERROW_MODE, 2, -1, -1, 2000, -1, "12345678901234567890123456", "", 0, 4000, 2, 200, 440, 8004, "" }, + /* 43*/ { BARCODE_CODABLOCKF, HEIGHTPERROW_MODE, -1, -1, -1, 10.5, -1, "1234567890123456789", "", 0, 42, 4, 101, 242, 88, "" }, + /* 44*/ { BARCODE_HIBC_BLOCKF, HEIGHTPERROW_MODE, -1, -1, -1, 10.5, -1, "1234567890123456789", "", 0, 42, 4, 101, 242, 88, "" }, + /* 45*/ { BARCODE_MICROPDF417, -1, -1, -1, -1, -1, -1, "1234567890", "", 0, 12, 6, 82, 164, 24, "" }, + /* 46*/ { BARCODE_MICROPDF417, HEIGHTPERROW_MODE, -1, -1, -1, 0.5, -1, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 3, 6, 82, 164, 6, "" }, + /* 47*/ { BARCODE_MICROPDF417, HEIGHTPERROW_MODE, -1, -1, -1, 2, -1, "1234567890", "", 0, 12, 6, 82, 164, 24, "Default" }, + /* 48*/ { BARCODE_MICROPDF417, HEIGHTPERROW_MODE, -1, -1, -1, 2.5, -1, "1234567890", "", 0, 15, 6, 82, 164, 30, "" }, + /* 49*/ { BARCODE_MICROPDF417, HEIGHTPERROW_MODE, -1, -1, -1, 3, -1, "1234567890", "", 0, 18, 6, 82, 164, 36, "" }, + /* 50*/ { BARCODE_HIBC_MICPDF, HEIGHTPERROW_MODE, -1, -1, -1, 3, -1, "1234567890", "", 0, 42, 14, 38, 76, 84, "" }, + /* 51*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, -1, -1, -1, "[8110]106141416543213500110000310123196000", "", 0, 145, 13, 102, 204, 290, "" }, + /* 52*/ { BARCODE_DBAR_EXPSTK, HEIGHTPERROW_MODE, -1, -1, -1, 0.5, -1, "[8110]106141416543213500110000310123196000", "", 0, 11, 13, 102, 204, 22, "(0.5 * 4 rows + 9 seps) * 2 scale = 22" }, + /* 53*/ { BARCODE_DBAR_EXPSTK, HEIGHTPERROW_MODE, -1, -1, -1, 9, -1, "[8110]106141416543213500110000310123196000", "", 0, 45, 13, 102, 204, 90, "" }, + /* 54*/ { BARCODE_DBAR_EXPSTK, HEIGHTPERROW_MODE, -1, -1, -1, 9.5, -1, "[8110]106141416543213500110000310123196000", "", 0, 47, 13, 102, 204, 94, "" }, + /* 55*/ { BARCODE_DBAR_EXPSTK, HEIGHTPERROW_MODE, -1, -1, -1, 10, -1, "[8110]106141416543213500110000310123196000", "", 0, 49, 13, 102, 204, 98, "" }, + /* 56*/ { BARCODE_DBAR_EXPSTK, HEIGHTPERROW_MODE, -1, -1, -1, 34, -1, "[8110]106141416543213500110000310123196000", "", 0, 145, 13, 102, 204, 290, "Default" }, + /* 57*/ { BARCODE_DBAR_EXPSTK, HEIGHTPERROW_MODE, -1, -1, -1, 50, -1, "[8110]106141416543213500110000310123196000", "", 0, 209, 13, 102, 204, 418, "" }, + /* 58*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, -1, -1, -1, -1, "[8110]106141416543213500110000310123196000", "[8112]017777777666666223456789", 0, 154, 18, 102, 204, 308, "" }, + /* 59*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, -1, -1, 0.5, -1, "[8110]106141416543213500110000310123196000", "[8112]017777777666666223456789", 0, 20, 18, 102, 204, 40, "(0.5 * 4 rows + 10 seps + 2 * 4 cc) * 2 scale = 40" }, + /* 60*/ { BARCODE_DBAR_EXPSTK_CC, HEIGHTPERROW_MODE, -1, -1, -1, 34, -1, "[8110]106141416543213500110000310123196000", "[8112]017777777666666223456789", 0, 154, 18, 102, 204, 308, "Default" }, + /* 61*/ { BARCODE_DBAR_EXPSTK_CC, HEIGHTPERROW_MODE, -1, -1, -1, 35, -1, "[8110]106141416543213500110000310123196000", "[8112]017777777666666223456789", 0, 158, 18, 102, 204, 316, "" }, + /* 62*/ { BARCODE_PHARMA_TWO, -1, -1, -1, -1, -1, -1, "1234", "", 0, 10, 2, 13, 26, 20, "" }, + /* 63*/ { BARCODE_PHARMA_TWO, HEIGHTPERROW_MODE, -1, -1, -1, 0.5, -1, "1234", "", 0, 1, 2, 13, 26, 2, "" }, + /* 64*/ { BARCODE_PHARMA_TWO, HEIGHTPERROW_MODE, -1, -1, -1, 2.1, -1, "1234", "", 0, 4.1999998, 2, 13, 26, 8.3999996, "" }, + /* 65*/ { BARCODE_PHARMA_TWO, HEIGHTPERROW_MODE, -1, -1, -1, 2.2, -1, "1234", "", 0, 4.4000001, 2, 13, 26, 8.8000002, "" }, + /* 66*/ { BARCODE_PHARMA_TWO, HEIGHTPERROW_MODE, -1, -1, -1, 2.25, -1, "1234", "", 0, 4.5, 2, 13, 26, 9, "" }, + /* 67*/ { BARCODE_DBAR_OMNSTK, -1, -1, -1, -1, -1, -1, "1234567890123", "", 0, 69, 5, 50, 100, 138, "" }, + /* 68*/ { BARCODE_DBAR_OMNSTK, HEIGHTPERROW_MODE, -1, -1, -1, 0.5, -1, "1234567890123", "", 0, 4, 5, 50, 100, 8, "(0.5 * 2 rows + 3 separators) * 2 scale = 8" }, + /* 69*/ { BARCODE_DBAR_OMNSTK, HEIGHTPERROW_MODE, -1, -1, -1, 1, -1, "1234567890123", "", 0, 5, 5, 50, 100, 10, "" }, + /* 70*/ { BARCODE_DBAR_OMNSTK, HEIGHTPERROW_MODE, -1, -1, -1, 3.2, -1, "1234567890123", "", 0, 9.3999996, 5, 50, 100, 18.799999, "" }, + /* 71*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, "123456789012", "[20]01", 0, 50, 7, 99, 234, 110, "" }, + /* 72*/ { BARCODE_EANX_CC, HEIGHTPERROW_MODE, -1, -1, -1, 0.5, -1, "123456789012", "[20]01", 0, 12.5, 7, 99, 234, 35, "(0.5 * 1 row + 2 * 3 seps + 2 * 3 cc rows + 5 guards) * 2 scale = 35" }, + /* 73*/ { BARCODE_EANX_CC, -1, -1, -1, -1, 0.5, -1, "123456789012", "[20]01", 0, 12.5, 7, 99, 234, 35, "0.5 height below fixed height" }, + /* 74*/ { BARCODE_EANX_CC, HEIGHTPERROW_MODE, -1, -1, -1, 4, -1, "123456789012", "[20]01", 0, 16, 7, 99, 234, 42, "" }, + /* 75*/ { BARCODE_EANX_CC, -1, -1, -1, -1, 4, -1, "123456789012", "[20]01", 0, 12.5, 7, 99, 234, 35, "4 height below fixed height" }, + }; + int data_size = ARRAY_SIZE(data); + int i, length, ret; + struct zint_symbol *symbol; + + char *text; + + testStart("test_height_per_row"); + + for (i = 0; i < data_size; i++) { + + if (index != -1 && i != index) continue; + if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d\n", i); + + symbol = ZBarcode_Create(); + assert_nonnull(symbol, "Symbol not created\n"); + + if (data[i].height != -1) { + symbol->height = data[i].height; + } + if (data[i].scale != -1) { + symbol->scale = data[i].scale; + } + symbol->show_hrt = 0; // Note: disabling HRT + + if (strlen(data[i].composite)) { + text = data[i].composite; + strcpy(symbol->primary, data[i].data); + } else { + text = data[i].data; + } + length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, data[i].option_3, -1 /*output_options*/, text, -1, debug); + + ret = ZBarcode_Encode(symbol, (unsigned char *) text, length); + assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode(%s) ret %d != %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, data[i].ret, symbol->errtxt); + + ret = ZBarcode_Buffer_Vector(symbol, 0); + assert_zero(ret, "i:%d ZBarcode_Buffer_Vector(%s) ret %d != 0 (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, symbol->errtxt); + assert_nonnull(symbol->vector, "i:%d ZBarcode_Buffer_Vector(%s) vector NULL\n", i, testUtilBarcodeName(data[i].symbology)); + + if (generate) { + printf(" /*%3d*/ { %s, %s, %d, %d, %d, %.5g, %.5g, \"%s\", \"%s\", %s, %.8g, %d, %d, %.8g, %.8g, \"%s\" },\n", + i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), + data[i].option_1, data[i].option_2, data[i].option_3, data[i].height, data[i].scale, + data[i].data, data[i].composite, testUtilErrorName(data[i].ret), + symbol->height, symbol->rows, symbol->width, symbol->vector->width, symbol->vector->height, data[i].comment); + } else { + assert_equal(symbol->height, data[i].expected_height, "i:%d (%s) symbol->height %.8g != %.8g\n", i, testUtilBarcodeName(data[i].symbology), symbol->height, data[i].expected_height); + assert_equal(symbol->rows, data[i].expected_rows, "i:%d (%s) symbol->rows %d != %d\n", i, testUtilBarcodeName(data[i].symbology), symbol->rows, data[i].expected_rows); + assert_equal(symbol->width, data[i].expected_width, "i:%d (%s) symbol->width %d != %d\n", i, testUtilBarcodeName(data[i].symbology), symbol->width, data[i].expected_width); + assert_equal(symbol->vector->width, data[i].expected_vector_width, "i:%d (%s) symbol->vector->width %.8g != %.8g\n", + i, testUtilBarcodeName(data[i].symbology), symbol->vector->width, data[i].expected_vector_width); + assert_equal(symbol->vector->height, data[i].expected_vector_height, "i:%d (%s) symbol->vector->height %.8g != %.8g\n", + i, testUtilBarcodeName(data[i].symbology), symbol->vector->height, data[i].expected_vector_height); + } + + ZBarcode_Delete(symbol); + } + + testFinish(); +} + int main(int argc, char *argv[]) { testFunction funcs[] = { /* name, func, has_index, has_generate, has_debug */ @@ -2143,6 +2304,7 @@ int main(int argc, char *argv[]) { { "test_guard_descent", test_guard_descent, 1, 0, 1 }, { "test_quiet_zones", test_quiet_zones, 1, 0, 1 }, { "test_height", test_height, 1, 1, 1 }, + { "test_height_per_row", test_height_per_row, 1, 1, 1 }, }; testRun(argc, argv, funcs, ARRAY_SIZE(funcs)); diff --git a/backend/tests/testcommon.c b/backend/tests/testcommon.c index eb8b0bb2..35a88ebd 100644 --- a/backend/tests/testcommon.c +++ b/backend/tests/testcommon.c @@ -541,9 +541,10 @@ const char *testUtilInputModeName(int input_mode) { int val; }; static const struct item data[] = { - { "ESCAPE_MODE", ESCAPE_MODE, 8 }, - { "GS1PARENS_MODE", GS1PARENS_MODE, 16 }, - { "GS1NOCHECK_MODE", GS1NOCHECK_MODE, 32 }, + { "ESCAPE_MODE", ESCAPE_MODE, 0x0008 }, + { "GS1PARENS_MODE", GS1PARENS_MODE, 0x0010 }, + { "GS1NOCHECK_MODE", GS1NOCHECK_MODE, 0x0020 }, + { "HEIGHTPERROW_MODE", HEIGHTPERROW_MODE, 0x0040 }, }; static const int data_size = ARRAY_SIZE(data); int set, i; @@ -2044,8 +2045,8 @@ static const char *testUtilBwippName(int index, const struct zint_symbol *symbol { "code128", BARCODE_CODE128, 20, 0, 0, 0, 0, 0, }, { "leitcode", BARCODE_DPLEIT, 21, 0, 0, 0, 0, 0, }, { "identcode", BARCODE_DPIDENT, 22, 0, 0, 0, 0, 0, }, - { "code16k", BARCODE_CODE16K, 23, 0, 0, 0, 8 /*linear_row_height*/, 0, }, - { "code49", BARCODE_CODE49, 24, 0, 0, 0, 8 /*linear_row_height*/, 0, }, + { "code16k", BARCODE_CODE16K, 23, 1, 0, 0, 8 /*linear_row_height*/, 0, }, + { "code49", BARCODE_CODE49, 24, 1, 0, 0, 8 /*linear_row_height*/, 0, }, { "code93ext", BARCODE_CODE93, 25, 0, 0, 0, 0, 0, }, { "", -1, 26, 0, 0, 0, 0, 0, }, { "", -1, 27, 0, 0, 0, 0, 0, }, @@ -2717,6 +2718,13 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int } else if (symbology == BARCODE_CODE16K || symbology == BARCODE_CODE49) { sprintf(bwipp_opts_buf + strlen(bwipp_opts_buf), "%ssepheight=0", strlen(bwipp_opts_buf) ? " " : ""); bwipp_opts = bwipp_opts_buf; + if (option_1 >= 2) { + if ((symbology == BARCODE_CODE16K && option_1 <= 16) + || (symbology == BARCODE_CODE49 && option_1 <= 8)) { + sprintf(bwipp_opts_buf + strlen(bwipp_opts_buf), "%srows=%d", + strlen(bwipp_opts_buf) ? " " : "", option_1); + } + } } else if (symbology == BARCODE_AZTEC || symbology == BARCODE_HIBC_AZTEC) { int compact = 0, full = 0; if (option_1 >= 1 && option_1 <= 4) { diff --git a/backend/zint.h b/backend/zint.h index 2e4b3619..d7b62107 100644 --- a/backend/zint.h +++ b/backend/zint.h @@ -281,6 +281,7 @@ extern "C" { #define ESCAPE_MODE 0x0008 /* Process escape sequences */ #define GS1PARENS_MODE 0x0010 /* Process parentheses as GS1 AI delimiters (instead of square brackets) */ #define GS1NOCHECK_MODE 0x0020 /* Do not check validity of GS1 data (except that printable ASCII only) */ +#define HEIGHTPERROW_MODE 0x0040 /* Interpret `height` as per-row rather than as overall height */ /* Data Matrix specific options (`symbol->option_3`) */ #define DM_SQUARE 100 /* Only consider square versions on automatic symbol size selection */ diff --git a/backend_qt/qzint.cpp b/backend_qt/qzint.cpp index 453ffdee..bd29b8f1 100644 --- a/backend_qt/qzint.cpp +++ b/backend_qt/qzint.cpp @@ -69,6 +69,8 @@ namespace Zint { m_reader_init = false; m_rotate_angle = 0; m_debug = false; + m_encodedWidth = 0; + m_encodedRows = 0; target_size_horiz = 0; /* Legacy */ target_size_vert = 0; /* Legacy */ @@ -156,8 +158,12 @@ namespace Zint { m_borderWidth = m_zintSymbol->border_width; m_whitespace = m_zintSymbol->whitespace_width; m_vwhitespace = m_zintSymbol->whitespace_height; + m_encodedWidth = m_zintSymbol->width; + m_encodedRows = m_zintSymbol->rows; emit encoded(); } else { + m_encodedWidth = 0; + m_encodedRows = 0; emit errored(); } } @@ -509,6 +515,14 @@ namespace Zint { m_debug = debug; } + int QZint::encodedWidth() const { // Read-only, encoded width (no. of modules encoded) + return m_encodedWidth; + } + + int QZint::encodedRows() const { // Read-only, no. of rows encoded + return m_encodedRows; + } + /* Legacy */ void QZint::setWidth(int width) { setOption1(width); } int QZint::width() const { return m_option_1; } @@ -583,6 +597,8 @@ namespace Zint { m_rotate_angle); if (m_error >= ZINT_ERROR) { m_lastError = m_zintSymbol->errtxt; + m_encodedWidth = 0; + m_encodedRows = 0; emit errored(); return false; } else { diff --git a/backend_qt/qzint.h b/backend_qt/qzint.h index 9f241bf7..6bfbd4bb 100644 --- a/backend_qt/qzint.h +++ b/backend_qt/qzint.h @@ -139,6 +139,9 @@ public: bool debug() const; void setDebug(bool debug); + int encodedWidth() const; // Read-only, encoded width (no. of modules encoded) + int encodedRows() const; // Read-only, no. of rows encoded + /* Legacy property getters/setters */ void setWidth(int width); /* option_1 */ int width() const; @@ -218,6 +221,8 @@ private: bool m_compliant_height; bool m_reader_init; bool m_debug; + int m_encodedWidth; + int m_encodedRows; int target_size_horiz; /* Legacy */ int target_size_vert; /* Legacy */ diff --git a/backend_qt/tests/test_qzint.cpp b/backend_qt/tests/test_qzint.cpp index c2801256..fef0552e 100644 --- a/backend_qt/tests/test_qzint.cpp +++ b/backend_qt/tests/test_qzint.cpp @@ -223,6 +223,9 @@ private slots: bool debug = true; bc.setDebug(debug); QCOMPARE(bc.debug(), debug); + + QCOMPARE(bc.encodedWidth(), 0); // Read-only + QCOMPARE(bc.encodedRows(), 0); // Read-only } void setGetECIValueTest_data() @@ -314,10 +317,12 @@ private slots: QTest::addColumn("text"); QTest::addColumn("getError"); QTest::addColumn("error_message"); + QTest::addColumn("encodedWidth"); + QTest::addColumn("encodedRows"); - QTest::newRow("BARCODE_QRCODE") << BARCODE_QRCODE << "1234" << 0 << ""; + QTest::newRow("BARCODE_QRCODE") << BARCODE_QRCODE << "1234" << 0 << "" << 21 << 21; if (!m_skipIfFontUsed) { - QTest::newRow("BARCODE_QRCODE no text") << BARCODE_QRCODE << "" << ZINT_ERROR_INVALID_DATA << "Error 205: No input data"; + QTest::newRow("BARCODE_QRCODE no text") << BARCODE_QRCODE << "" << ZINT_ERROR_INVALID_DATA << "Error 205: No input data" << 0 << 0; } } @@ -340,6 +345,8 @@ private slots: QFETCH(QString, text); QFETCH(int, getError); QFETCH(QString, error_message); + QFETCH(int, encodedWidth); + QFETCH(int, encodedRows); bc.setSymbol(symbology); bc.setText(text); @@ -356,6 +363,8 @@ private slots: QCOMPARE(bc.error_message(), error_message); QCOMPARE(bc.lastError(), error_message); QCOMPARE(bc.hasErrors(), getError != 0); + QCOMPARE(bc.encodedWidth(), encodedWidth); + QCOMPARE(bc.encodedRows(), encodedRows); if (getError) { QCOMPARE(spyEncoded.count(), 0); diff --git a/backend_tcl/zint.c b/backend_tcl/zint.c index a2be5c03..9ce6dd03 100644 --- a/backend_tcl/zint.c +++ b/backend_tcl/zint.c @@ -134,6 +134,9 @@ - Added -compliantheight option 2021-10-30 GL - Added PDF417 -rows +2021-11-19 GL +- Added -heightperrow option +- Added DBAR_EXPSTK, CODE16K, CODE49 -rows */ #if defined(__WIN32__) || defined(_WIN32) || defined(WIN32) @@ -475,6 +478,7 @@ static const char help_message[] = "zint tcl(stub,obj) dll\n" " -gssep bool: for gs1, use gs as separator instead fnc1 (Datamatrix only)\n" " -guarddescent double: Height of guard bar descent in modules (UPC/EAN only)\n" " -height double: Symbol height in modules\n" + " -heightperrow bool: treat height as per-row\n" /* cli option --input not supported */ " -init bool: Create reader initialisation symbol (Code 128, Data Matrix)\n" " -mask number: set masking pattern to use (QR/MicroQR/HanXin/DotCode)\n" @@ -724,7 +728,7 @@ static int Encode(Tcl_Interp *interp, int objc, "-cols", "-compliantheight", "-dmre", "-dotsize", "-dotty", "-eci", "-fg", "-format", "-fullmultibyte", "-gs1nocheck", "-gs1parens", "-gssep", "-guarddescent", - "-height", "-init", "-mask", "-mode", + "-height", "-heightperrow", "-init", "-mask", "-mode", "-nobackground", "-noquietzones", "-notext", "-primary", "-quietzones", "-reverse", "-rotate", "-rows", "-scale", "-scmvv", "-secure", "-separator", "-smalltext", "-square", "-structapp", @@ -735,7 +739,7 @@ static int Encode(Tcl_Interp *interp, int objc, iCols, iCompliantHeight, iDMRE, iDotSize, iDotty, iECI, iFG, iFormat, iFullMultiByte, iGS1NoCheck, iGS1Parens, iGSSep, iGuardDescent, - iHeight, iInit, iMask, iMode, + iHeight, iHeightPerRow, iInit, iMask, iMode, iNoBackground, iNoQuietZones, iNoText, iPrimary, iQuietZones, iReverse, iRotate, iRows, iScale, iSCMvv, iSecure, iSeparator, iSmallText, iSquare, iStructApp, @@ -765,6 +769,7 @@ static int Encode(Tcl_Interp *interp, int objc, case iGS1NoCheck: case iGS1Parens: case iGSSep: + case iHeightPerRow: case iInit: case iNoBackground: case iNoQuietZones: @@ -928,6 +933,13 @@ static int Encode(Tcl_Interp *interp, int objc, my_symbol->eci = s_eci_number[ECIIndex]; } break; + case iHeightPerRow: + if (intValue) { + my_symbol->input_mode |= HEIGHTPERROW_MODE; + } else { + my_symbol->input_mode &= ~HEIGHTPERROW_MODE; + } + break; case iInit: if (intValue) { my_symbol->output_options |= READER_INIT; @@ -1263,13 +1275,17 @@ static int Encode(Tcl_Interp *interp, int objc, } /*------------------------------------------------------------------------*/ if (rows) { - /* PDF417 uses option 3 for rows */ + /* PDF417 and DBAR_EXPSTK use option 3 for rows */ if (my_symbol->symbology == BARCODE_PDF417 || my_symbol->symbology == BARCODE_PDF417COMP - || my_symbol->symbology == BARCODE_HIBC_PDF) { + || my_symbol->symbology == BARCODE_HIBC_PDF + || my_symbol->symbology == BARCODE_DBAR_EXPSTK + || my_symbol->symbology == BARCODE_DBAR_EXPSTK_CC) { my_symbol->option_3 = rows; } else if (my_symbol->symbology == BARCODE_CODABLOCKF - || my_symbol->symbology == BARCODE_HIBC_BLOCKF) { + || my_symbol->symbology == BARCODE_HIBC_BLOCKF + || my_symbol->symbology == BARCODE_CODE16K + || my_symbol->symbology == BARCODE_CODE49) { my_symbol->option_1 = rows; } } diff --git a/docs/manual.txt b/docs/manual.txt index 00fbd312..bf286f19 100644 --- a/docs/manual.txt +++ b/docs/manual.txt @@ -394,6 +394,28 @@ zint --height=100 -d "This Text" This specifies a symbol height of 100 times the X-dimension of the symbol. +The switch --compliantheight changes the default height to be compliant with the +barcode standard (if any). For instance + +zint -b LOGMARS -d "This Text" --compliantheight + +will produce a barcode of height 45.455X instead of the normal default of 50X. +The flag also causes Zint to return a warning if a non-compliant height is +given: + +zint -b LOGMARS -d "This Text" --compliantheight --height=6.2 +Warning 247: Height not compliant with standards + +The switch --heightperrow is useful for symbologies that have a variable number +of linear rows, namely PDF417, MicroPDF417, Codablock-F, Code16K, Code 49 and +DataBar Expanded Stacked, as it changes the treatment of the height value from +overall height to per-row height, allowing you to specify a consistent height +for each linear row without having to know how many there will be. For instance + +zint -b PDF417 -d "This Text" --height=4 --heightperrow + +will produce a barcode of height 32X, with each of the 8 rows 4X high. + 4.5 Adjusting whitespace ------------------------ The amount of horizontal whitespace to the left and right of the generated @@ -1453,22 +1475,24 @@ UPC-A and UPC-E have compliant quiet zones added by default. The way in which the input data is encoded can be set using the input_mode property. Valid values are shown in the table below. -------------------------------------------------------------------------------- -Value | Effect -------------------------------------------------------------------------------- -DATA_MODE | Uses full 8-bit range interpreted as Latin-1 or binary data. -UNICODE_MODE | Uses pre-formatted UTF-8 input. -GS1_MODE | Encodes GS1 data using FNC1 characters. -----------------|-------------------------------------------------------------- -ESCAPE_MODE | Process input data for escape sequences. -GS1PARENS_MODE | Parentheses (round brackets) used in input data instead of - | square brackets to delimit GS1 Application Identifiers - | (parentheses must not otherwise occur in the data). -GS1NOCHECK_MODE | Do not check GS1 data for validity, i.e. suppress checks for - | valid AIs and data lengths. Invalid characters (e.g. - | control characters, extended ASCII characters) are still - | checked for. -------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +Value | Effect +-------------------------------------------------------------------------------- +DATA_MODE | Uses full 8-bit range interpreted as Latin-1 or binary data +UNICODE_MODE | Uses pre-formatted UTF-8 input. +GS1_MODE | Encodes GS1 data using FNC1 characters. +------------------|------------------------------------------------------------- +ESCAPE_MODE | Process input data for escape sequences. +GS1PARENS_MODE | Parentheses (round brackets) used in input data instead of + | square brackets to delimit GS1 Application Identifiers + | (parentheses must not otherwise occur in the data). +GS1NOCHECK_MODE | Do not check GS1 data for validity, i.e. suppress checks + | for valid AIs and data lengths. Invalid characters (e.g. + | control characters, extended ASCII characters) are still + | checked for. +HEIGHTPERROW_MODE | Interpret the height variable as per-row rather than as + | overall height. +-------------------------------------------------------------------------------- The default mode is DATA_MODE. @@ -1495,6 +1519,10 @@ conform to the current GS1 standard. Non-printable ASCII input is still checked for, as is the validity of GS1 data specified without AIs (e.g. linear data for GS1 DataBar Omnidirectional/Limited/etc.). +For HEIGHTPERROW_MODE, see --heightperrow in section 4.4. The height variable +should be set to the desired per-row value on input (it will be set to the +overall height on output). + 5.11 Verifying Symbology Availability ------------------------------------- An additional function available in the API is defined as: @@ -2056,7 +2084,8 @@ Code 16K uses a Code 128 based system which can stack up to 16 rows in a block. This gives a maximum data capacity of 77 characters or 154 numerical digits and includes two modulo-107 check digits. Code 16K also supports extended ASCII character encoding in the same manner as Code 128. GS1 data encoding is also -supported. +supported. The minimum number of rows to use can be set using the --rows option +or by setting option_1, with values from 2 to 16. 6.2.4 PDF417 (ISO 15438) ------------------------ @@ -2122,17 +2151,22 @@ component to make a composite symbol. A stacked variation of the GS1 DataBar Expanded symbol for smaller packages. Input is the same as for GS1 DataBar Expanded (see section 6.1.12.3). In addition the width of the symbol can be altered using the --cols switch or -option_2. In this case the number of columns relates to the number of character -pairs on each row of the symbol. This symbol can be generated with a two- -dimensional component to make a composite symbol. For symbols with a 2D -component the number of columns must be at least 2. +option_2, with values from 1 to 11. In this case the number of columns relates +to the number of character pairs on each row of the symbol. Alternatively the +--rows switch or option_3 can be used to specify the maximum number of rows +(values 2 to 11), and the number of columns will be adjusted accordingly. This +symbol can be generated with a two-dimensional component to make a composite +symbol. For symbols with a 2D component the number of columns must be at least +2. 6.2.10 Code 49 -------------- Developed in 1987 at Intermec, Code 49 is a cross between UPC and Code 39. It is one of the earliest stacked symbologies and influenced the design of Code 16K a few years later. It supports full 7-bit ASCII input up to a maximum of 49 -characters or 81 numeric digits. GS1 data encoding is also supported. +characters or 81 numeric digits. GS1 data encoding is also supported. The +minimum number of rows to use can be set using the --rows option or by setting +option_1, with values from 2 to 8. 6.3 Composite Symbols (ISO 24723) --------------------------------- diff --git a/frontend/main.c b/frontend/main.c index 1f7141a0..f230743f 100644 --- a/frontend/main.c +++ b/frontend/main.c @@ -147,6 +147,7 @@ static void usage(void) { " --guarddescent=NUMBER Set height of guard bar descent in X-dims (UPC/EAN)\n" " -h, --help Display help message\n" " --height=NUMBER Set height of symbol in multiples of X-dimension\n" + " --heightperrow Treat height as per-row\n" " -i, --input=FILE Read input data from FILE\n" " --init Create reader initialisation/programming symbol\n" " --mask=NUMBER Set masking pattern to use (QR/Han Xin/DotCode)\n" @@ -864,7 +865,7 @@ int main(int argc, char **argv) { OPT_CMYK, OPT_COLS, OPT_COMPLIANTHEIGHT, OPT_DIRECT, OPT_DMRE, OPT_DOTSIZE, OPT_DOTTY, OPT_DUMP, OPT_ECI, OPT_ESC, OPT_FG, OPT_FILETYPE, OPT_FONTSIZE, OPT_FULLMULTIBYTE, OPT_GS1, OPT_GS1NOCHECK, OPT_GS1PARENS, OPT_GSSEP, OPT_GUARDDESCENT, - OPT_HEIGHT, OPT_INIT, OPT_MIRROR, OPT_MASK, OPT_MODE, + OPT_HEIGHT, OPT_HEIGHTPERROW, OPT_INIT, OPT_MIRROR, OPT_MASK, OPT_MODE, OPT_NOBACKGROUND, OPT_NOQUIETZONES, OPT_NOTEXT, OPT_PRIMARY, OPT_QUIETZONES, OPT_ROTATE, OPT_ROWS, OPT_SCALE, OPT_SCMVV, OPT_SECURE, OPT_SEPARATOR, OPT_SMALL, OPT_SQUARE, OPT_STRUCTAPP, @@ -903,6 +904,7 @@ int main(int argc, char **argv) { {"gssep", 0, NULL, OPT_GSSEP}, {"guarddescent", 1, NULL, OPT_GUARDDESCENT}, {"height", 1, NULL, OPT_HEIGHT}, + {"heightperrow", 0, NULL, OPT_HEIGHTPERROW}, {"help", 0, NULL, 'h'}, {"init", 0, NULL, OPT_INIT}, {"input", 1, NULL, 'i'}, @@ -1106,6 +1108,9 @@ int main(int argc, char **argv) { fflush(stderr); } break; + case OPT_HEIGHTPERROW: + my_symbol->input_mode |= HEIGHTPERROW_MODE; + break; case OPT_INIT: my_symbol->output_options |= READER_INIT; break; @@ -1390,9 +1395,11 @@ int main(int argc, char **argv) { } if (rows) { if (my_symbol->symbology == BARCODE_PDF417 || my_symbol->symbology == BARCODE_PDF417COMP - || my_symbol->symbology == BARCODE_HIBC_PDF) { + || my_symbol->symbology == BARCODE_HIBC_PDF || my_symbol->symbology == BARCODE_DBAR_EXPSTK + || my_symbol->symbology == BARCODE_DBAR_EXPSTK_CC) { my_symbol->option_3 = rows; - } else if (my_symbol->symbology == BARCODE_CODABLOCKF || my_symbol->symbology == BARCODE_HIBC_BLOCKF) { + } else if (my_symbol->symbology == BARCODE_CODABLOCKF || my_symbol->symbology == BARCODE_HIBC_BLOCKF + || my_symbol->symbology == BARCODE_CODE16K || my_symbol->symbology == BARCODE_CODE49) { my_symbol->option_1 = rows; } } diff --git a/frontend/tests/test_args.c b/frontend/tests/test_args.c index 4e5bd13a..0cd669b9 100644 --- a/frontend/tests/test_args.c +++ b/frontend/tests/test_args.c @@ -188,6 +188,12 @@ static void arg_input_mode(char *cmd, int input_mode) { if (input_mode & GS1PARENS_MODE) { sprintf(cmd + (int) strlen(cmd), "%s--gs1parens", strlen(cmd) ? " " : ""); } + if (input_mode & GS1NOCHECK_MODE) { + sprintf(cmd + (int) strlen(cmd), "%s--gs1nocheck", strlen(cmd) ? " " : ""); + } + if (input_mode & HEIGHTPERROW_MODE) { + sprintf(cmd + (int) strlen(cmd), "%s--heightperrow", strlen(cmd) ? " " : ""); + } } } @@ -949,6 +955,7 @@ static void test_other_opts(int index, int debug) { /* 38*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "0,2,12345678901234567890123456789012", "Error 163: Structured Append index out of range (1-2)" }, /* 39*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "3,2,12345678901234567890123456789012", "Error 163: Structured Append index out of range (1-2)" }, /* 40*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "2,3,12345678901234567890123456789012", "" }, + /* 41*/ { BARCODE_PDF417, "1", -1, " --heightperrow", "", "" }, }; int data_size = ARRAY_SIZE(data); int i; diff --git a/frontend_qt/grpAztec.ui b/frontend_qt/grpAztec.ui index efc4a6ba..59c1b6f7 100644 --- a/frontend_qt/grpAztec.ui +++ b/frontend_qt/grpAztec.ui @@ -19,9 +19,9 @@ Form - + - + @@ -331,7 +331,7 @@ formatted with Application Identifiers (AIs) - H&IBC Aztec Code + H&IBC Process data as a Health Industry Barcode (HIBC) @@ -729,7 +729,7 @@ Maximum length 32 and cannot contain spaces - + Qt::Vertical diff --git a/frontend_qt/grpC128.ui b/frontend_qt/grpC128.ui index 4a73d764..8ebff7a4 100644 --- a/frontend_qt/grpC128.ui +++ b/frontend_qt/grpC128.ui @@ -19,7 +19,7 @@ Form - + @@ -70,7 +70,7 @@ formatted with Application Identifiers (AIs) - H&IBC 128 + H&IBC Process data as a Health Industry Barcode (HIBC) @@ -106,7 +106,7 @@ the data with a slash "/" - + Qt::Vertical diff --git a/frontend_qt/grpC16k.ui b/frontend_qt/grpC16k.ui index 7c3bff0d..ef70a4e3 100644 --- a/frontend_qt/grpC16k.ui +++ b/frontend_qt/grpC16k.ui @@ -19,11 +19,227 @@ Form - + - + - + + + Minimum Ro&ws: + + + Set minimum number of rows + + + cmbC16kRows + + + + + + + 16 + + + Set minimum number of rows + + + + Automatic + + + + + 3 + + + + + 4 + + + + + 5 + + + + + 6 + + + + + 7 + + + + + 8 + + + + + 9 + + + + + 10 + + + + + 11 + + + + + 12 + + + + + 13 + + + + + 14 + + + + + 15 + + + + + 16 + + + + + + + + false + + + Height per row in X-dimensions +Only available if "Automatic Height" in +the Appearance tab is not checked +(ignored if disabled) + + + Row &Height: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + spnC16kHeightPerRow + + + + + + + + + false + + + Height per row in X-dimensions +Only available if "Automatic Height" in +the Appearance tab is not checked +(ignored if disabled) + + + true + + + + + + X + + + 3 + + + 0 + + + 2000.000000000000000 + + + 0.100000000000000 + + + 0 + + + 0 (Disabled) + + + + 2 + 0 + + + + + + + + Set height per row to 0 +("Height" in the Appearance +tab will be re-enabled) + + + Disabl&e + + + + 1 + 0 + + + + + 30 + 20 + + + + + + + + Set height per row to default value + + + De&fault + + + + 1 + 0 + + + + + 30 + 20 + + + + + + + + &Row Separator Height: @@ -36,7 +252,7 @@ separating rows - + Height in X-dimensions of horizontal lines @@ -119,7 +335,7 @@ formatted with Application Identifiers (AIs) - + Qt::Vertical diff --git a/frontend_qt/grpC39.ui b/frontend_qt/grpC39.ui index c0ffb36b..adf688a1 100644 --- a/frontend_qt/grpC39.ui +++ b/frontend_qt/grpC39.ui @@ -19,7 +19,7 @@ Form - + @@ -28,7 +28,7 @@ Check character options - + @@ -45,7 +45,7 @@ - H&IBC 39 (Mod-43 Check Digit added) + H&IBC (Mod-43 Check Digit added) Process data as a Health Industry Barcode (HIBC) @@ -69,7 +69,7 @@ the data with a slash "/" - + Qt::Vertical diff --git a/frontend_qt/grpC49.ui b/frontend_qt/grpC49.ui index 443eca10..3243ef1a 100644 --- a/frontend_qt/grpC49.ui +++ b/frontend_qt/grpC49.ui @@ -19,11 +19,184 @@ Form - + - + - + + + Minimum Ro&ws: + + + Set minimum number of rows + + + cmbC49Rows + + + + + + + Set minimum number of rows + + + + Automatic + + + + + 3 + + + + + 4 + + + + + 5 + + + + + 6 + + + + + 7 + + + + + 8 + + + + + + + + false + + + Height per row in X-dimensions +Only available if "Automatic Height" in +the Appearance tab is not checked +(ignored if disabled) + + + Row &Height: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + spnC49HeightPerRow + + + + + + + + + false + + + Height per row in X-dimensions +Only available if "Automatic Height" in +the Appearance tab is not checked +(ignored if disabled) + + + true + + + + + + X + + + 3 + + + 0 + + + 2000.000000000000000 + + + 0.100000000000000 + + + 0 + + + 0 (Disabled) + + + + 2 + 0 + + + + + + + + Set height per row to 0 +("Height" in the Appearance +tab will be re-enabled) + + + Disabl&e + + + + 1 + 0 + + + + + 30 + 20 + + + + + + + + Set height per row to default value + + + De&fault + + + + 1 + 0 + + + + + 30 + 20 + + + + + + + + &Row Separator Height: @@ -36,7 +209,7 @@ separating rows - + Height in X-dimensions of horizontal lines @@ -119,7 +292,7 @@ formatted with Application Identifiers (AIs) - + Qt::Vertical diff --git a/frontend_qt/grpCodablockF.ui b/frontend_qt/grpCodablockF.ui index b424b4ad..e5e60ca6 100644 --- a/frontend_qt/grpCodablockF.ui +++ b/frontend_qt/grpCodablockF.ui @@ -19,16 +19,16 @@ Form - + - + - + - Symbol &Width (Columns): + &Number of Data Columns: - The number of data characters in a row + Set number of data characters in a row cmbCbfWidth @@ -41,7 +41,7 @@ 21 - The number of data characters in a row + Set number of data characters in a row @@ -346,12 +346,12 @@ - + - Symbol &Height (Rows): + Number of Ro&ws: - The number of rows + Set number of rows cmbCbfHeight @@ -364,7 +364,7 @@ 21 - The number of rows + Set number of rows @@ -594,7 +594,119 @@ - + + + false + + + Height per row in X-dimensions +Only available if "Automatic Height" in +the Appearance tab is not checked +(ignored if disabled) + + + Row &Height: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + spnCbfHeightPerRow + + + + + + + + + false + + + Height per row in X-dimensions +Only available if "Automatic Height" in +the Appearance tab is not checked +(ignored if disabled) + + + true + + + + + + X + + + 3 + + + 0 + + + 2000.000000000000000 + + + 0.100000000000000 + + + 0 + + + 0 (Disabled) + + + + + + + Set height per row to 0 +("Height" in the Appearance +tab will be re-enabled) + + + Disabl&e + + + + 1 + 0 + + + + + 30 + 20 + + + + + + + + Set height per row to default value + + + De&fault + + + + 1 + 0 + + + + + 30 + 20 + + + + + + + + &Row Separator Height: @@ -607,7 +719,7 @@ separating rows - + Height in X-dimensions of horizontal lines @@ -645,7 +757,7 @@ separating rows How to process data - + QLayout::SetMinimumSize @@ -665,7 +777,7 @@ separating rows - H&IBC Codablock-F + H&IBC Process data as a Health Industry Barcode (HIBC) @@ -692,7 +804,7 @@ the data with a slash "/" - + Qt::Vertical diff --git a/frontend_qt/grpDBExtend.ui b/frontend_qt/grpDBExtend.ui index 46d63443..092f8393 100644 --- a/frontend_qt/grpDBExtend.ui +++ b/frontend_qt/grpDBExtend.ui @@ -19,24 +19,35 @@ Form - + - - - + + + &Number of Columns: - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + Set number of columns (each contains +2 data segments) - - cmbCols + + true + + buttonGroupDBESColsRows + - - + + + + true + + + Set number of columns (each contains +2 data segments) + Automatic @@ -99,10 +110,206 @@ + + + + Maximum Ro&ws: + + + Set maximum number of rows + + + buttonGroupDBESColsRows + + + + + + + false + + + Set maximum number of rows + + + + None + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 5 + + + + + 6 + + + + + 7 + + + + + 8 + + + + + 9 + + + + + 10 + + + + + 11 (same as none) + + + + + + + + false + + + Height per row in X-dimensions +Only available if "Automatic Height" in +the Appearance tab is not checked +(ignored if disabled) + + + Row &Height: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + spnDBESHeightPerRow + + + + + + + + + false + + + Height per row in X-dimensions +Only available if "Automatic Height" in +the Appearance tab is not checked +(ignored if disabled) + + + true + + + + + + X + + + 3 + + + 0 + + + 2000.000000000000000 + + + 0.100000000000000 + + + 0 + + + 0 (Disabled) + + + + 2 + 0 + + + + + + + + Set height per row to 0 +("Height" in the Appearance +tab will be re-enabled) + + + Disabl&e + + + + 1 + 0 + + + + + 30 + 20 + + + + + + + + Set height per row to default value + + + De&fault + + + + 1 + 0 + + + + + 30 + 20 + + + + + + - + Qt::Vertical @@ -117,5 +324,41 @@ - + + + radDBESCols + toggled(bool) + cmbDBESCols + setEnabled(bool) + + + 85 + 47 + + + 331 + 47 + + + + + radDBESRows + toggled(bool) + cmbDBESRows + setEnabled(bool) + + + 200 + 80 + + + 366 + 80 + + + + + + + diff --git a/frontend_qt/grpDM.ui b/frontend_qt/grpDM.ui index 5aa437c3..61eddbc5 100644 --- a/frontend_qt/grpDM.ui +++ b/frontend_qt/grpDM.ui @@ -19,9 +19,9 @@ Form - + - + @@ -379,7 +379,7 @@ formatted with Application Identifiers (AIs) - H&IBC Data Matrix + H&IBC Process data as a Health Industry Barcode (HIBC) @@ -745,7 +745,7 @@ Value ranges from 1 to 254 - + Qt::Vertical diff --git a/frontend_qt/grpMicroPDF.ui b/frontend_qt/grpMicroPDF.ui index d213081b..64c7bc9b 100644 --- a/frontend_qt/grpMicroPDF.ui +++ b/frontend_qt/grpMicroPDF.ui @@ -19,9 +19,9 @@ Form - + - + @@ -38,7 +38,7 @@ - + Set number of data characters in a row @@ -70,6 +70,124 @@ + + + + false + + + Height per row in X-dimensions +Only available if "Automatic Height" in +the Appearance tab is not checked +(ignored if disabled) + + + Row &Height: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + spnMPDFHeightPerRow + + + + + + + + + false + + + Height per row in X-dimensions +Only available if "Automatic Height" in +the Appearance tab is not checked +(ignored if disabled) + + + true + + + + + + X + + + 3 + + + 0 + + + 2000.000000000000000 + + + 0.100000000000000 + + + 0 + + + 0 (Disabled) + + + + 2 + 0 + + + + + + + + Set height per row to 0 +("Height" in the Appearance +tab will be re-enabled) + + + Disabl&e + + + + 1 + 0 + + + + + 30 + 20 + + + + + + + + Set height per row to default value + + + De&fault + + + + 1 + 0 + + + + + 30 + 20 + + + + + + @@ -100,7 +218,7 @@ - H&IBC MicroPDF417 + H&IBC Process data as a Health Industry Barcode (HIBC) @@ -163,7 +281,7 @@ Value ranges from 1 (Disabled) to 99999 - + Qt::Horizontal @@ -253,7 +371,7 @@ Numbers only, in triplets, maximum length 30 (10 triplets) - + Qt::Vertical diff --git a/frontend_qt/grpPDF417.ui b/frontend_qt/grpPDF417.ui index 781cdbdc..c0478bfe 100644 --- a/frontend_qt/grpPDF417.ui +++ b/frontend_qt/grpPDF417.ui @@ -1,7 +1,7 @@ - + grpPDF417 - - + + 0 0 @@ -15,31 +15,31 @@ 16777215 - + Form - + - - - - + + + + &Number of Data Columns: Set number of data characters in a row - may be set to more than this depending on data - + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - + cmbPDFCols - - + + 21 @@ -48,181 +48,181 @@ be set to more than this depending on data be set to more than this depending on data - + Automatic - + 1 - + 2 - + 3 - + 4 - + 5 - + 6 - + 7 - + 8 - + 9 - + 10 - + 11 - + 12 - + 13 - + 14 - + 15 - + 16 - + 17 - + 18 - + 19 - + 20 - + 21 - + 22 - + 23 - + 24 - + 25 - + 26 - + 27 - + 28 - + 29 - + 30 - - - + + + Number of Ro&ws: Set number of rows - may be set to more than this depending on data and columns setting - + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - + cmbPDFRows - - + + 21 @@ -231,520 +231,638 @@ this depending on data and columns setting this depending on data and columns setting - + Automatic - + 3 - + 4 - + 5 - + 6 - + 7 - + 8 - + 9 - + 10 - + 11 - + 12 - + 13 - + 14 - + 15 - + 16 - + 17 - + 18 - + 19 - + 20 - + 21 - + 22 - + 23 - + 24 - + 25 - + 26 - + 27 - + 28 - + 29 - + 30 - + 31 - + 32 - + 33 - + 34 - + 35 - + 36 - + 37 - + 38 - + 39 - + 40 - + 41 - + 42 - + 43 - + 44 - + 45 - + 46 - + 47 - + 48 - + 49 - + 50 - + 51 - + 52 - + 53 - + 54 - + 55 - + 56 - + 57 - + 58 - + 59 - + 60 - + 61 - + 62 - + 63 - + 64 - + 65 - + 66 - + 67 - + 68 - + 69 - + 70 - + 71 - + 72 - + 73 - + 74 - + 75 - + 76 - + 77 - + 78 - + 79 - + 80 - + 81 - + 82 - + 83 - + 84 - + 85 - + 86 - + 87 - + 88 - + 89 - + 90 - - - + + + + false + + + Height per row in X-dimensions +Only available if "Automatic Height" in +the Appearance tab is not checked +(ignored if disabled) + + + Row &Height: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + spnPDFHeightPerRow + + + + + + + + + false + + + Height per row in X-dimensions +Only available if "Automatic Height" in +the Appearance tab is not checked +(ignored if disabled) + + + true + + + + + + X + + + 3 + + + 0 + + + 2000.000000000000000 + + + 0.100000000000000 + + + 0 + + + 0 (Disabled) + + + + 2 + 0 + + + + + + + + Set height per row to 0 +("Height" in the Appearance +tab will be re-enabled) + + + Disabl&e + + + + 1 + 0 + + + + + 30 + 20 + + + + + + + + Set height per row to default value + + + De&fault + + + + 1 + 0 + + + + + 30 + 20 + + + + + + + + + E&rror Correction Capacity: Set number of error correction characters - + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - + cmbPDFECC - - + + Set number of error correction characters - + Automatic - + 0 (2 words) - + 1 (4 words) - + 2 (8 words) - + 3 (16 words) - + 4 (32 words) - + 5 (64 words) - + 6 (128 words) - + 7 (256 words) - + 8 (512 words) @@ -780,7 +898,7 @@ this depending on data and columns setting - H&IBC PDF417 + H&IBC Process data as a Health Industry Barcode (HIBC) @@ -902,7 +1020,20 @@ Value ranges from 1 to count - + + + + Qt::Horizontal + + + + 10 + 20 + + + + + false @@ -925,7 +1056,7 @@ Maximum length 30 (10 triplets) - + false @@ -940,17 +1071,29 @@ Numbers only, in triplets ranging from 000 to 899 Maximum length 30 (10 triplets) (ignored if disabled) + + + 1 + 0 + + + + + 50 + 20 + + - - + + Qt::Vertical - + 20 52 diff --git a/frontend_qt/grpQR.ui b/frontend_qt/grpQR.ui index b4b7eb74..565cbc66 100644 --- a/frontend_qt/grpQR.ui +++ b/frontend_qt/grpQR.ui @@ -19,9 +19,9 @@ Form - + - + @@ -403,7 +403,7 @@ formatted with Application Identifiers (AIs) - H&IBC QR Code + H&IBC Process data as a Health Industry Barcode (HIBC) @@ -746,7 +746,7 @@ Value ranges from 0 to 255 - + Qt::Vertical diff --git a/frontend_qt/grpUPCA.ui b/frontend_qt/grpUPCA.ui index 3733c7d5..767962d6 100644 --- a/frontend_qt/grpUPCA.ui +++ b/frontend_qt/grpUPCA.ui @@ -19,9 +19,9 @@ Form - + - + @@ -89,7 +89,7 @@ descend below the main bars (default 5X) - + Height in X-dimensions that the guard bars @@ -169,7 +169,7 @@ to default 5X - + Qt::Vertical diff --git a/frontend_qt/grpUPCEAN.ui b/frontend_qt/grpUPCEAN.ui index 8ec339bd..bec68d3d 100644 --- a/frontend_qt/grpUPCEAN.ui +++ b/frontend_qt/grpUPCEAN.ui @@ -19,9 +19,9 @@ Form - + - + @@ -99,7 +99,7 @@ descend below the main bars (default 5X) - + Height in X-dimensions that the guard bars @@ -179,7 +179,7 @@ to default 5X - + Qt::Vertical diff --git a/frontend_qt/mainwindow.cpp b/frontend_qt/mainwindow.cpp index 8a61628f..5ffef2a4 100644 --- a/frontend_qt/mainwindow.cpp +++ b/frontend_qt/mainwindow.cpp @@ -125,7 +125,9 @@ static const struct bstyle_item bstyle_items[] = { }; MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags fl) - : QWidget(parent, fl), m_optionWidget(nullptr), m_symbology(0), m_saveAsShortcut(nullptr), m_menu(nullptr) + : QWidget(parent, fl), m_optionWidget(nullptr), m_symbology(0), m_saveAsShortcut(nullptr), m_menu(nullptr), + m_lblHeightPerRow(nullptr), m_spnHeightPerRow(nullptr), + m_btnHeightPerRowDisable(nullptr), m_btnHeightPerRowDefault(nullptr) { // Undocumented command line debug flag m_bc.bc.setDebug(QCoreApplication::arguments().contains(QSL("--verbose"))); @@ -518,6 +520,24 @@ void MainWindow::autoheight_ui_set() bool enabled = chkAutoHeight->isEnabled() && !chkAutoHeight->isChecked(); lblHeight->setEnabled(enabled); heightb->setEnabled(enabled); + + if (m_lblHeightPerRow && m_spnHeightPerRow) { + m_lblHeightPerRow->setEnabled(enabled); + m_spnHeightPerRow->setEnabled(enabled); + if (enabled && m_spnHeightPerRow->value()) { + lblHeight->setEnabled(!enabled); + heightb->setEnabled(!enabled); + statusBar->showMessage(tr("Using \"Row Height\""), statusBarTimeout); + } else { + statusBar->clearMessage(); + } + if (m_btnHeightPerRowDisable) { + m_btnHeightPerRowDisable->setEnabled(enabled && m_spnHeightPerRow->value()); + } + if (m_btnHeightPerRowDefault) { + m_btnHeightPerRowDefault->setEnabled(enabled); + } + } } void MainWindow::HRTShow_ui_set() @@ -634,7 +654,7 @@ void MainWindow::on_encoded() enableActions(true); errtxtBar_set(false /*isError*/); - if (!chkAutoHeight->isEnabled() || chkAutoHeight->isChecked()) { + if (!chkAutoHeight->isEnabled() || chkAutoHeight->isChecked() || !heightb->isEnabled()) { /* setValue() rounds up/down to precision (decimals 3), we want round up only */ float height = (float) (ceil(m_bc.bc.height() * 1000.0f) / 1000.0f); heightb->setValue(height); @@ -779,6 +799,52 @@ void MainWindow::copy_to_clipboard_errtxt() } } +void MainWindow::height_per_row_disable() +{ + if (m_spnHeightPerRow) { + m_spnHeightPerRow->setValue(0.0); + } +} + +void MainWindow::height_per_row_default() +{ + if (m_spnHeightPerRow && m_btnHeightPerRowDefault) { + const QString &name = m_btnHeightPerRowDefault->objectName(); + double val = 0.0; + if (name == QSL("btnPDFHeightPerRowDefault")) { + val = 3.0; + } else if (name == QSL("btnMPDFHeightPerRowDefault")) { + val = 2.0; + } else if (name == QSL("btnC16kHeightPerRowDefault")) { + if (chkCompliantHeight->isEnabled() && chkCompliantHeight->isChecked()) { + const int rows = m_bc.bc.encodedRows(); + val = 10.0 + (double)((rows - 1) * (get_cmb_index(QSL("cmbC16kRowSepHeight")) + 1)) / rows; + } else { + val = 10.0; + } + } else if (name == QSL("btnCbfHeightPerRowDefault")) { + // Depends on no. of data cols + const int cols = (m_bc.bc.encodedWidth() - 57) / 11; // 57 = 4 * 11 (start/subset/checks) + 13 (stop char) + val = 0.55 * cols + 3; + if (val < 10.0) { + val = 10.0; + } + } else if (name == QSL("btnC49HeightPerRowDefault")) { + if (chkCompliantHeight->isEnabled() && chkCompliantHeight->isChecked()) { + const int rows = m_bc.bc.encodedRows(); + val = 10.0 + (double)((rows - 1) * (get_cmb_index(QSL("cmbC49RowSepHeight")) + 1)) / rows; + } else { + val = 10.0; + } + } else if (name == QSL("btnDBESHeightPerRowDefault")) { + val = 34.0; + } + if (val) { + m_spnHeightPerRow->setValue(val); + } + } +} + void MainWindow::guard_reset_upcean() { guard_reset(QSL("spnUPCEANGuardDescent")); @@ -812,6 +878,7 @@ void MainWindow::view_context_menu(const QPoint &pos) #endif menu.addAction(m_copySVGAct); menu.addAction(m_copyTIFAct); + menu.addSeparator(); menu.addAction(m_saveAsAct); menu.exec(get_context_menu_pos(pos, view)); @@ -853,6 +920,10 @@ void MainWindow::change_options() cmbECI->setItemText(25, tr("29: GB 2312 (PRC)")); btype->setItemText(0, tr("No border")); combobox_item_enabled(cmbFontSetting, 1, true); + m_lblHeightPerRow = nullptr; + m_spnHeightPerRow = nullptr; + m_btnHeightPerRowDisable = nullptr; + m_btnHeightPerRowDefault = nullptr; if (symbology == BARCODE_CODE128) { QFile file(QSL(":/grpC128.ui")); @@ -883,6 +954,14 @@ void MainWindow::change_options() connect(get_widget(QSL("cmbPDFECC")), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); connect(get_widget(QSL("cmbPDFCols")), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); connect(get_widget(QSL("cmbPDFRows")), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + m_lblHeightPerRow = m_optionWidget->findChild(QSL("lblPDFHeightPerRow")); + m_spnHeightPerRow = m_optionWidget->findChild(QSL("spnPDFHeightPerRow")); + connect(m_spnHeightPerRow, SIGNAL(valueChanged( double )), SLOT(autoheight_ui_set())); + connect(m_spnHeightPerRow, SIGNAL(valueChanged( double )), SLOT(update_preview())); + m_btnHeightPerRowDisable = m_optionWidget->findChild(QSL("btnPDFHeightPerRowDisable")); + m_btnHeightPerRowDefault = m_optionWidget->findChild(QSL("btnPDFHeightPerRowDefault")); + connect(m_btnHeightPerRowDisable, SIGNAL(clicked( bool )), SLOT(height_per_row_disable())); + connect(m_btnHeightPerRowDefault, SIGNAL(clicked( bool )), SLOT(height_per_row_default())); connect(get_widget(QSL("radPDFTruncated")), SIGNAL(toggled( bool )), SLOT(update_preview())); connect(get_widget(QSL("radPDFStand")), SIGNAL(toggled( bool )), SLOT(update_preview())); connect(get_widget(QSL("radPDFHIBC")), SIGNAL(toggled( bool )), SLOT(update_preview())); @@ -901,6 +980,14 @@ void MainWindow::change_options() structapp_ui_set(); tabMain->insertTab(1, m_optionWidget, tr("Micro PDF41&7")); connect(get_widget(QSL("cmbMPDFCols")), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + m_lblHeightPerRow = m_optionWidget->findChild(QSL("lblMPDFHeightPerRow")); + m_spnHeightPerRow = m_optionWidget->findChild(QSL("spnMPDFHeightPerRow")); + connect(m_spnHeightPerRow, SIGNAL(valueChanged( double )), SLOT(autoheight_ui_set())); + connect(m_spnHeightPerRow, SIGNAL(valueChanged( double )), SLOT(update_preview())); + m_btnHeightPerRowDisable = m_optionWidget->findChild(QSL("btnMPDFHeightPerRowDisable")); + m_btnHeightPerRowDefault = m_optionWidget->findChild(QSL("btnMPDFHeightPerRowDefault")); + connect(m_btnHeightPerRowDisable, SIGNAL(clicked( bool )), SLOT(height_per_row_disable())); + connect(m_btnHeightPerRowDefault, SIGNAL(clicked( bool )), SLOT(height_per_row_default())); connect(get_widget(QSL("radMPDFStand")), SIGNAL(toggled( bool )), SLOT(update_preview())); connect(get_widget(QSL("spnMPDFStructAppCount")), SIGNAL(valueChanged( int )), SLOT(update_preview())); connect(get_widget(QSL("spnMPDFStructAppCount")), SIGNAL(valueChanged( int )), SLOT(structapp_ui_set())); @@ -1034,6 +1121,15 @@ void MainWindow::change_options() load_sub_settings(settings, symbology); tabMain->insertTab(1, m_optionWidget, tr("Cod&e 16K")); btype->setItemText(0, tr("Default (bind)")); + connect(get_widget(QSL("cmbC16kRows")), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + m_lblHeightPerRow = m_optionWidget->findChild(QSL("lblC16kHeightPerRow")); + m_spnHeightPerRow = m_optionWidget->findChild(QSL("spnC16kHeightPerRow")); + connect(m_spnHeightPerRow, SIGNAL(valueChanged( double )), SLOT(autoheight_ui_set())); + connect(m_spnHeightPerRow, SIGNAL(valueChanged( double )), SLOT(update_preview())); + m_btnHeightPerRowDisable = m_optionWidget->findChild(QSL("btnC16kHeightPerRowDisable")); + m_btnHeightPerRowDefault = m_optionWidget->findChild(QSL("btnC16kHeightPerRowDefault")); + connect(m_btnHeightPerRowDisable, SIGNAL(clicked( bool )), SLOT(height_per_row_disable())); + connect(m_btnHeightPerRowDefault, SIGNAL(clicked( bool )), SLOT(height_per_row_default())); connect(get_widget(QSL("cmbC16kRowSepHeight")), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); connect(get_widget(QSL("radC16kStand")), SIGNAL(toggled( bool )), SLOT(update_preview())); connect(get_widget(QSL("chkC16kNoQuietZones")), SIGNAL(toggled( bool )), SLOT(update_preview())); @@ -1061,6 +1157,14 @@ void MainWindow::change_options() btype->setItemText(0, tr("Default (bind)")); connect(get_widget(QSL("cmbCbfWidth")), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); connect(get_widget(QSL("cmbCbfHeight")), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + m_lblHeightPerRow = m_optionWidget->findChild(QSL("lblCbfHeightPerRow")); + m_spnHeightPerRow = m_optionWidget->findChild(QSL("spnCbfHeightPerRow")); + connect(m_spnHeightPerRow, SIGNAL(valueChanged( double )), SLOT(autoheight_ui_set())); + connect(m_spnHeightPerRow, SIGNAL(valueChanged( double )), SLOT(update_preview())); + m_btnHeightPerRowDisable = m_optionWidget->findChild(QSL("btnCbfHeightPerRowDisable")); + m_btnHeightPerRowDefault = m_optionWidget->findChild(QSL("btnCbfHeightPerRowDefault")); + connect(m_btnHeightPerRowDisable, SIGNAL(clicked( bool )), SLOT(height_per_row_disable())); + connect(m_btnHeightPerRowDefault, SIGNAL(clicked( bool )), SLOT(height_per_row_default())); connect(get_widget(QSL("cmbCbfRowSepHeight")), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); connect(get_widget(QSL("radCbfStand")), SIGNAL(toggled( bool )), SLOT(update_preview())); connect(get_widget(QSL("radCbfHIBC")), SIGNAL(toggled( bool )), SLOT(update_preview())); @@ -1250,6 +1354,15 @@ void MainWindow::change_options() load_sub_settings(settings, symbology); tabMain->insertTab(1, m_optionWidget, tr("Cod&e 49")); btype->setItemText(0, tr("Default (bind)")); + connect(get_widget(QSL("cmbC49Rows")), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + m_lblHeightPerRow = m_optionWidget->findChild(QSL("lblC49HeightPerRow")); + m_spnHeightPerRow = m_optionWidget->findChild(QSL("spnC49HeightPerRow")); + connect(m_spnHeightPerRow, SIGNAL(valueChanged( double )), SLOT(autoheight_ui_set())); + connect(m_spnHeightPerRow, SIGNAL(valueChanged( double )), SLOT(update_preview())); + m_btnHeightPerRowDisable = m_optionWidget->findChild(QSL("btnC49HeightPerRowDisable")); + m_btnHeightPerRowDefault = m_optionWidget->findChild(QSL("btnC49HeightPerRowDefault")); + connect(m_btnHeightPerRowDisable, SIGNAL(clicked( bool )), SLOT(height_per_row_disable())); + connect(m_btnHeightPerRowDefault, SIGNAL(clicked( bool )), SLOT(height_per_row_default())); connect(get_widget(QSL("cmbC49RowSepHeight")), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); connect(get_widget(QSL("radC49GS1")), SIGNAL(toggled( bool )), SLOT(update_preview())); connect(get_widget(QSL("chkC49NoQuietZones")), SIGNAL(toggled( bool )), SLOT(update_preview())); @@ -1271,8 +1384,19 @@ void MainWindow::change_options() m_optionWidget = uiload.load(&file); file.close(); load_sub_settings(settings, symbology); - tabMain->insertTab(1, m_optionWidget, tr("GS1 DataBar Stack&ed")); - connect(get_widget(QSL("cmbCols")), SIGNAL(currentIndexChanged ( int )), SLOT(update_preview())); + tabMain->insertTab(1, m_optionWidget, tr("GS1 D&ataBar Exp Stack")); + connect(get_widget(QSL("radDBESCols")), SIGNAL(toggled( bool )), SLOT(update_preview())); + connect(get_widget(QSL("radDBESRows")), SIGNAL(toggled( bool )), SLOT(update_preview())); + connect(get_widget(QSL("cmbDBESCols")), SIGNAL(currentIndexChanged ( int )), SLOT(update_preview())); + connect(get_widget(QSL("cmbDBESRows")), SIGNAL(currentIndexChanged ( int )), SLOT(update_preview())); + m_lblHeightPerRow = m_optionWidget->findChild(QSL("lblDBESHeightPerRow")); + m_spnHeightPerRow = m_optionWidget->findChild(QSL("spnDBESHeightPerRow")); + connect(m_spnHeightPerRow, SIGNAL(valueChanged( double )), SLOT(autoheight_ui_set())); + connect(m_spnHeightPerRow, SIGNAL(valueChanged( double )), SLOT(update_preview())); + m_btnHeightPerRowDisable = m_optionWidget->findChild(QSL("btnDBESHeightPerRowDisable")); + m_btnHeightPerRowDefault = m_optionWidget->findChild(QSL("btnDBESHeightPerRowDefault")); + connect(m_btnHeightPerRowDisable, SIGNAL(clicked( bool )), SLOT(height_per_row_disable())); + connect(m_btnHeightPerRowDefault, SIGNAL(clicked( bool )), SLOT(height_per_row_default())); } else if (symbology == BARCODE_ULTRA) { QFile file(QSL(":/grpUltra.ui")); @@ -1642,8 +1766,15 @@ void MainWindow::update_preview() break; case BARCODE_DBAR_EXPSTK: m_bc.bc.setSymbol(chkComposite->isChecked() ? BARCODE_DBAR_EXPSTK_CC : BARCODE_DBAR_EXPSTK); - if ((item_val = get_cmb_index(QSL("cmbCols"))) != 0) - m_bc.bc.setOption2(item_val); + if (get_rad_val(QSL("radDBESCols"))) { + if ((item_val = get_cmb_index(QSL("cmbDBESCols"))) != 0) { + m_bc.bc.setOption2(item_val); + } + } else if (get_rad_val(QSL("radDBESRows"))) { + if ((item_val = get_cmb_index(QSL("cmbDBESRows"))) != 0) { + m_bc.bc.setOption3(item_val + 1); // Begins at 2 + } + } break; case BARCODE_PDF417: @@ -1769,6 +1900,9 @@ void MainWindow::update_preview() case BARCODE_CODE16K: m_bc.bc.setSymbol(BARCODE_CODE16K); set_gs1_mode(get_rad_val(QSL("radC16kGS1"))); + if ((item_val = get_cmb_index(QSL("cmbC16kRows"))) != 0) { + m_bc.bc.setOption1(item_val + 2); // Starts at 3 + } // Row separator height selection uses option 3 in zint_symbol if ((item_val = get_cmb_index(QSL("cmbC16kRowSepHeight"))) != 0) { m_bc.bc.setOption3(item_val + 1); // Zero-based @@ -1997,6 +2131,9 @@ void MainWindow::update_preview() case BARCODE_CODE49: m_bc.bc.setSymbol(BARCODE_CODE49); set_gs1_mode(get_rad_val(QSL("radC49GS1"))); + if ((item_val = get_cmb_index(QSL("cmbC49Rows"))) != 0) { + m_bc.bc.setOption1(item_val + 2); // Starts at 3 + } // Row separator height selection uses option 3 in zint_symbol if ((item_val = get_cmb_index(QSL("cmbC49RowSepHeight"))) != 0) { m_bc.bc.setOption3(item_val + 1); // Zero-based @@ -2075,7 +2212,13 @@ void MainWindow::update_preview() if (!chkAutoHeight->isEnabled() || chkAutoHeight->isChecked()) { m_bc.bc.setHeight(0); } else { - m_bc.bc.setHeight(heightb->value()); + if (m_spnHeightPerRow && m_spnHeightPerRow->isEnabled() && m_spnHeightPerRow->value()) { + // This causes a double-encode unfortunately, as heightb gets synced + m_bc.bc.setInputMode(m_bc.bc.inputMode() | HEIGHTPERROW_MODE); + m_bc.bc.setHeight(m_spnHeightPerRow->value()); + } else { + m_bc.bc.setHeight(heightb->value()); + } } m_bc.bc.setCompliantHeight(chkCompliantHeight->isEnabled() && chkCompliantHeight->isChecked()); m_bc.bc.setECI(cmbECI->isEnabled() ? cmbECI->currentIndex() : 0); @@ -2309,7 +2452,7 @@ QPoint MainWindow::get_context_menu_pos(const QPoint &pos, QWidget *widget) /* Shorthand to find widget child as generic QWidget */ QWidget *MainWindow::get_widget(const QString &name) { - return m_optionWidget->findChild(name); + return m_optionWidget ? m_optionWidget->findChild(name) : nullptr; } /* Return settings subsection name for a symbol */ @@ -2679,6 +2822,7 @@ void MainWindow::save_sub_settings(QSettings &settings, int symbology) case BARCODE_HIBC_PDF: settings.setValue(QSL("studio/bc/pdf417/cols"), get_cmb_index(QSL("cmbPDFCols"))); settings.setValue(QSL("studio/bc/pdf417/rows"), get_cmb_index(QSL("cmbPDFRows"))); + settings.setValue(QSL("studio/bc/pdf417/height_per_row"), get_dspn_val(QSL("spnPDFHeightPerRow"))); settings.setValue(QSL("studio/bc/pdf417/ecc"), get_cmb_index(QSL("cmbPDFECC"))); settings.setValue(QSL("studio/bc/pdf417/encoding_mode"), get_rad_grp_index( QStringList() << QSL("radPDFStand") << QSL("radPDFTruncated") << QSL("radPDFHIBC"))); @@ -2690,6 +2834,7 @@ void MainWindow::save_sub_settings(QSettings &settings, int symbology) case BARCODE_MICROPDF417: case BARCODE_HIBC_MICPDF: settings.setValue(QSL("studio/bc/micropdf417/cols"), get_cmb_index(QSL("cmbMPDFCols"))); + settings.setValue(QSL("studio/bc/micropdf417/height_per_row"), get_dspn_val(QSL("spnMPDFHeightPerRow"))); settings.setValue(QSL("studio/bc/micropdf417/encoding_mode"), get_rad_grp_index( QStringList() << QSL("radMPDFStand") << QSL("radMPDFHIBC"))); settings.setValue(QSL("studio/bc/micropdf417/structapp_count"), @@ -2770,6 +2915,8 @@ void MainWindow::save_sub_settings(QSettings &settings, int symbology) break; case BARCODE_CODE16K: + settings.setValue(QSL("studio/bc/code16k/rows"), get_cmb_index(QSL("cmbC16kRows"))); + settings.setValue(QSL("studio/bc/code16k/height_per_row"), get_dspn_val(QSL("spnC16kHeightPerRow"))); settings.setValue(QSL("studio/bc/code16k/row_sep_height"), get_cmb_index(QSL("cmbC16kRowSepHeight"))); settings.setValue(QSL("studio/bc/code16k/encoding_mode"), get_rad_grp_index( QStringList() << QSL("radC16kStand") << QSL("radC16kGS1"))); @@ -2785,6 +2932,7 @@ void MainWindow::save_sub_settings(QSettings &settings, int symbology) case BARCODE_HIBC_BLOCKF: settings.setValue(QSL("studio/bc/codablockf/width"), get_cmb_index(QSL("cmbCbfWidth"))); settings.setValue(QSL("studio/bc/codablockf/height"), get_cmb_index(QSL("cmbCbfHeight"))); + settings.setValue(QSL("studio/bc/codablockf/height_per_row"), get_dspn_val(QSL("spnCbfHeightPerRow"))); settings.setValue(QSL("studio/bc/codablockf/row_sep_height"), get_cmb_index(QSL("cmbCbfRowSepHeight"))); settings.setValue(QSL("studio/bc/codablockf/encoding_mode"), get_rad_grp_index( QStringList() << QSL("radCbfStand") << QSL("radCbfHIBC"))); @@ -2881,6 +3029,8 @@ void MainWindow::save_sub_settings(QSettings &settings, int symbology) break; case BARCODE_CODE49: + settings.setValue(QSL("studio/bc/code49/rows"), get_cmb_index(QSL("cmbC49Rows"))); + settings.setValue(QSL("studio/bc/code49/height_per_row"), get_dspn_val(QSL("spnC49HeightPerRow"))); settings.setValue(QSL("studio/bc/code49/row_sep_height"), get_cmb_index(QSL("cmbC49RowSepHeight"))); settings.setValue(QSL("studio/bc/code49/encoding_mode"), get_rad_grp_index( QStringList() << QSL("radC49Stand") << QSL("radC49GS1"))); @@ -2893,7 +3043,11 @@ void MainWindow::save_sub_settings(QSettings &settings, int symbology) case BARCODE_DBAR_EXPSTK: case BARCODE_DBAR_EXPSTK_CC: - settings.setValue(QSL("studio/bc/dbar_expstk/cols"), get_cmb_index(QSL("cmbCols"))); + settings.setValue(QSL("studio/bc/dbar_expstk/colsrows"), get_rad_grp_index( + QStringList() << QSL("radDBESCols") << QSL("radDBESRows"))); + settings.setValue(QSL("studio/bc/dbar_expstk/cols"), get_cmb_index(QSL("cmbDBESCols"))); + settings.setValue(QSL("studio/bc/dbar_expstk/rows"), get_cmb_index(QSL("cmbDBESRows"))); + settings.setValue(QSL("studio/bc/dbar_expstk/height_per_row"), get_dspn_val(QSL("spnDBESHeightPerRow"))); break; case BARCODE_ULTRA: @@ -3034,6 +3188,7 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology) case BARCODE_HIBC_PDF: set_cmb_from_setting(settings, QSL("studio/bc/pdf417/cols"), QSL("cmbPDFCols")); set_cmb_from_setting(settings, QSL("studio/bc/pdf417/rows"), QSL("cmbPDFRows")); + set_dspn_from_setting(settings, QSL("studio/bc/pdf417/height_per_row"), QSL("spnPDFHeightPerRow"), 0.0f); set_cmb_from_setting(settings, QSL("studio/bc/pdf417/ecc"), QSL("cmbPDFECC")); set_rad_from_setting(settings, QSL("studio/bc/pdf417/encoding_mode"), QStringList() << QSL("radPDFStand") << QSL("radPDFTruncated") << QSL("radPDFHIBC")); @@ -3045,6 +3200,8 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology) case BARCODE_MICROPDF417: case BARCODE_HIBC_MICPDF: set_cmb_from_setting(settings, QSL("studio/bc/micropdf417/cols"), QSL("cmbMPDFCols")); + set_dspn_from_setting(settings, QSL("studio/bc/micropdf417/height_per_row"), QSL("spnMPDFHeightPerRow"), + 0.0f); set_rad_from_setting(settings, QSL("studio/bc/micropdf417/encoding_mode"), QStringList() << QSL("radMPDFStand") << QSL("radMPDFHIBC")); set_spn_from_setting(settings, QSL("studio/bc/micropdf417/structapp_count"), @@ -3127,6 +3284,9 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology) break; case BARCODE_CODE16K: + set_cmb_from_setting(settings, QSL("studio/bc/code16k/rows"), QSL("cmbC16kRows")); + set_dspn_from_setting(settings, QSL("studio/bc/code16k/height_per_row"), QSL("spnC16kHeightPerRow"), + 0.0f); set_cmb_from_setting(settings, QSL("studio/bc/code16k/row_sep_height"), QSL("cmbC16kRowSepHeight")); set_rad_from_setting(settings, QSL("studio/bc/code16k/encoding_mode"), QStringList() << QSL("radC16kStand") << QSL("radC16kGS1")); @@ -3142,6 +3302,8 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology) case BARCODE_HIBC_BLOCKF: set_cmb_from_setting(settings, QSL("studio/bc/codablockf/width"), QSL("cmbCbfWidth")); set_cmb_from_setting(settings, QSL("studio/bc/codablockf/height"), QSL("cmbCbfHeight")); + set_dspn_from_setting(settings, QSL("studio/bc/codablockf/height_per_row"), QSL("spnCbfHeightPerRow"), + 0.0f); set_cmb_from_setting(settings, QSL("studio/bc/codablockf/row_sep_height"), QSL("cmbCbfRowSepHeight")); set_rad_from_setting(settings, QSL("studio/bc/codablockf/encoding_mode"), @@ -3238,6 +3400,8 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology) break; case BARCODE_CODE49: + set_cmb_from_setting(settings, QSL("studio/bc/code49/rows"), QSL("cmbC49Rows")); + set_dspn_from_setting(settings, QSL("studio/bc/code49/height_per_row"), QSL("spnC49HeightPerRow"), 0.0f); set_cmb_from_setting(settings, QSL("studio/bc/code49/row_sep_height"), QSL("cmbC49RowSepHeight")); set_rad_from_setting(settings, QSL("studio/bc/code49/encoding_mode"), QStringList() << QSL("radC49Stand") << QSL("radC49GS1")); @@ -3249,7 +3413,12 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology) break; case BARCODE_DBAR_EXPSTK: - set_cmb_from_setting(settings, QSL("studio/bc/dbar_expstk/cols"), QSL("cmbCols")); + set_rad_from_setting(settings, QSL("studio/bc/dbar_expstk/colsrows"), + QStringList() << QSL("radDBESCols") << QSL("radDBESRows")); + set_cmb_from_setting(settings, QSL("studio/bc/dbar_expstk/cols"), QSL("cmbDBESCols")); + set_cmb_from_setting(settings, QSL("studio/bc/dbar_expstk/rows"), QSL("cmbDBESRows")); + set_dspn_from_setting(settings, QSL("studio/bc/dbar_expstk/height_per_row"), QSL("spnDBESHeightPerRow"), + 0.0f); break; case BARCODE_ULTRA: diff --git a/frontend_qt/mainwindow.h b/frontend_qt/mainwindow.h index bb36fd69..b5923f05 100644 --- a/frontend_qt/mainwindow.h +++ b/frontend_qt/mainwindow.h @@ -22,12 +22,15 @@ #include #include #include +#include #include "ui_mainWindow.h" #include "barcodeitem.h" class QLabel; class QShortcut; +class QDoubleSpinBox; +class QPushButton; class MainWindow : public QWidget, private Ui::mainWindow { @@ -82,6 +85,9 @@ public slots: void copy_to_clipboard_errtxt(); + void height_per_row_disable(); + void height_per_row_default(); + void guard_reset_upcean(); void guard_reset_upca(); @@ -160,6 +166,10 @@ private: QAction *m_helpAct; QAction *m_quitAct; QAction *m_copyErrtxtAct; + QLabel *m_lblHeightPerRow; + QDoubleSpinBox *m_spnHeightPerRow; + QPushButton *m_btnHeightPerRowDisable; + QPushButton *m_btnHeightPerRowDefault; }; #endif