mirror of
https://git.code.sf.net/p/zint/code
synced 2025-06-04 08:49:45 -04:00
Add compliant height, using ZINT_COMPLIANT_HEIGHT flag for back-compatibility
Rename barcode funcs to same as BARCODE_XXX name library: barcode funcs array for dispatch, used for ZBarcode_ValidID() also general: change is_sane() comparison to nonzero from ZINT_ERROR_INVALID_OPTION MAILMARK: fuller error messages CODABAR: add option to show check character in HRT zint.h: use 0xNNNN for OR-able defines GUI: add guard descent height reset button, add Zint version to window title, static get_zint_version() method, use QStringLiteral (QSL shorthand), use SIGNAL(toggled()), add errtxt "popup" and status bar, add icons, add saveAs shortcut, add main menu, context menus and actions, add help, reset_view() -> reset_colours(), add copy to clipboard as EMF/GIF/PNG/TIF, lessen triggering of update_preview(), shorten names of getters/setters, simplify/shorten some update_preview() logic in switch, CODEONE disable structapp for Version S qzint.cpp: add on_errored signal, add missing getters, add test
This commit is contained in:
parent
206ae26d20
commit
72eac41c34
82 changed files with 5570 additions and 3774 deletions
|
@ -150,10 +150,10 @@ static void test_input(int index, int debug) {
|
|||
/* 3*/ { BARCODE_AUSPOST, "12345678ABcd!", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 404: Invalid character in data (alphanumerics, space and \"#\" only)" },
|
||||
/* 4*/ { BARCODE_AUSPOST, "12345678ABcd#", 0, 3, 103, "" },
|
||||
/* 5*/ { BARCODE_AUSPOST, "1234567890123456", 0, 3, 103, "" },
|
||||
/* 6*/ { BARCODE_AUSPOST, "123456789012345A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 402: Invalid character in data (digits only for lengths 16 and 23)" },
|
||||
/* 6*/ { BARCODE_AUSPOST, "123456789012345A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 402: Invalid character in data (digits only for length 16)" },
|
||||
/* 7*/ { BARCODE_AUSPOST, "12345678ABCDefgh #", 0, 3, 133, "" }, // Length 18
|
||||
/* 8*/ { BARCODE_AUSPOST, "12345678901234567890123", 0, 3, 133, "" },
|
||||
/* 9*/ { BARCODE_AUSPOST, "1234567890123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 402: Invalid character in data (digits only for lengths 16 and 23)" },
|
||||
/* 9*/ { BARCODE_AUSPOST, "1234567890123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 406: Invalid character in data (digits only for length 23)" },
|
||||
/* 10*/ { BARCODE_AUSPOST, "1234567", ZINT_ERROR_TOO_LONG, -1, -1, "Error 401: Auspost input is wrong length (8, 13, 16, 18 or 23 characters only)" }, // No leading zeroes added
|
||||
/* 11*/ { BARCODE_AUSREPLY, "12345678", 0, 3, 73, "" },
|
||||
/* 12*/ { BARCODE_AUSREPLY, "1234567", 0, 3, 73, "" }, // Leading zeroes added
|
||||
|
|
|
@ -270,7 +270,8 @@ static void test_input(int index, int debug) {
|
|||
/* 32*/ { -1, -1, -1, { 0, 2, "" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 712: Structured Append index out of range (1-2)", },
|
||||
/* 33*/ { -1, -1, -1, { 3, 2, "" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 712: Structured Append index out of range (1-2)", },
|
||||
/* 34*/ { -1, -1, -1, { 1, 2, "1" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 713: Structured Append ID not available for Code One", },
|
||||
/* 35*/ { -1, -1, 9, { 1, 2, "" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 714: Structured Append not supported for Version S", },
|
||||
/* 35*/ { -1, -1, 9, { 1, 2, "" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 714: Structured Append not available for Version S", },
|
||||
/* 36*/ { -1, -1, 9, { 3, 2, "" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 714: Structured Append not available for Version S", }, // Trumps other checking
|
||||
};
|
||||
int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
|
|
|
@ -471,10 +471,10 @@ static void test_cap(int index) {
|
|||
/* 0*/ { BARCODE_CODE128, ZINT_CAP_HRT, ZINT_CAP_HRT },
|
||||
/* 1*/ { BARCODE_CODE128, ZINT_CAP_HRT | ZINT_CAP_STACKABLE | ZINT_CAP_GS1, ZINT_CAP_HRT | ZINT_CAP_STACKABLE },
|
||||
/* 2*/ { BARCODE_PDF417, ZINT_CAP_HRT | ZINT_CAP_ECI | ZINT_CAP_GS1 | ZINT_CAP_READER_INIT | ZINT_CAP_FULL_MULTIBYTE, ZINT_CAP_ECI | ZINT_CAP_READER_INIT },
|
||||
/* 3*/ { BARCODE_QRCODE, ZINT_CAP_HRT | ZINT_CAP_ECI | ZINT_CAP_GS1 | ZINT_CAP_DOTTY | ZINT_CAP_READER_INIT | ZINT_CAP_FULL_MULTIBYTE | ZINT_CAP_MASK | ZINT_CAP_STRUCTAPP, ZINT_CAP_ECI | ZINT_CAP_GS1 | ZINT_CAP_DOTTY | ZINT_CAP_FULL_MULTIBYTE | ZINT_CAP_MASK | ZINT_CAP_STRUCTAPP },
|
||||
/* 4*/ { BARCODE_EANX_CC, ZINT_CAP_HRT | ZINT_CAP_COMPOSITE | ZINT_CAP_EXTENDABLE | ZINT_CAP_ECI | ZINT_CAP_GS1 | ZINT_CAP_QUIET_ZONES, ZINT_CAP_HRT | ZINT_CAP_COMPOSITE | ZINT_CAP_EXTENDABLE | ZINT_CAP_GS1 | ZINT_CAP_QUIET_ZONES },
|
||||
/* 3*/ { BARCODE_QRCODE, ZINT_CAP_HRT | ZINT_CAP_ECI | ZINT_CAP_GS1 | ZINT_CAP_DOTTY | ZINT_CAP_READER_INIT | ZINT_CAP_FULL_MULTIBYTE | ZINT_CAP_MASK | ZINT_CAP_STRUCTAPP | ZINT_CAP_COMPLIANT_HEIGHT, ZINT_CAP_ECI | ZINT_CAP_GS1 | ZINT_CAP_DOTTY | ZINT_CAP_FULL_MULTIBYTE | ZINT_CAP_MASK | ZINT_CAP_STRUCTAPP },
|
||||
/* 4*/ { BARCODE_EANX_CC, ZINT_CAP_HRT | ZINT_CAP_COMPOSITE | ZINT_CAP_EXTENDABLE | ZINT_CAP_ECI | ZINT_CAP_GS1 | ZINT_CAP_QUIET_ZONES | ZINT_CAP_COMPLIANT_HEIGHT, ZINT_CAP_HRT | ZINT_CAP_COMPOSITE | ZINT_CAP_EXTENDABLE | ZINT_CAP_GS1 | ZINT_CAP_QUIET_ZONES | ZINT_CAP_COMPLIANT_HEIGHT },
|
||||
/* 5*/ { BARCODE_HANXIN, ZINT_CAP_DOTTY | ZINT_CAP_QUIET_ZONES | ZINT_CAP_FIXED_RATIO | ZINT_CAP_FULL_MULTIBYTE | ZINT_CAP_MASK, ZINT_CAP_DOTTY | ZINT_CAP_FIXED_RATIO | ZINT_CAP_FULL_MULTIBYTE | ZINT_CAP_MASK },
|
||||
/* 6*/ { BARCODE_CODE11, ZINT_CAP_DOTTY | ZINT_CAP_FIXED_RATIO | ZINT_CAP_FIXED_RATIO | ZINT_CAP_READER_INIT | ZINT_CAP_FULL_MULTIBYTE, 0 },
|
||||
/* 6*/ { BARCODE_CODE11, ZINT_CAP_DOTTY | ZINT_CAP_FIXED_RATIO | ZINT_CAP_FIXED_RATIO | ZINT_CAP_READER_INIT | ZINT_CAP_FULL_MULTIBYTE | ZINT_CAP_COMPLIANT_HEIGHT, 0 },
|
||||
/* 7*/ { BARCODE_POSTNET, ZINT_CAP_HRT | ZINT_CAP_STACKABLE | ZINT_CAP_EXTENDABLE | ZINT_CAP_COMPOSITE | ZINT_CAP_ECI | ZINT_CAP_GS1 | ZINT_CAP_DOTTY | ZINT_CAP_FIXED_RATIO | ZINT_CAP_READER_INIT | ZINT_CAP_FULL_MULTIBYTE | ZINT_CAP_MASK | ZINT_CAP_STRUCTAPP, 0 },
|
||||
/* 8*/ { 0, 0, 0 },
|
||||
};
|
||||
|
@ -495,6 +495,95 @@ static void test_cap(int index) {
|
|||
testFinish();
|
||||
}
|
||||
|
||||
static void test_cap_compliant_height() {
|
||||
int symbol_id;
|
||||
int ret;
|
||||
|
||||
testStart("test_cap_compliant_height");
|
||||
|
||||
for (symbol_id = 1; symbol_id <= BARCODE_RMQR; symbol_id++) {
|
||||
if (!ZBarcode_ValidID(symbol_id)) continue;
|
||||
|
||||
ret = ZBarcode_Cap(symbol_id, ZINT_CAP_COMPLIANT_HEIGHT);
|
||||
|
||||
switch (symbol_id) {
|
||||
//case BARCODE_CODE11: /* TODO: Find doc */
|
||||
case BARCODE_C25INTER:
|
||||
case BARCODE_CODE39:
|
||||
case BARCODE_EXCODE39:
|
||||
case BARCODE_EANX:
|
||||
case BARCODE_EANX_CHK:
|
||||
case BARCODE_GS1_128:
|
||||
case BARCODE_CODABAR:
|
||||
//case BARCODE_DPLEIT: /* TODO: Find doc */
|
||||
//case BARCODE_DPIDENT: /* TODO: Find doc */
|
||||
case BARCODE_CODE16K:
|
||||
case BARCODE_CODE49:
|
||||
case BARCODE_CODE93:
|
||||
//case BARCODE_FLAT: /* TODO: Find doc */
|
||||
case BARCODE_DBAR_OMN:
|
||||
case BARCODE_DBAR_LTD:
|
||||
case BARCODE_DBAR_EXP:
|
||||
case BARCODE_TELEPEN:
|
||||
case BARCODE_UPCA:
|
||||
case BARCODE_UPCA_CHK:
|
||||
case BARCODE_UPCE:
|
||||
case BARCODE_UPCE_CHK:
|
||||
case BARCODE_POSTNET:
|
||||
//case BARCODE_MSI_PLESSEY: /* TODO: Find doc */
|
||||
case BARCODE_FIM:
|
||||
case BARCODE_LOGMARS:
|
||||
case BARCODE_PHARMA:
|
||||
case BARCODE_PZN:
|
||||
case BARCODE_PHARMA_TWO:
|
||||
case BARCODE_AUSPOST:
|
||||
case BARCODE_AUSREPLY:
|
||||
case BARCODE_AUSROUTE:
|
||||
case BARCODE_AUSREDIRECT:
|
||||
case BARCODE_ISBNX:
|
||||
case BARCODE_RM4SCC:
|
||||
case BARCODE_EAN14:
|
||||
//case BARCODE_VIN: /* Spec unlikely */
|
||||
case BARCODE_CODABLOCKF:
|
||||
case BARCODE_NVE18:
|
||||
case BARCODE_JAPANPOST:
|
||||
//case BARCODE_KOREAPOST: /* TODO: Find doc */
|
||||
case BARCODE_DBAR_STK:
|
||||
case BARCODE_DBAR_OMNSTK:
|
||||
case BARCODE_DBAR_EXPSTK:
|
||||
case BARCODE_PLANET:
|
||||
case BARCODE_USPS_IMAIL:
|
||||
//case BARCODE_PLESSEY: /* TODO: Find doc */
|
||||
case BARCODE_TELEPEN_NUM:
|
||||
case BARCODE_ITF14:
|
||||
case BARCODE_KIX:
|
||||
case BARCODE_DPD:
|
||||
case BARCODE_HIBC_39:
|
||||
case BARCODE_HIBC_BLOCKF:
|
||||
case BARCODE_MAILMARK:
|
||||
case BARCODE_CODE32:
|
||||
case BARCODE_EANX_CC:
|
||||
case BARCODE_GS1_128_CC:
|
||||
case BARCODE_DBAR_OMN_CC:
|
||||
case BARCODE_DBAR_LTD_CC:
|
||||
case BARCODE_DBAR_EXP_CC:
|
||||
case BARCODE_UPCA_CC:
|
||||
case BARCODE_UPCE_CC:
|
||||
case BARCODE_DBAR_STK_CC:
|
||||
case BARCODE_DBAR_OMNSTK_CC:
|
||||
case BARCODE_DBAR_EXPSTK_CC:
|
||||
case BARCODE_CHANNEL:
|
||||
assert_equal(ret, ZINT_CAP_COMPLIANT_HEIGHT, "symbol_id %d (%s) ret 0x%X != ZINT_CAP_COMPLIANT_HEIGHT\n", symbol_id, testUtilBarcodeName(symbol_id), ret);
|
||||
break;
|
||||
default:
|
||||
assert_zero(ret, "symbol_id %d (%s) ret 0x%X non-zero\n", symbol_id, testUtilBarcodeName(symbol_id), ret);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
testFinish();
|
||||
}
|
||||
|
||||
static void test_encode_file_empty(void) {
|
||||
int ret;
|
||||
struct zint_symbol *symbol;
|
||||
|
@ -950,6 +1039,7 @@ int main(int argc, char *argv[]) {
|
|||
{ "test_input_mode", test_input_mode, 1, 0, 1 },
|
||||
{ "test_escape_char_process", test_escape_char_process, 1, 1, 1 },
|
||||
{ "test_cap", test_cap, 1, 0, 0 },
|
||||
{ "test_cap_compliant_height", test_cap_compliant_height, 0, 0, 0 },
|
||||
{ "test_encode_file_empty", test_encode_file_empty, 0, 0, 0 },
|
||||
{ "test_encode_file_too_large", test_encode_file_too_large, 0, 0, 0 },
|
||||
{ "test_encode_file_unreadable", test_encode_file_unreadable, 0, 0, 0 },
|
||||
|
|
|
@ -103,10 +103,13 @@ static void test_hrt(int index, int debug) {
|
|||
/* 0*/ { BARCODE_CODABAR, -1, "A1234B", "A1234B" },
|
||||
/* 1*/ { BARCODE_CODABAR, -1, "a1234c", "A1234C" }, // Converts to upper
|
||||
/* 2*/ { BARCODE_CODABAR, 1, "A1234B", "A1234B" }, // Check not included
|
||||
/* 3*/ { BARCODE_PHARMA, -1, "123456", "" }, // None
|
||||
/* 4*/ { BARCODE_PHARMA_TWO, -1, "123456", "" }, // None
|
||||
/* 5*/ { BARCODE_CODE32, -1, "123456", "A001234564" },
|
||||
/* 6*/ { BARCODE_CODE32, -1, "12345678", "A123456788" },
|
||||
/* 3*/ { BARCODE_CODABAR, 2, "A1234B", "A12345B" }, // Check included
|
||||
/* 4*/ { BARCODE_CODABAR, 1, "A123456A", "A123456A" }, // Check not included
|
||||
/* 5*/ { BARCODE_CODABAR, 2, "A123456A", "A123456$A" }, // Check included
|
||||
/* 6*/ { BARCODE_PHARMA, -1, "123456", "" }, // None
|
||||
/* 7*/ { BARCODE_PHARMA_TWO, -1, "123456", "" }, // None
|
||||
/* 8*/ { BARCODE_CODE32, -1, "123456", "A001234564" },
|
||||
/* 9*/ { BARCODE_CODE32, -1, "12345678", "A123456788" },
|
||||
};
|
||||
int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -648,6 +648,7 @@ const char *testUtilOutputOptionsName(int output_options) {
|
|||
{ "OUT_BUFFER_INTERMEDIATE", OUT_BUFFER_INTERMEDIATE, 1024 },
|
||||
{ "BARCODE_QUIET_ZONES", BARCODE_QUIET_ZONES, 2048 },
|
||||
{ "BARCODE_NO_QUIET_ZONES", BARCODE_NO_QUIET_ZONES, 4096 },
|
||||
{ "COMPLIANT_HEIGHT", COMPLIANT_HEIGHT, 0x2000 },
|
||||
};
|
||||
static int const data_size = ARRAY_SIZE(data);
|
||||
int set = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue