vector.c: string halign; POSTNET/PLANET: 1 module space; ZBarcode_Cap(); GUI settings

This commit is contained in:
gitlost 2020-09-30 12:19:12 +01:00
parent 3f5ac34057
commit 36c19053d7
169 changed files with 10975 additions and 8318 deletions

View file

@ -119,29 +119,30 @@ static void test_hrt(int index, int debug) {
/* 0*/ { BARCODE_CODE11, -1, "123-45", -1, "123-4552" }, // 2 checksums
/* 1*/ { BARCODE_CODE11, 1, "123-45", -1, "123-455" }, // 1 checksum
/* 2*/ { BARCODE_CODE11, 2, "123-45", -1, "123-45" }, // No checksums
/* 3*/ { BARCODE_CODE39, -1, "ABC1234", -1, "*ABC1234*" },
/* 4*/ { BARCODE_CODE39, -1, "abc1234", -1, "*ABC1234*" }, // Converts to upper
/* 5*/ { BARCODE_CODE39, -1, "123456789", -1, "*123456789*" },
/* 6*/ { BARCODE_CODE39, 1, "123456789", -1, "*1234567892*" }, // With checksum
/* 7*/ { BARCODE_EXCODE39, -1, "ABC1234", -1, "ABC1234" },
/* 8*/ { BARCODE_EXCODE39, -1, "abc1234", -1, "abc1234" },
/* 9*/ { BARCODE_EXCODE39, 1, "abc1234", -1, "abc1234" }, // With checksum (not displayed)
/* 10*/ { BARCODE_EXCODE39, -1, "a%\000\001$\177z\033\037!+/\\@A~", 16, "a% $ z !+/\\@A~" }, // NUL, ctrls and DEL replaced with spaces
/* 11*/ { BARCODE_LOGMARS, -1, "ABC1234", -1, "ABC1234" },
/* 12*/ { BARCODE_LOGMARS, -1, "abc1234", -1, "ABC1234" }, // Converts to upper
/* 13*/ { BARCODE_LOGMARS, 1, "abc1234", -1, "ABC12340" }, // With checksum
/* 14*/ { BARCODE_LOGMARS, 1, "12345/ABCDE", -1, "12345/ABCDET" }, // With checksum
/* 15*/ { BARCODE_CODE93, -1, "ABC1234", -1, "ABC1234S5" }, // 2 checksums added (note check digits not shown by bwipp or tec-it)
/* 16*/ { BARCODE_CODE93, -1, "abc1234", -1, "abc1234ZG" },
/* 17*/ { BARCODE_CODE93, -1, "A\001a\000b\177d\037e", 9, "A a b d e1R" }, // NUL, ctrls and DEL replaced with spaces
/* 18*/ { BARCODE_PZN, -1, "12345", -1, "PZN -00123458" }, // Pads with zeroes if length < 7
/* 19*/ { BARCODE_PZN, -1, "123456", -1, "PZN -01234562" },
/* 20*/ { BARCODE_PZN, -1, "1234567", -1, "PZN -12345678" },
/* 21*/ { BARCODE_VIN, -1, "1FTCR10UXTPA78180", -1, "1FTCR10UXTPA78180" },
/* 22*/ { BARCODE_VIN, 1, "2FTPX28L0XCA15511", -1, "2FTPX28L0XCA15511" }, // Include Import char - no change
/* 23*/ { BARCODE_HIBC_39, -1, "ABC1234", -1, "*+ABC1234+*" },
/* 24*/ { BARCODE_HIBC_39, -1, "abc1234", -1, "*+ABC1234+*" }, // Converts to upper
/* 25*/ { BARCODE_HIBC_39, -1, "123456789", -1, "*+1234567890*" },
/* 3*/ { BARCODE_CODE11, -1, "123456789012", -1, "123456789012-8" }, // First checksum 10 (A) goes to hyphen
/* 4*/ { BARCODE_CODE39, -1, "ABC1234", -1, "*ABC1234*" },
/* 5*/ { BARCODE_CODE39, -1, "abc1234", -1, "*ABC1234*" }, // Converts to upper
/* 6*/ { BARCODE_CODE39, -1, "123456789", -1, "*123456789*" },
/* 7*/ { BARCODE_CODE39, 1, "123456789", -1, "*1234567892*" }, // With checksum
/* 8*/ { BARCODE_EXCODE39, -1, "ABC1234", -1, "ABC1234" },
/* 9*/ { BARCODE_EXCODE39, -1, "abc1234", -1, "abc1234" },
/* 10*/ { BARCODE_EXCODE39, 1, "abc1234", -1, "abc1234" }, // With checksum (not displayed)
/* 11*/ { BARCODE_EXCODE39, -1, "a%\000\001$\177z\033\037!+/\\@A~", 16, "a% $ z !+/\\@A~" }, // NUL, ctrls and DEL replaced with spaces
/* 12*/ { BARCODE_LOGMARS, -1, "ABC1234", -1, "ABC1234" },
/* 13*/ { BARCODE_LOGMARS, -1, "abc1234", -1, "ABC1234" }, // Converts to upper
/* 14*/ { BARCODE_LOGMARS, 1, "abc1234", -1, "ABC12340" }, // With checksum
/* 15*/ { BARCODE_LOGMARS, 1, "12345/ABCDE", -1, "12345/ABCDET" }, // With checksum
/* 16*/ { BARCODE_CODE93, -1, "ABC1234", -1, "ABC1234S5" }, // 2 checksums added (note check digits not shown by bwipp or tec-it)
/* 17*/ { BARCODE_CODE93, -1, "abc1234", -1, "abc1234ZG" },
/* 18*/ { BARCODE_CODE93, -1, "A\001a\000b\177d\037e", 9, "A a b d e1R" }, // NUL, ctrls and DEL replaced with spaces
/* 19*/ { BARCODE_PZN, -1, "12345", -1, "PZN -00123458" }, // Pads with zeroes if length < 7
/* 20*/ { BARCODE_PZN, -1, "123456", -1, "PZN -01234562" },
/* 21*/ { BARCODE_PZN, -1, "1234567", -1, "PZN -12345678" },
/* 22*/ { BARCODE_VIN, -1, "1FTCR10UXTPA78180", -1, "1FTCR10UXTPA78180" },
/* 23*/ { BARCODE_VIN, 1, "2FTPX28L0XCA15511", -1, "2FTPX28L0XCA15511" }, // Include Import char - no change
/* 24*/ { BARCODE_HIBC_39, -1, "ABC1234", -1, "*+ABC1234+*" },
/* 25*/ { BARCODE_HIBC_39, -1, "abc1234", -1, "*+ABC1234+*" }, // Converts to upper
/* 26*/ { BARCODE_HIBC_39, -1, "123456789", -1, "*+1234567890*" },
};
int data_size = ARRAY_SIZE(data);
@ -263,13 +264,13 @@ static void test_encode(int index, int generate, int debug) {
/* 1*/ { BARCODE_CODE11, 1, "123-455", -1, 0, 1, 78, "1 check digit (2); verified manually against tec-it",
"101100101101011010010110110010101011010101101101101101011011010100101101011001"
},
/* 2*/ { BARCODE_CODE11, 2, "123-4552", -1, 0, 1, 78, "0 check digits; verified manually against bwipp and tec-it",
/* 2*/ { BARCODE_CODE11, 2, "123-4552", -1, 0, 1, 78, "0 check digits; verified manually against tec-it",
"101100101101011010010110110010101011010101101101101101011011010100101101011001"
},
/* 3*/ { BARCODE_CODE11, 1, "123-45", -1, 0, 1, 70, "1 check digit; verified manually against tec-it",
"1011001011010110100101101100101010110101011011011011010110110101011001"
},
/* 4*/ { BARCODE_CODE11, 2, "123-45", -1, 0, 1, 62, "0 check digits; verified manually against bwipp and tec-it",
/* 4*/ { BARCODE_CODE11, 2, "123-45", -1, 0, 1, 62, "0 check digits; verified manually against tec-it",
"10110010110101101001011011001010101101010110110110110101011001"
},
/* 5*/ { BARCODE_CODE39, -1, "1A", -1, 0, 1, 51, "ISO/IEC 16388:2007 Figure 1",
@ -287,10 +288,10 @@ static void test_encode(int index, int generate, int debug) {
/* 9*/ { BARCODE_EXCODE39, 1, "1A", -1, 0, 1, 64, "With checksum",
"1001011011010110100101011011010100101101011010010110100101101101"
},
/* 10*/ { BARCODE_EXCODE39, -1, "a%\000\001$\177z", 7, 0, 1, 207, "Verified manually against bwipp and tec-it",
/* 10*/ { BARCODE_EXCODE39, -1, "a%\000\001$\177z", 7, 0, 1, 207, "Verified manually against tec-it",
"100101101101010010100100101101010010110100100101001011010110010101010010010010110010101011010010010010101101010010110100100101001010101100101101010010010010101011011001010010100100101001101101010100101101101"
},
/* 11*/ { BARCODE_EXCODE39, -1, "\033\037!+/\\@A~", -1, 0, 1, 246, "Verified manually against bwipp and tec-it",
/* 11*/ { BARCODE_EXCODE39, -1, "\033\037!+/\\@A~", -1, 0, 1, 246, "Verified manually against tec-it",
"100101101101010100100100101101010010110101001001001011010110010101001001010010110101001011010010010100101101010100110100100101001011010110100101010010010010101101010011010100100100101001101010110110101001011010100100100101011010110010100101101101"
},
/* 12*/ { BARCODE_LOGMARS, -1, "1A", -1, 0, 1, 63, "Verified manually against tec-it",
@ -308,19 +309,19 @@ static void test_encode(int index, int generate, int debug) {
/* 16*/ { BARCODE_LOGMARS, 1, "12345/ABCDE", -1, 0, 1, 223, "MIL-STD-1189 Rev. B Section 6.2.1 check character example; verified manually against tec-it",
"1000101110111010111010001010111010111000101011101110111000101010101000111010111011101000111010101000100010100010111010100010111010111010001011101110111010001010101011100010111011101011100010101010111011100010100010111011101"
},
/* 17*/ { BARCODE_CODE93, -1, "1A", -1, 0, 1, 55, "Verified manually against bwipp (includecheck) and tec-it",
/* 17*/ { BARCODE_CODE93, -1, "1A", -1, 0, 1, 55, "Verified manually against tec-it",
"1010111101010010001101010001101000101001110101010111101"
},
/* 18*/ { BARCODE_CODE93, -1, "TEST93", -1, 0, 1, 91, "Verified manually against bwipp (includecheck) and tec-it",
/* 18*/ { BARCODE_CODE93, -1, "TEST93", -1, 0, 1, 91, "Verified manually against tec-it",
"1010111101101001101100100101101011001101001101000010101010000101011101101001000101010111101"
},
/* 19*/ { BARCODE_CODE93, -1, "\000a\177", 3, 0, 1, 91, "Verified manually against bwipp (code93ext, includecheck) and tec-it",
/* 19*/ { BARCODE_CODE93, -1, "\000a\177", 3, 0, 1, 91, "Verified manually against tec-it",
"1010111101110110101100101101001100101101010001110110101101001101011011101010010001010111101"
},
/* 20*/ { BARCODE_PZN, -1, "1234567", -1, 0, 1, 142, "Example from IFA Info Code 39 EN V2.1; verified manually against bwipp (pzn8) and tec-it",
/* 20*/ { BARCODE_PZN, -1, "1234567", -1, 0, 1, 142, "Example from IFA Info Code 39 EN V2.1; verified manually against tec-it",
"1001011011010100101011011011010010101101011001010110110110010101010100110101101101001101010101100110101010100101101101101001011010100101101101"
},
/* 21*/ { BARCODE_PZN, -1, "2758089", -1, 0, 1, 142, "Example from IFA Info Check Digit Calculations EN 15 July 2019; verified manually against bwipp (pzn8) and tec-it",
/* 21*/ { BARCODE_PZN, -1, "2758089", -1, 0, 1, 142, "Example from IFA Info Check Digit Calculations EN 15 July 2019; verified manually against tec-it",
"1001011011010100101011011010110010101101010010110110110100110101011010010110101010011011010110100101101010110010110101011001011010100101101101"
},
/* 22*/ { BARCODE_VIN, -1, "1FTCR10UXTPA78180", -1, 0, 1, 246, "https://www.vinquery.com/img/vinbarcode/vinbarcode4.jpg",
@ -365,19 +366,17 @@ static void test_encode(int index, int generate, int debug) {
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);
if (ret == 0) {
int width, row;
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);
}
int width, row;
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(symbol->symbology, -1, data[i].option_2, -1, debug)) {
ret = testUtilBwipp(symbol, -1, data[i].option_2, -1, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf));
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), ret);
ret = testUtilBwipp(i, symbol, -1, data[i].option_2, -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);
assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
i, testUtilBarcodeName(data[i].symbology), ret, bwipp_msg, bwipp_buf, data[i].expected);
i, testUtilBarcodeName(symbol->symbology), ret, bwipp_msg, bwipp_buf, data[i].expected);
}
}
}