mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
vector.c: string halign; POSTNET/PLANET: 1 module space; ZBarcode_Cap(); GUI settings
This commit is contained in:
@ -52,7 +52,7 @@ static void test_large(int index, int debug) {
|
||||
struct item data[] = {
|
||||
/* 0*/ { BARCODE_FLAT, "1", 90, 0, 1, 810 },
|
||||
/* 1*/ { BARCODE_FLAT, "1", 91, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 2*/ { BARCODE_POSTNET, "1", 11, 0, 2, 185 },
|
||||
/* 2*/ { BARCODE_POSTNET, "1", 11, 0, 2, 123 },
|
||||
/* 3*/ { BARCODE_POSTNET, "1", 12, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 4*/ { BARCODE_FIM, "D", 1, 0, 1, 17 },
|
||||
/* 5*/ { BARCODE_FIM, "D", 2, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
@ -62,7 +62,7 @@ static void test_large(int index, int debug) {
|
||||
/* 9*/ { BARCODE_JAPANPOST, "1", 21, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 10*/ { BARCODE_KOREAPOST, "1", 6, 0, 1, 162 },
|
||||
/* 11*/ { BARCODE_KOREAPOST, "1", 7, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 12*/ { BARCODE_PLANET, "1", 13, 0, 2, 215 },
|
||||
/* 12*/ { BARCODE_PLANET, "1", 13, 0, 2, 143 },
|
||||
/* 13*/ { BARCODE_PLANET, "1", 14, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 14*/ { BARCODE_KIX, "1", 18, 0, 3, 143 },
|
||||
/* 15*/ { BARCODE_KIX, "1", 19, ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
@ -216,9 +216,9 @@ static void test_input(int index, int debug) {
|
||||
struct item data[] = {
|
||||
/* 0*/ { BARCODE_FLAT, "1234567890", 0, 1, 90 },
|
||||
/* 1*/ { BARCODE_FLAT, "A", ZINT_ERROR_INVALID_DATA, -1, -1 },
|
||||
/* 2*/ { BARCODE_POSTNET, "12345", 0, 2, 95 },
|
||||
/* 3*/ { BARCODE_POSTNET, "123457689", 0, 2, 155 },
|
||||
/* 4*/ { BARCODE_POSTNET, "12345768901", 0, 2, 185 },
|
||||
/* 2*/ { BARCODE_POSTNET, "12345", 0, 2, 63 },
|
||||
/* 3*/ { BARCODE_POSTNET, "123457689", 0, 2, 103 },
|
||||
/* 4*/ { BARCODE_POSTNET, "12345768901", 0, 2, 123 },
|
||||
/* 5*/ { BARCODE_POSTNET, "1234", ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 6*/ { BARCODE_POSTNET, "123456", ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 7*/ { BARCODE_POSTNET, "123456789012", ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
@ -237,8 +237,8 @@ static void test_input(int index, int debug) {
|
||||
/* 20*/ { BARCODE_JAPANPOST, ",", ZINT_ERROR_INVALID_DATA, -1, -1 },
|
||||
/* 21*/ { BARCODE_KOREAPOST, "123456", 0, 1, 167 },
|
||||
/* 22*/ { BARCODE_KOREAPOST, "A", ZINT_ERROR_INVALID_DATA, -1, -1 },
|
||||
/* 23*/ { BARCODE_PLANET, "12345678901", 0, 2, 185 },
|
||||
/* 24*/ { BARCODE_PLANET, "1234567890123", 0, 2, 215 },
|
||||
/* 23*/ { BARCODE_PLANET, "12345678901", 0, 2, 123 },
|
||||
/* 24*/ { BARCODE_PLANET, "1234567890123", 0, 2, 143 },
|
||||
/* 25*/ { BARCODE_PLANET, "1234567890", ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 26*/ { BARCODE_PLANET, "123456789012", ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
/* 27*/ { BARCODE_PLANET, "12345678901234", ZINT_ERROR_TOO_LONG, -1, -1 },
|
||||
@ -279,6 +279,8 @@ static void test_encode(int index, int generate, int debug) {
|
||||
|
||||
testStart("");
|
||||
|
||||
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise
|
||||
|
||||
int ret;
|
||||
struct item {
|
||||
int symbology;
|
||||
@ -291,67 +293,81 @@ static void test_encode(int index, int generate, int debug) {
|
||||
char *expected;
|
||||
};
|
||||
struct item data[] = {
|
||||
/* 0*/ { BARCODE_FLAT, "1304056", 0, 1, 63, "Verified manually against bwipp and tec-it",
|
||||
/* 0*/ { BARCODE_FLAT, "1304056", 0, 1, 63, "Verified manually against tec-it",
|
||||
"100000000001000000000000000000100000000000000000010000000001000"
|
||||
},
|
||||
/* 1*/ { BARCODE_POSTNET, "12345678901", 0, 2, 185, "USPS Publication 25 (2003) Exhibit 4-1",
|
||||
"10000000000010010000000010000010000000010010000000010000000010000010000010000000010010000000010000000000010010000000010000010000010000000010010000000000000000000010010000010000000010010"
|
||||
"10010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010"
|
||||
/* 1*/ { BARCODE_POSTNET, "12345678901", 0, 2, 123, "USPS Publication 25 (2003) Exhibit 4-1",
|
||||
"100000001010000010001000001010000010000010001000100000101000001000000010100000100010001000001010000000000000101000100000101"
|
||||
"101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101"
|
||||
},
|
||||
/* 2*/ { BARCODE_POSTNET, "555551237", 0, 2, 155, "Verified manually against bwipp and tec-it",
|
||||
"10000010000010000000010000010000000010000010000000010000010000000010000010000000000000010010000000010000010000000010010000010000000000010000000010000010010"
|
||||
"10010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010"
|
||||
/* 2*/ { BARCODE_POSTNET, "555551237", 0, 2, 103, "Verified manually against tec-it",
|
||||
"1000100010000010001000001000100000100010000010001000000000101000001000100000101000100000001000001000101"
|
||||
"1010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101"
|
||||
},
|
||||
/* 3*/ { BARCODE_FIM, "C", 0, 1, 17, "USPS DMM Exhibit 8.2.0 FIM C",
|
||||
"10100010001000101"
|
||||
},
|
||||
/* 4*/ { BARCODE_RM4SCC, "BX11LT1A", 0, 3, 75, "Verified manually against bwipp and tec-it",
|
||||
/* 4*/ { BARCODE_RM4SCC, "BX11LT1A", 0, 3, 75, "Verified manually against tec-it",
|
||||
"100010001010100000000010100000101010000010100010000000101000100010100000101"
|
||||
"101010101010101010101010101010101010101010101010101010101010101010101010101"
|
||||
"001010000010000010001000100010001010000010101000000010001010001000000010101"
|
||||
},
|
||||
/* 5*/ { BARCODE_RM4SCC, "W1J0TR01", 0, 3, 75, "Verified manually against bwipp and tec-it",
|
||||
/* 5*/ { BARCODE_RM4SCC, "W1J0TR01", 0, 3, 75, "Verified manually against tec-it",
|
||||
"101010000000001010100000100000101010001000100010000000101000001010101000001"
|
||||
"101010101010101010101010101010101010101010101010101010101010101010101010101"
|
||||
"000010100000100010001000100000101010100000100000100000101000100010001010001"
|
||||
},
|
||||
/* 6*/ { BARCODE_JAPANPOST, "12345671-2-3", 0, 3, 133, "Verified manually against bwipp and tec-it",
|
||||
/* 6*/ { BARCODE_JAPANPOST, "15400233-16-4-205", 0, 3, 133, "Zip/Barcode Manual p.6 1st example; verified manually against tec-it",
|
||||
"1000101000100010101000100000100000100010001010001010001000101000001010001000101000001000100010100000100010000010000010000010001010001"
|
||||
"1010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101"
|
||||
"1010101000100010100010100000100000101000101000101000001000101000100010001000100010001000101000100000100010001000001000001000100010101"
|
||||
},
|
||||
/* 7*/ { BARCODE_JAPANPOST, "350110622-1A308", 0, 3, 133, "Zip/Barcode Manual p.6 2nd example; verified manually against tec-it",
|
||||
"1000001010100010100000101000101000100000001010100010100010001000101000001000100000001010100000100010000010000010000010000010100010001"
|
||||
"1010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101"
|
||||
"1010101000100010100000101000101000100000100010101000101000001000101000100000100000101000100000001010001000001000001000001000100010101"
|
||||
},
|
||||
/* 8*/ { BARCODE_JAPANPOST, "12345671-2-3", 0, 3, 133, "Verified manually against tec-it",
|
||||
"1000101000100010001010101000100010001010101000101000001000100010001000001010000010000010000010000010000010000010000010000010100010001"
|
||||
"1010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101"
|
||||
"1010101000101000101000100010100010100010001010101000001000101000001000101000001000001000001000001000001000001000001000001000100010101"
|
||||
},
|
||||
/* 7*/ { BARCODE_KOREAPOST, "010230", 0, 1, 167, "Verified manually against tec-it",
|
||||
/* 9*/ { BARCODE_KOREAPOST, "010230", 0, 1, 167, "Verified manually against tec-it",
|
||||
"10001000100000000000100010000000000010001000100000001000000010001000100010001000100000000000100000000001000100010001000100010001000000000001000000010001000000010001000"
|
||||
},
|
||||
/* 8*/ { BARCODE_PLANET, "4012345235636", 0, 2, 215, "USPS Publication 197 (2004) Exhibit 5; verified manually against bwipp and tec-it",
|
||||
"10010000010010000000000010010010010010010000000010010000010000010010000000010010000010010000010000010000010010010000010000010010000000010010000010000010010000000010010010010000000010010000000010010010000000010010010"
|
||||
"10010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010"
|
||||
/* 10*/ { BARCODE_PLANET, "4012345235636", 0, 2, 143, "USPS Publication 197 (2004) Exhibit 4; verified manually against tec-it",
|
||||
"10100010100000001010101010100000101000100010100000101000101000100010001010100010001010000010100010001010000010101010000010100000101010000010101"
|
||||
"10101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101"
|
||||
},
|
||||
/* 9*/ { BARCODE_PLANET, "40123452356", 0, 2, 185, "Verified manually against bwipp and tec-it",
|
||||
"10010000010010000000000010010010010010010000000010010000010000010010000000010010000010010000010000010000010010010000010000010010000000010010000010000010010000000010010010000010000010010"
|
||||
"10010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010010"
|
||||
/* 11*/ { BARCODE_PLANET, "40123452356", 0, 2, 123, "Verified manually against tec-it",
|
||||
"101000101000000010101010101000001010001000101000001010001010001000100010101000100010100000101000100010100000101010001000101"
|
||||
"101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101"
|
||||
},
|
||||
/* 10*/ { BARCODE_KIX, "2500GG30250", 0, 3, 87, "PostNL Handleiding KIX code Section 2.1 Example 1",
|
||||
/* 12*/ { BARCODE_PLANET, "5020140235635", 0, 2, 143, "USPS Publication 197 (2004) Exhibit 6; verified manually against tec-it",
|
||||
"10100010001000001010101010001000000010101010101000001000101000000010101010100010001010000010100010001010000010101010000010100010001010001010001"
|
||||
"10101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101"
|
||||
},
|
||||
/* 13*/ { BARCODE_KIX, "2500GG30250", 0, 3, 87, "PostNL Handleiding KIX code Section 2.1 Example 1",
|
||||
"000010100000101000001010000010100010100000101000000010100000101000001010000010100000101"
|
||||
"101010101010101010101010101010101010101010101010101010101010101010101010101010101010101"
|
||||
"001010001010000000001010000010101000100010001000100000100000101000101000101000000000101"
|
||||
},
|
||||
/* 11*/ { BARCODE_KIX, "2130VA80430", 0, 3, 87, "PostNL Handleiding KIX code Section 2.1 Example 2",
|
||||
/* 14*/ { BARCODE_KIX, "2130VA80430", 0, 3, 87, "PostNL Handleiding KIX code Section 2.1 Example 2",
|
||||
"000010100000101000001010000010101010000000100010001000100000101000001010000010100000101"
|
||||
"101010101010101010101010101010101010101010101010101010101010101010101010101010101010101"
|
||||
"001010000010001010000010000010100010001010001000001010000000101010001000100000100000101"
|
||||
},
|
||||
/* 12*/ { BARCODE_KIX, "1231GF156X2", 0, 3, 87, "PostNL Handleiding KIX code Section 2.1 Example 3",
|
||||
/* 15*/ { BARCODE_KIX, "1231GF156X2", 0, 3, 87, "PostNL Handleiding KIX code Section 2.1 Example 3",
|
||||
"000010100000101000001010000010100010100000101000000010100000101000100010101000000000101"
|
||||
"101010101010101010101010101010101010101010101010101010101010101010101010101010101010101"
|
||||
"001000100010100010000010001000101000100010000010001000101010000000001010100000100010100"
|
||||
},
|
||||
/* 13*/ { BARCODE_KIX, "1231FZ13Xhs", 0, 3, 87, "PostNL Handleiding KIX code Section 2.1 Example 4",
|
||||
/* 16*/ { BARCODE_KIX, "1231FZ13Xhs", 0, 3, 87, "PostNL Handleiding KIX code Section 2.1 Example 4",
|
||||
"000010100000101000001010000010100010100010100000000010100000101010100000001010001000100"
|
||||
"101010101010101010101010101010101010101010101010101010101010101010101010101010101010101"
|
||||
"001000100010100010000010001000101000001010100000001000101000001010000010101000001000100"
|
||||
},
|
||||
/* 14*/ { BARCODE_DAFT, "DAFTTFADFATDTATFT", 0, 3, 33, "Verified manually against bwipp and tec-it",
|
||||
/* 17*/ { BARCODE_DAFT, "DAFTTFADFATDTATFT", 0, 3, 33, "Verified manually against tec-it",
|
||||
"001010000010100010100000001000100"
|
||||
"101010101010101010101010101010101"
|
||||
"100010000010001010000010000000100"
|
||||
@ -360,6 +376,8 @@ static void test_encode(int index, int generate, int debug) {
|
||||
int data_size = ARRAY_SIZE(data);
|
||||
|
||||
char escaped[1024];
|
||||
char bwipp_buf[8192];
|
||||
char bwipp_msg[1024];
|
||||
|
||||
for (int i = 0; i < data_size; i++) {
|
||||
|
||||
@ -384,10 +402,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, -1, -1, debug)) {
|
||||
ret = testUtilBwipp(i, symbol, -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);
|
||||
assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
|
||||
i, testUtilBarcodeName(symbol->symbology), ret, bwipp_msg, bwipp_buf, data[i].expected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user