mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Test suite: update for latest BWIPP
This commit is contained in:
parent
2919a20384
commit
217e7d240a
@ -1,6 +1,6 @@
|
||||
/*
|
||||
libzint - the open source barcode library
|
||||
Copyright (C) 2020-2022 Robin Stuart <rstuart114@gmail.com>
|
||||
Copyright (C) 2020-2023 Robin Stuart <rstuart114@gmail.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
@ -128,7 +128,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
||||
char *expected;
|
||||
};
|
||||
struct item data[] = {
|
||||
/* 0*/ { BARCODE_AZTEC, UNICODE_MODE, -1, -1, -1, -1, "123456789012", -1, 0, 15, 15, 1, "ISO/IEC 24778:2008 Figure 1 (left)",
|
||||
/* 0*/ { BARCODE_AZTEC, UNICODE_MODE, -1, -1, -1, 1, "123456789012", -1, 0, 15, 15, 1, "ISO/IEC 24778:2008 Figure 1 (left)",
|
||||
"000111000011100"
|
||||
"110111001110010"
|
||||
"111100001000100"
|
||||
@ -188,7 +188,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
||||
"00010010010011001011011010000110001000101"
|
||||
"10001000001010100110100000001001001110000"
|
||||
},
|
||||
/* 2*/ { BARCODE_AZTEC, UNICODE_MODE, -1, -1, -1, -1, "Code 2D!", -1, 0, 15, 15, 1, "ISO/IEC 24778:2008 Figure G.2",
|
||||
/* 2*/ { BARCODE_AZTEC, UNICODE_MODE, -1, -1, -1, -1, "Code 2D!", -1, 0, 15, 15, 0, "ISO/IEC 24778:2008 Figure G.2; BWIPP defaults to full (see following)",
|
||||
"000110001100000"
|
||||
"000000110000010"
|
||||
"101100001000101"
|
||||
@ -563,7 +563,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
||||
"011010111000111110011011110"
|
||||
"000010010001000011010000001"
|
||||
},
|
||||
/* 15*/ { BARCODE_AZTEC, DATA_MODE, -1, -1, -1, -1, "\377\000\000\377\300\000\017\377\376\217\300\017", 12, 0, 19, 19, 1, "6 bit words",
|
||||
/* 15*/ { BARCODE_AZTEC, DATA_MODE, -1, -1, -1, 2, "\377\000\000\377\300\000\017\377\376\217\300\017", 12, 0, 19, 19, 1, "6 bit words",
|
||||
"1101000001111000001"
|
||||
"1101011000011100000"
|
||||
"1000001010001001001"
|
||||
@ -779,7 +779,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
||||
"11000000001000001011101101101101101001100000101000000000010111000000100101000110010000110010000011000101011111000"
|
||||
"11100000100000001110111110110000111110011100000010001110101010101111000011001011111001101101010010001011111011101"
|
||||
},
|
||||
/* 19*/ { BARCODE_AZTEC, UNICODE_MODE, -1, READER_INIT, -1, -1, "A", -1, 0, 15, 15, 1, "",
|
||||
/* 19*/ { BARCODE_AZTEC, UNICODE_MODE, -1, READER_INIT, -1, 1, "A", -1, 0, 15, 15, 1, "",
|
||||
"000011000111101"
|
||||
"001110010011000"
|
||||
"011100100000100"
|
||||
@ -817,7 +817,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
||||
"0011111001001010011"
|
||||
"1001101000100100001"
|
||||
},
|
||||
/* 21*/ { BARCODE_AZTEC, DATA_MODE, 3, -1, -1, -1, "\101\300", -1, 0, 15, 15, 1, "AÀ",
|
||||
/* 21*/ { BARCODE_AZTEC, DATA_MODE, 3, -1, -1, 1, "\101\300", -1, 0, 15, 15, 1, "AÀ",
|
||||
"000000101011100"
|
||||
"000100010100111"
|
||||
"001100000110110"
|
||||
@ -834,7 +834,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
||||
"110001000111110"
|
||||
"111001100011011"
|
||||
},
|
||||
/* 22*/ { BARCODE_AZTEC, UNICODE_MODE, 26, -1, -1, -1, "AÀ", -1, 0, 15, 15, 1, "AÀ",
|
||||
/* 22*/ { BARCODE_AZTEC, UNICODE_MODE, 26, -1, -1, 1, "AÀ", -1, 0, 15, 15, 1, "AÀ",
|
||||
"001111011000101"
|
||||
"000110100011000"
|
||||
"001100001000111"
|
||||
@ -851,7 +851,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
||||
"001100010010010"
|
||||
"011110110011000"
|
||||
},
|
||||
/* 23*/ { BARCODE_AZTEC, UNICODE_MODE, 100, -1, -1, -1, "A", -1, 0, 15, 15, 1, "FLG(3)",
|
||||
/* 23*/ { BARCODE_AZTEC, UNICODE_MODE, 100, -1, -1, 1, "A", -1, 0, 15, 15, 1, "FLG(3)",
|
||||
"001101001111101"
|
||||
"000000111011100"
|
||||
"001100000100101"
|
||||
@ -868,7 +868,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
||||
"100011101111100"
|
||||
"000111110001110"
|
||||
},
|
||||
/* 24*/ { BARCODE_AZTEC, UNICODE_MODE, 1000, -1, -1, -1, "A", -1, 0, 15, 15, 1, "FLG(4)",
|
||||
/* 24*/ { BARCODE_AZTEC, UNICODE_MODE, 1000, -1, -1, 1, "A", -1, 0, 15, 15, 1, "FLG(4)",
|
||||
"001010100011011"
|
||||
"001000100000101"
|
||||
"001100000100111"
|
||||
@ -885,7 +885,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
||||
"101000000111010"
|
||||
"000001110101111"
|
||||
},
|
||||
/* 25*/ { BARCODE_AZTEC, UNICODE_MODE, 10000, -1, -1, -1, "A", -1, 0, 15, 15, 1, "FLG(5)",
|
||||
/* 25*/ { BARCODE_AZTEC, UNICODE_MODE, 10000, -1, -1, 1, "A", -1, 0, 15, 15, 1, "FLG(5)",
|
||||
"000100110110010"
|
||||
"000001000010111"
|
||||
"001100000110101"
|
||||
@ -902,7 +902,7 @@ static void test_encode(const testCtx *const p_ctx) {
|
||||
"101010001110110"
|
||||
"000000011000101"
|
||||
},
|
||||
/* 26*/ { BARCODE_AZTEC, UNICODE_MODE, 100000, -1, -1, -1, "A", -1, 0, 15, 15, 1, "FLG(6)",
|
||||
/* 26*/ { BARCODE_AZTEC, UNICODE_MODE, 100000, -1, -1, 1, "A", -1, 0, 15, 15, 1, "FLG(6)",
|
||||
"000010010000010"
|
||||
"001101000100110"
|
||||
"001100000110111"
|
||||
@ -2480,7 +2480,7 @@ static void test_encode_segs(const testCtx *const p_ctx) {
|
||||
char *expected;
|
||||
};
|
||||
struct item data[] = {
|
||||
/* 0*/ { UNICODE_MODE, -1, -1, -1, { { TU("¶"), -1, 0 }, { TU("Ж"), -1, 7 }, { TU(""), 0, 0 } }, 0, 15, 15, 1, "ISO/IEC 24778:2008 16.5 example",
|
||||
/* 0*/ { UNICODE_MODE, -1, -1, 1, { { TU("¶"), -1, 0 }, { TU("Ж"), -1, 7 }, { TU(""), 0, 0 } }, 0, 15, 15, 1, "ISO/IEC 24778:2008 16.5 example",
|
||||
"001111000011111"
|
||||
"110111100100011"
|
||||
"111100001000111"
|
||||
@ -2497,7 +2497,7 @@ static void test_encode_segs(const testCtx *const p_ctx) {
|
||||
"001010111001010"
|
||||
"000001011100111"
|
||||
},
|
||||
/* 1*/ { UNICODE_MODE, -1, -1, -1, { { TU("¶"), -1, 0 }, { TU("Ж"), -1, 0 }, { TU(""), 0, 0 } }, ZINT_WARN_USES_ECI, 15, 15, 1, "ISO/IEC 24778:2008 16.5 example auto-ECI",
|
||||
/* 1*/ { UNICODE_MODE, -1, -1, 1, { { TU("¶"), -1, 0 }, { TU("Ж"), -1, 0 }, { TU(""), 0, 0 } }, ZINT_WARN_USES_ECI, 15, 15, 1, "ISO/IEC 24778:2008 16.5 example auto-ECI",
|
||||
"001111000011111"
|
||||
"110111100100011"
|
||||
"111100001000111"
|
||||
@ -2607,7 +2607,7 @@ static void test_encode_segs(const testCtx *const p_ctx) {
|
||||
"1001101000110101111010100111100011111001000100101"
|
||||
"0001001010011000000100101101100110101000100000000"
|
||||
},
|
||||
/* 5*/ { DATA_MODE, -1, -1, -1, { { TU("\357"), 1, 0 }, { TU("\357"), 1, 7 }, { TU("\357"), 1, 0 } }, 0, 19, 19, 1, "Standard example + extra seg, data mode",
|
||||
/* 5*/ { DATA_MODE, -1, -1, 2, { { TU("\357"), 1, 0 }, { TU("\357"), 1, 7 }, { TU("\357"), 1, 0 } }, 0, 19, 19, 1, "Standard example + extra seg, data mode",
|
||||
"1110011101010111000"
|
||||
"1100010001011100011"
|
||||
"1001110101000010110"
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -2618,7 +2618,6 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
|
||||
*bwipp_data = '0';
|
||||
}
|
||||
} else if (symbology == BARCODE_CODABLOCKF || symbology == BARCODE_HIBC_BLOCKF) {
|
||||
sprintf(bwipp_opts_buf + strlen(bwipp_opts_buf), "%ssepheight=0", strlen(bwipp_opts_buf) ? " " : "");
|
||||
if (option_1 > 0) {
|
||||
sprintf(bwipp_opts_buf + strlen(bwipp_opts_buf), "%srows=%d",
|
||||
strlen(bwipp_opts_buf) ? " " : "", option_1);
|
||||
@ -2731,14 +2730,13 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
|
||||
strcpy(bwipp_data, "fima");
|
||||
bwipp_data[3] = z_isupper(data[0]) ? data[0] - 'A' + 'a' : data[0];
|
||||
} 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 && option_1 >= symbol->rows)) {
|
||||
sprintf(bwipp_opts_buf + strlen(bwipp_opts_buf), "%srows=%d",
|
||||
strlen(bwipp_opts_buf) ? " " : "", option_1);
|
||||
}
|
||||
bwipp_opts = bwipp_opts_buf;
|
||||
}
|
||||
} else if (symbology == BARCODE_AZTEC || symbology == BARCODE_HIBC_AZTEC) {
|
||||
int compact = 0, full = 0;
|
||||
@ -3016,16 +3014,13 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
|
||||
}
|
||||
}
|
||||
} else if (symbology == BARCODE_ULTRA) {
|
||||
const int rev = option_2 == 2 ? 2 : 1;
|
||||
if (option_1 >= 1 && option_1 <= 6) {
|
||||
sprintf(bwipp_opts_buf + strlen(bwipp_opts_buf), "%seclevel=EC%d",
|
||||
strlen(bwipp_opts_buf) ? " " : "", option_1 - 1);
|
||||
bwipp_opts = bwipp_opts_buf;
|
||||
}
|
||||
if (option_2 >= 1 && option_2 <= 2) {
|
||||
sprintf(bwipp_opts_buf + strlen(bwipp_opts_buf), "%srev=%d",
|
||||
strlen(bwipp_opts_buf) ? " " : "", option_2);
|
||||
bwipp_opts = bwipp_opts_buf;
|
||||
}
|
||||
sprintf(bwipp_opts_buf + strlen(bwipp_opts_buf), "%srev=%d", strlen(bwipp_opts_buf) ? " " : "", rev);
|
||||
bwipp_opts = bwipp_opts_buf;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -67,10 +67,28 @@ ret /pixs known {
|
||||
/pixs ret /pixs get def
|
||||
} ifelse
|
||||
|
||||
/pixx ret /pixx known { ret /pixx get } { 0 } ifelse def
|
||||
|
||||
b (codablockf) eq b (hibccodablockf) eq or b (code16k) eq or b (code49) eq or {
|
||||
% Strip separators and boundary bars
|
||||
/testi b (code16k) eq { 16 } { b (code49) eq { 11 } { 21 } ifelse } ifelse def
|
||||
/tmppixs pixs length array def
|
||||
/j 0 def
|
||||
0 pixx pixs length 1 sub {
|
||||
/i exch def
|
||||
pixs i testi add get 1 ne {
|
||||
tmppixs j pixs i pixx getinterval putinterval
|
||||
/j j pixx add def
|
||||
} if
|
||||
} for
|
||||
/pixs j array def
|
||||
pixs 0 tmppixs 0 j getinterval putinterval
|
||||
} if
|
||||
|
||||
/xs systemdict /xs known { systemdict /xs get cvi } { 0 } ifelse def
|
||||
/xe systemdict /xe known { systemdict /xe get cvi } { 0 } ifelse def
|
||||
|
||||
n xs 0 ne or xe 0 ne or ret /pixx known and { % If newlines or start/end indexes requested and have row width
|
||||
n xs 0 ne or xe 0 ne or pixx 0 ne and { % If newlines or start/end indexes requested and have row width
|
||||
/pixx ret /pixx get def
|
||||
xs pixx pixs length 1 sub xe sub { % For i = xs; i < pixs length - xe; i += pixx
|
||||
pixs exch pixx xs sub xe sub getinterval { % For j = i; j < i + pixx - xs -xe; j++
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user