diff --git a/backend/aztec.c b/backend/aztec.c index f59b6c04..75b449b5 100644 --- a/backend/aztec.c +++ b/backend/aztec.c @@ -839,8 +839,8 @@ INTERNAL int aztec(struct zint_symbol *symbol, unsigned char source[], int lengt rs_uint_t rs_uint; #ifdef _MSC_VER - unsigned int* data_part; - unsigned int* ecc_part; + unsigned int *data_part; + unsigned int *ecc_part; #endif if ((symbol->input_mode & 0x07) == GS1_MODE) { diff --git a/backend/codablock.c b/backend/codablock.c index a7a5bc4a..e31ad786 100644 --- a/backend/codablock.c +++ b/backend/codablock.c @@ -101,8 +101,8 @@ static int GetPossibleCharacterSet(unsigned char C) return CodeA; if (C>='0' && C<='9') return ZTNum; /* ZTNum=CodeA+CodeB+CodeC */ - if (C==aFNC1) - return ZTFNC1; /* ZTFNC1=CodeA+CodeB+CodeC+CodeFNC1 */ + if (C==aFNC1) /* FNC1s (GS1) not used */ + return ZTFNC1; /* ZTFNC1=CodeA+CodeB+CodeC+CodeFNC1 */ /* Not reached */ if (C==aFNC4) return (CodeA | CodeB | CodeFNC4); if (C>='\x60' && C<='\x7f') /* 60 to 127 */ @@ -152,9 +152,9 @@ static void CreateCharacterSetTable(CharacterSetTable T[], unsigned char *data, do{ /* Whether this is FNC1, whether next is */ /* numeric */ - if (T[runChar].CharacterSet==ZTFNC1) + if (T[runChar].CharacterSet==ZTFNC1) /* FNC1s (GS1) not used */ /* FNC1 */ - ++(T[charCur].CFollowing); + ++(T[charCur].CFollowing); /* Not reached */ else { ++runChar; @@ -251,9 +251,9 @@ static int Columns2Rows(struct zint_symbol *symbol, CharacterSetTable *T, const /* Test if numeric after one isn't better.*/ runChar=charCur; emptyColumns2=emptyColumns; - while (T[runChar].CharacterSet==ZTFNC1) + while (T[runChar].CharacterSet==ZTFNC1) /* FNC1s (GS1) not used */ { - ++runChar; + ++runChar; /* Not reached */ --emptyColumns2; } if (CPaires>=RemainingDigits(T,runChar+1,emptyColumns2-1)) @@ -437,15 +437,11 @@ static int Rows2Columns(struct zint_symbol *symbol, CharacterSetTable *T, const int rowsCur; int rowsRequested; /* Number of requested rows */ int columnsRequested; /* Number of requested columns (if any) */ - int backupRows = 0; int fillings; - int backupFillings = 0; int useColumns; int testColumns; /* To enter into Width2Rows */ - int backupColumns = 0; - int fBackupOk = 0; /* The memorised set is o.k. */ int testListSize = 0; - int pTestList[62]; + int pTestList[62 + 1]; #ifndef _MSC_VER int *pBackupSet[dataLength]; #else @@ -501,38 +497,15 @@ static int Rows2Columns(struct zint_symbol *symbol, CharacterSetTable *T, const return 0; } /* > Test more rows (shorter CDB) */ - fBackupOk=(rowsCur==rowsRequested); memcpy(pBackupSet,pSet,dataLength*sizeof(int)); - backupFillings=fillings; - backupColumns=useColumns; - backupRows=rowsCur; --testColumns; } else { /* > Too many rows */ - int fInTestList = fBackupOk; - int posCur; - for (posCur = 0; posCur < testListSize && ! fInTestList; posCur++) { - if ( pTestList[posCur] == testColumns+1 ) - fInTestList = 1; - } - if (fInTestList) { - /* The next less-rows (larger) code was - * already tested. So give the larger - * back. - */ - memcpy(pSet,pBackupSet,dataLength*sizeof(int)); - *pFillings=backupFillings; - *pRows=backupRows; - *pUseColumns=backupColumns; - return 0; - } /* > Test less rows (longer code) */ - backupRows=rowsCur; memcpy(pBackupSet,pSet,dataLength*sizeof(int)); - backupFillings=fillings; - backupColumns=useColumns; - fBackupOk=0; - ++testColumns; + if (++testColumns > 62) { + return ZINT_ERROR_TOO_LONG; + } } } } @@ -545,8 +518,8 @@ static void A2C128_A(uchar **ppOutPos,uchar c) switch(c){ case aCodeB: *pOutPos=100; break; case aFNC4: *pOutPos=101; break; - case aFNC1: *pOutPos=102; break; - case aFNC2: *pOutPos=97; break; + case aFNC1: *pOutPos=102; break; /* FNC1s (GS1) not used */ /* Not reached */ + case aFNC2: *pOutPos=97; break; /* FNC2s (Message Append) not used */ /* Not reached */ case aFNC3: *pOutPos=96; break; case aCodeC: *pOutPos=99; break; case aShift: *pOutPos=98; break; @@ -567,8 +540,8 @@ static void A2C128_B(uchar **ppOutPos,uchar c) { uchar * pOutPos = *ppOutPos; switch(c){ - case aFNC1: *pOutPos=102; break; - case aFNC2: *pOutPos=97; break; + case aFNC1: *pOutPos=102; break; /* FNC1s (GS1) not used */ /* Not reached */ + case aFNC2: *pOutPos=97; break; /* FNC2s (Message Append) not used */ /* Not reached */ case aFNC3: *pOutPos=96; break; case aFNC4: *pOutPos=100; break; case aCodeA: *pOutPos=101; break; @@ -585,7 +558,7 @@ static void A2C128_C(uchar **ppOutPos,uchar c1,uchar c2) { uchar * pOutPos = *ppOutPos; switch(c1){ - case aFNC1: *pOutPos=102; break; + case aFNC1: *pOutPos=102; break; /* FNC1s (GS1) not used */ /* Not reached */ case aCodeB: *pOutPos=100; break; case aCodeA: *pOutPos=101; break; default: *pOutPos=(char)(10 * (c1- '0') + (c2 - '0'));break; @@ -890,8 +863,8 @@ INTERNAL int codablock(struct zint_symbol *symbol, unsigned char source[], int l /* Normal Character */ if (characterSetCur==CodeC) { - if (data[charCur]==aFNC1) - A2C128_C(&pOutPos,aFNC1,'\0'); + if (data[charCur]==aFNC1) /* FNC1s (GS1) not used */ + A2C128_C(&pOutPos,aFNC1,'\0'); /* Not reached */ else { A2C128_C(&pOutPos, data[charCur], diff --git a/backend/code128.c b/backend/code128.c index f9fc5703..3e97d0d6 100644 --- a/backend/code128.c +++ b/backend/code128.c @@ -843,14 +843,13 @@ INTERNAL int ean_128_cc(struct zint_symbol *symbol, unsigned char source[], int last_set = set[0]; glyph_count = 0.0f; for (i = 0; i < reduced_length; i++) { - if ((set[i] == 'a') || (set[i] == 'b')) { - glyph_count = glyph_count + 1.0f; /* Not reached */ - } - if (((set[i] == 'A') || (set[i] == 'B')) || (set[i] == 'C')) { + if ((set[i] == 'A') || (set[i] == 'B') || (set[i] == 'C')) { if (set[i] != last_set) { last_set = set[i]; glyph_count = glyph_count + 1.0f; } + } else if ((set[i] == 'a') || (set[i] == 'b')) { + glyph_count = glyph_count + 1.0f; /* Not reached */ } if ((set[i] == 'C') && (reduced[i] != '[')) { diff --git a/backend/common.c b/backend/common.c index c0cdb51d..5bfb00e6 100644 --- a/backend/common.c +++ b/backend/common.c @@ -439,7 +439,7 @@ INTERNAL int set_height(struct zint_symbol *symbol, const float min_row_height, INTERNAL int colour_to_red(const int colour) { int return_val = 0; - switch(colour) { + switch (colour) { case 8: // White case 3: // Magenta case 4: // Red @@ -455,7 +455,7 @@ INTERNAL int colour_to_red(const int colour) { INTERNAL int colour_to_green(const int colour) { int return_val = 0; - switch(colour) { + switch (colour) { case 8: // White case 1: // Cyan case 5: // Yellow @@ -471,7 +471,7 @@ INTERNAL int colour_to_green(const int colour) { INTERNAL int colour_to_blue(const int colour) { int return_val = 0; - switch(colour) { + switch (colour) { case 8: // White case 1: // Cyan case 2: // Blue diff --git a/backend/dotcode.c b/backend/dotcode.c index f77a20f4..43af1576 100644 --- a/backend/dotcode.c +++ b/backend/dotcode.c @@ -729,7 +729,7 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha codeword_array[array_length] = 96; input_position++; } else { - switch(source[input_position]) { + switch (source[input_position]) { case 9: codeword_array[array_length] = 97; break; // HT case 28: codeword_array[array_length] = 98; break; // FS case 29: codeword_array[array_length] = 99; break; // GS @@ -802,7 +802,7 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha } else if (input_position != 0) { /* HT, FS, GS and RS in the first data position would be interpreted as a macro * (see table 2) */ - switch(source[input_position]) { + switch (source[input_position]) { case 9: // HT codeword_array[array_length] = 97; break; @@ -975,7 +975,7 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha codeword_array[array_length] = 96; input_position++; } else { - switch(source[input_position]) { + switch (source[input_position]) { case 9: codeword_array[array_length] = 97; break; // HT case 28: codeword_array[array_length] = 98; break; // FS case 29: codeword_array[array_length] = 99; break; // GS diff --git a/backend/emf.c b/backend/emf.c index 3982e257..d3e4e31b 100644 --- a/backend/emf.c +++ b/backend/emf.c @@ -534,7 +534,7 @@ INTERNAL int emf_plot(struct zint_symbol *symbol, int rotate_angle) { emr_extcreatefontindirectw.elw.out_precision = 0x00; // OUT_DEFAULT_PRECIS emr_extcreatefontindirectw.elw.clip_precision = 0x00; // CLIP_DEFAULT_PRECIS emr_extcreatefontindirectw.elw.pitch_and_family = 0x02 | (0x02 << 6); // FF_SWISS | VARIABLE_PITCH - utfle_copy(emr_extcreatefontindirectw.elw.facename, (unsigned char*) "sans-serif", 10); + utfle_copy(emr_extcreatefontindirectw.elw.facename, (unsigned char *) "sans-serif", 10); bytecount += 104; recordcount++; diff --git a/backend/hanxin.c b/backend/hanxin.c index 90ed91f0..f7d9d1a6 100644 --- a/backend/hanxin.c +++ b/backend/hanxin.c @@ -1550,7 +1550,7 @@ INTERNAL int han_xin(struct zint_symbol *symbol, unsigned char source[], int len data_codewords = hx_data_codewords_L4[i - 1]; } break; - default: + default: /* Not reached */ assert(0); break; } diff --git a/backend/mailmark.c b/backend/mailmark.c index 91302db7..3821f212 100644 --- a/backend/mailmark.c +++ b/backend/mailmark.c @@ -105,7 +105,7 @@ static int verify_character(char input, char type) { } } -static int verify_postcode(char* postcode, int type) { +static int verify_postcode(char *postcode, int type) { int i; char pattern[11]; @@ -152,7 +152,7 @@ INTERNAL int mailmark(struct zint_symbol *symbol, unsigned char source[], int le return ZINT_ERROR_TOO_LONG; } - strcpy(local_source, (char*) source); + ustrcpy(local_source, source); if (length < 22) { for (i = length; i <= 22; i++) { @@ -168,7 +168,7 @@ INTERNAL int mailmark(struct zint_symbol *symbol, unsigned char source[], int le length = 26; } - to_upper((unsigned char*) local_source); + to_upper((unsigned char *) local_source); if (symbol->debug & ZINT_DEBUG_PRINT) { printf("Producing Mailmark %s\n", local_source); diff --git a/backend/medical.c b/backend/medical.c index a69f5870..63b0c25a 100644 --- a/backend/medical.c +++ b/backend/medical.c @@ -76,7 +76,7 @@ INTERNAL int pharma_one(struct zint_symbol *symbol, unsigned char source[], int return error_number; } - tester = atoi((char*) source); + tester = atoi((char *) source); if ((tester < 3) || (tester > 131070)) { strcpy(symbol->errtxt, "352: Data out of range (3 to 131070)"); @@ -126,7 +126,7 @@ static int pharma_two_calc(struct zint_symbol *symbol, unsigned char source[], c char inter[17]; int error_number; - tester = atoi((char*) source); + tester = atoi((char *) source); if ((tester < 4) || (tester > 64570080)) { strcpy(symbol->errtxt, "353: Data out of range (4 to 64570080)"); @@ -361,7 +361,7 @@ INTERNAL int code32(struct zint_symbol *symbol, unsigned char source[], int leng } risultante[6] = '\0'; /* Plot the barcode using Code 39 */ - error_number = c39(symbol, (unsigned char*) risultante, (int) strlen(risultante)); + error_number = c39(symbol, (unsigned char *) risultante, (int) strlen(risultante)); if (error_number != 0) { /* Should never happen */ return error_number; /* Not reached */ } diff --git a/backend/pdf417.c b/backend/pdf417.c index 2cae1fc4..5bea1954 100644 --- a/backend/pdf417.c +++ b/backend/pdf417.c @@ -97,7 +97,7 @@ static const char MicroAutosize[56] = { /* 866 */ -static int quelmode(unsigned char codeascii) { +static int quelmode(const unsigned char codeascii) { if ((codeascii <= '9') && (codeascii >= '0')) { return NUM; } @@ -234,7 +234,8 @@ static void pdfsmooth(int liste[2][PDF417_MAX_LEN], int *indexliste) { } /* 547 */ -static void textprocess(int *chainemc, int *mclength, char chaine[], int start, int length, int is_micro) { +static void textprocess(int *chainemc, int *mclength, const unsigned char chaine[], int start, const int length, + const int is_micro) { int j, indexlistet, curtable, listet[2][PDF417_MAX_LEN] = {{0}}, chainet[PDF417_MAX_LEN], wnet; wnet = 0; @@ -396,7 +397,8 @@ static void textprocess(int *chainemc, int *mclength, char chaine[], int start, } /* 671 */ -INTERNAL void byteprocess(int *chainemc, int *mclength, unsigned char chaine[], int start, int length, int debug) { +INTERNAL void byteprocess(int *chainemc, int *mclength, const unsigned char chaine[], int start, const int length, + const int debug) { if (debug) printf("\nEntering byte mode at position %d\n", start); @@ -453,7 +455,7 @@ INTERNAL void byteprocess(int *chainemc, int *mclength, unsigned char chaine[], } /* 712 */ -static void numbprocess(int *chainemc, int *mclength, char chaine[], int start, int length) { +static void numbprocess(int *chainemc, int *mclength, const unsigned char chaine[], int start, const int length) { int j, loop, dummy[50] = {0}, diviseur, nombre; char chainemod[46], chainemult[46]; @@ -596,13 +598,13 @@ static int pdf417(struct zint_symbol *symbol, unsigned char chaine[], const int for (i = 0; i < indexliste; i++) { switch (liste[1][i]) { case TEX: /* 547 - text mode */ - textprocess(chainemc, &mclength, (char*) chaine, indexchaine, liste[0][i], 0 /*is_micro*/); + textprocess(chainemc, &mclength, chaine, indexchaine, liste[0][i], 0 /*is_micro*/); break; case BYT: /* 670 - octet stream mode */ byteprocess(chainemc, &mclength, chaine, indexchaine, liste[0][i], debug); break; case NUM: /* 712 - numeric mode */ - numbprocess(chainemc, &mclength, (char*) chaine, indexchaine, liste[0][i]); + numbprocess(chainemc, &mclength, chaine, indexchaine, liste[0][i]); break; } indexchaine = indexchaine + liste[0][i]; @@ -920,13 +922,13 @@ INTERNAL int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], in for (i = 0; i < indexliste; i++) { switch (liste[1][i]) { case TEX: /* 547 - text mode */ - textprocess(chainemc, &mclength, (char*) chaine, indexchaine, liste[0][i], 1 /*is_micro*/); + textprocess(chainemc, &mclength, chaine, indexchaine, liste[0][i], 1 /*is_micro*/); break; case BYT: /* 670 - octet stream mode */ byteprocess(chainemc, &mclength, chaine, indexchaine, liste[0][i], debug); break; case NUM: /* 712 - numeric mode */ - numbprocess(chainemc, &mclength, (char*) chaine, indexchaine, liste[0][i]); + numbprocess(chainemc, &mclength, chaine, indexchaine, liste[0][i]); break; } indexchaine = indexchaine + liste[0][i]; diff --git a/backend/pdf417.h b/backend/pdf417.h index 29ad5a41..854e4a51 100644 --- a/backend/pdf417.h +++ b/backend/pdf417.h @@ -508,6 +508,7 @@ static const unsigned short int rap_centre[52] = { 0x2DC, 0x2DE }; -INTERNAL void byteprocess(int *chainemc, int *mclength, unsigned char chaine[], int start, int length, int debug); +INTERNAL void byteprocess(int *chainemc, int *mclength, const unsigned char chaine[], int start, const int length, + const int debug); #endif /* __PDF417_H */ diff --git a/backend/plessey.c b/backend/plessey.c index ae33bee1..f904d60a 100644 --- a/backend/plessey.c +++ b/backend/plessey.c @@ -66,6 +66,7 @@ INTERNAL int plessey(struct zint_symbol *symbol, unsigned char source[], int len strcpy(symbol->errtxt, "371: Invalid character in data (digits and \"ABCDEF\" only)"); return error_number; } + if (!(checkptr = (unsigned char *) calloc(1, length * 4 + 8))) { strcpy(symbol->errtxt, "373: Insufficient memory for check digit CRC buffer"); return ZINT_ERROR_MEMORY; @@ -128,10 +129,8 @@ static char msi_check_digit_mod10(const unsigned char source[], const int length int i, x = 0, undoubled = 0; for (i = length - 1; i >= 0; i--) { + /* Note overflow impossible for max length 65 * max weight 9 * max val 15 == 8775 */ x += vals[undoubled][ctoi(source[i])]; - if (x > 32767 - 20) { - x %= 10; /* Prevent overflow */ - } undoubled = !undoubled; } @@ -144,10 +143,8 @@ static char msi_check_digit_mod11(const unsigned char source[], const int length int i, x = 0, weight = 2; for (i = length - 1; i >= 0; i--) { + /* Note overflow impossible for max length 65 * max weight 9 * max val 15 == 8775 */ x += weight * ctoi(source[i]); - if (x > 32767 - 200) { - x %= 11; /* Prevent overflow */ - } weight++; if (weight > wrap) { weight = 2; @@ -299,17 +296,16 @@ INTERNAL int msi_handle(struct zint_symbol *symbol, unsigned char source[], int int check_option = symbol->option_2; int no_checktext = 0; + if (length > 65) { + strcpy(symbol->errtxt, "372: Input too long (65 character maximum)"); + return ZINT_ERROR_TOO_LONG; + } error_number = is_sane(NEON, source, length); if (error_number != 0) { strcpy(symbol->errtxt, "377: Invalid character in data (digits only)"); return ZINT_ERROR_INVALID_DATA; } - if (length > 65) { - strcpy(symbol->errtxt, "372: Input too long (65 character maximum)"); - return ZINT_ERROR_TOO_LONG; - } - if (check_option >= 11 && check_option <= 16) { /* +10 means don't print check digits in HRT */ check_option -= 10; no_checktext = 1; diff --git a/backend/png.c b/backend/png.c index 58556682..431ed2fe 100644 --- a/backend/png.c +++ b/backend/png.c @@ -111,7 +111,7 @@ INTERNAL int png_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf) #ifndef _MSC_VER unsigned char outdata[symbol->bitmap_width]; #else - unsigned char* outdata = (unsigned char*) _alloca(symbol->bitmap_width); + unsigned char *outdata = (unsigned char *) _alloca(symbol->bitmap_width); #endif wpng_error.symbol = symbol; diff --git a/backend/postal.c b/backend/postal.c index 351b040d..d6b59b14 100644 --- a/backend/postal.c +++ b/backend/postal.c @@ -272,7 +272,7 @@ INTERNAL int korea_post(struct zint_symbol *symbol, unsigned char source[], int } zeroes = 6 - length; memset(localstr, '0', zeroes); - strcpy(localstr + zeroes, (char *) source); + ustrcpy(localstr + zeroes, source); total = 0; for (loop = 0; loop < 6; loop++) { @@ -290,7 +290,7 @@ INTERNAL int korea_post(struct zint_symbol *symbol, unsigned char source[], int } lookup(NEON, KoreaTable, localstr[6], dest); expand(symbol, dest); - ustrcpy(symbol->text, (unsigned char*) localstr); + ustrcpy(symbol->text, localstr); // TODO: Find documentation on BARCODE_KOREAPOST dimensions/height @@ -492,7 +492,7 @@ INTERNAL int kix_code(struct zint_symbol *symbol, unsigned char source[], int le return error_number; } - strcpy(localstr, (char *) source); + ustrcpy(localstr, source); /* Encode data */ for (i = 0; i < length; i++) { @@ -540,8 +540,8 @@ INTERNAL int daft_code(struct zint_symbol *symbol, unsigned char source[], int l strcpy(symbol->errtxt, "492: Input too long (50 character maximum)"); return ZINT_ERROR_TOO_LONG; } - to_upper((unsigned char*) source); - error_number = is_sane(DAFTSET, (unsigned char*) source, length); + to_upper(source); + error_number = is_sane(DAFTSET, source, length); if (error_number == ZINT_ERROR_INVALID_DATA) { strcpy(symbol->errtxt, "493: Invalid character in data (\"D\", \"A\", \"F\" and \"T\" only)"); @@ -632,9 +632,9 @@ INTERNAL int japan_post(struct zint_symbol *symbol, unsigned char source[], int char inter[23]; #ifndef _MSC_VER - char local_source[length + 1]; + unsigned char local_source[length + 1]; #else - char* local_source = (char*) _alloca(length + 1); + unsigned char *local_source = (unsigned char *) _alloca(length + 1); #endif if (length > 20) { @@ -642,10 +642,10 @@ INTERNAL int japan_post(struct zint_symbol *symbol, unsigned char source[], int return ZINT_ERROR_TOO_LONG; } - strcpy(local_source, (char*) source); - to_upper((unsigned char*) local_source); + ustrcpy(local_source, source); + to_upper(local_source); - if (is_sane(SHKASUTSET, (unsigned char*) local_source, length) == ZINT_ERROR_INVALID_DATA) { + if (is_sane(SHKASUTSET, local_source, length) == ZINT_ERROR_INVALID_DATA) { strcpy(symbol->errtxt, "497: Invalid character in data (alphanumerics and \"-\" only)"); return ZINT_ERROR_INVALID_DATA; } diff --git a/backend/qr.c b/backend/qr.c index 11371984..2a427973 100644 --- a/backend/qr.c +++ b/backend/qr.c @@ -962,6 +962,8 @@ static int cwbit(const unsigned char *fullstream, const int i) { static void populate_grid(unsigned char *grid, const int h_size, const int v_size, const unsigned char *fullstream, const int cw) { + const int not_rmqr = v_size == h_size; + const int x_start = h_size - (not_rmqr ? 2 : 3); /* For rMQR allow for righthand vertical timing pattern */ int direction = 1; /* up */ int row = 0; /* right hand side */ @@ -971,10 +973,10 @@ static void populate_grid(unsigned char *grid, const int h_size, const int v_siz y = v_size - 1; i = 0; while (i < n) { - int x = (h_size - 2) - (row * 2); + int x = x_start - (row * 2); int r = y * h_size; - if ((x < 6) && (v_size == h_size)) + if ((x < 6) && (not_rmqr)) x--; /* skip over vertical timing pattern */ if (!(grid[r + (x + 1)] & 0xf0)) { @@ -2601,6 +2603,10 @@ INTERNAL int microqr(struct zint_symbol *symbol, unsigned char source[], int len break; } + if (debug_print) { + printf("Version: M%d, Size: %dx%d, ECC: %d, Format %d\n", version + 1, size, size, ecc_level, format); + } + format_full = qr_annex_c1[(format << 2) + bitmask]; if (format_full & 0x4000) { @@ -2837,7 +2843,7 @@ static void setup_rmqr_grid(unsigned char *grid, const int h_size, const int v_s } if (v_size > 7) { // Note for v_size = 9 this overrides the bottom right corner finder pattern - for(i = 0; i < 8; i++) { + for (i = 0; i < 8; i++) { grid[(7 * h_size) + i] = 0x20; } } @@ -2845,14 +2851,14 @@ static void setup_rmqr_grid(unsigned char *grid, const int h_size, const int v_s /* Add alignment patterns */ if (h_size > 27) { h_version = 0; // Suppress compiler warning [-Wmaybe-uninitialized] - for(i = 0; i < 5; i++) { + for (i = 0; i < 5; i++) { if (h_size == rmqr_width[i]) { h_version = i; break; } } - for(i = 0; i < 4; i++) { + for (i = 0; i < 4; i++) { finder_position = rmqr_table_d1[(h_version * 4) + i]; if (finder_position != 0) { @@ -3000,7 +3006,7 @@ INTERNAL int rmqr(struct zint_symbol *symbol, unsigned char source[], int length if (symbol->option_2 >= 33) { // User has specified symbol height only version = rmqr_fixed_height_upper_bound[symbol->option_2 - 32]; - for(i = version - 1; i > rmqr_fixed_height_upper_bound[symbol->option_2 - 33]; i--) { + for (i = version - 1; i > rmqr_fixed_height_upper_bound[symbol->option_2 - 33]; i--) { est_binlen = getBinaryLength(RMQR_VERSION + i, mode, jisdata, length, gs1, 0 /*eci*/, debug_print); if (ecc_level == LEVEL_M) { if (8 * rmqr_data_codewords_M[i] >= est_binlen) { @@ -3117,7 +3123,6 @@ INTERNAL int rmqr(struct zint_symbol *symbol, unsigned char source[], int length grid[(h_size * (v_size - 6)) + (h_size - 4)] = (right_format_info >> 16) & 0x01; grid[(h_size * (v_size - 6)) + (h_size - 3)] = (right_format_info >> 17) & 0x01; - symbol->width = h_size; symbol->rows = v_size; diff --git a/backend/qr.h b/backend/qr.h index 81004c65..21fd42f7 100644 --- a/backend/qr.h +++ b/backend/qr.h @@ -123,14 +123,14 @@ static const unsigned short int rmqr_total_codewords[] = { static const unsigned short int rmqr_numeric_cci[] = { 4, 5, 6, 7, 7, 5, 6, 7, 7, 8, - 5, 6, 7, 7, 8, 8, - 5, 7, 7, 8, 8, 8, + 4, 6, 7, 7, 8, 8, + 5, 6, 7, 8, 8, 8, // Note R13x77 (4th) 8 bits but max numerics 124 (7 bits) 7, 7, 8, 8, 9, 7, 8, 8, 8, 9 }; static const unsigned short int rmqr_alphanum_cci[] = { - 4, 5, 5, 6, 6, + 3, 5, 5, 6, 6, 5, 5, 6, 6, 7, 4, 5, 6, 6, 7, 7, 5, 6, 6, 7, 7, 8, diff --git a/backend/raster.c b/backend/raster.c index c718d672..06a8fc0c 100644 --- a/backend/raster.c +++ b/backend/raster.c @@ -299,8 +299,9 @@ static void draw_letter(unsigned char *pixelbuf, const unsigned char letter, int skip = 1; } + /* Following should never happen (ISBN check digit "X" not printed) */ if ((textflags & UPCEAN_TEXT) && (letter < '0' || letter > '9')) { - skip = 1; + skip = 1; /* Not reached */ } if (yposn < 0) { /* Allow xposn < 0, dealt with below */ diff --git a/backend/tests/data/eps/maxicode_no_bg_hwsp3_rotate_180.eps b/backend/tests/data/eps/maxicode_no_bg_hwsp3_rotate_180.eps new file mode 100644 index 00000000..2dad2ac6 --- /dev/null +++ b/backend/tests/data/eps/maxicode_no_bg_hwsp3_rotate_180.eps @@ -0,0 +1,379 @@ +%!PS-Adobe-3.0 EPSF-3.0 +%%Creator: Zint 2.9.1.9 +%%Title: Zint Generated Symbol +%%Pages: 0 +%%BoundingBox: 0 0 72 58 +%%EndComments +/TL { setlinewidth moveto lineto stroke } bind def +/TD { newpath 0 360 arc fill } bind def +/TH { 0 setlinewidth moveto lineto lineto lineto lineto lineto closepath fill } bind def +/TB { 2 copy } bind def +/TR { newpath 4 1 roll exch moveto 1 index 0 rlineto 0 exch rlineto neg 0 rlineto closepath fill } bind def +/TE { pop pop } bind def +newpath +0.00 0.00 0.00 setrgbcolor +63.00 2.15 63.87 1.65 63.87 0.65 63.00 0.15 62.13 0.65 62.13 1.65 TH +59.00 2.15 59.87 1.65 59.87 0.65 59.00 0.15 58.13 0.65 58.13 1.65 TH +55.00 2.15 55.87 1.65 55.87 0.65 55.00 0.15 54.13 0.65 54.13 1.65 TH +51.00 2.15 51.87 1.65 51.87 0.65 51.00 0.15 50.13 0.65 50.13 1.65 TH +47.00 2.15 47.87 1.65 47.87 0.65 47.00 0.15 46.13 0.65 46.13 1.65 TH +43.00 2.15 43.87 1.65 43.87 0.65 43.00 0.15 42.13 0.65 42.13 1.65 TH +39.00 2.15 39.87 1.65 39.87 0.65 39.00 0.15 38.13 0.65 38.13 1.65 TH +35.00 2.15 35.87 1.65 35.87 0.65 35.00 0.15 34.13 0.65 34.13 1.65 TH +31.00 2.15 31.87 1.65 31.87 0.65 31.00 0.15 30.13 0.65 30.13 1.65 TH +27.00 2.15 27.87 1.65 27.87 0.65 27.00 0.15 26.13 0.65 26.13 1.65 TH +23.00 2.15 23.87 1.65 23.87 0.65 23.00 0.15 22.13 0.65 22.13 1.65 TH +19.00 2.15 19.87 1.65 19.87 0.65 19.00 0.15 18.13 0.65 18.13 1.65 TH +15.00 2.15 15.87 1.65 15.87 0.65 15.00 0.15 14.13 0.65 14.13 1.65 TH +11.00 2.15 11.87 1.65 11.87 0.65 11.00 0.15 10.13 0.65 10.13 1.65 TH +9.00 2.15 9.87 1.65 9.87 0.65 9.00 0.15 8.13 0.65 8.13 1.65 TH +7.00 2.15 7.87 1.65 7.87 0.65 7.00 0.15 6.13 0.65 6.13 1.65 TH +65.00 5.62 65.87 5.12 65.87 4.12 65.00 3.62 64.13 4.12 64.13 5.12 TH +61.00 5.62 61.87 5.12 61.87 4.12 61.00 3.62 60.13 4.12 60.13 5.12 TH +57.00 5.62 57.87 5.12 57.87 4.12 57.00 3.62 56.13 4.12 56.13 5.12 TH +53.00 5.62 53.87 5.12 53.87 4.12 53.00 3.62 52.13 4.12 52.13 5.12 TH +49.00 5.62 49.87 5.12 49.87 4.12 49.00 3.62 48.13 4.12 48.13 5.12 TH +45.00 5.62 45.87 5.12 45.87 4.12 45.00 3.62 44.13 4.12 44.13 5.12 TH +41.00 5.62 41.87 5.12 41.87 4.12 41.00 3.62 40.13 4.12 40.13 5.12 TH +37.00 5.62 37.87 5.12 37.87 4.12 37.00 3.62 36.13 4.12 36.13 5.12 TH +33.00 5.62 33.87 5.12 33.87 4.12 33.00 3.62 32.13 4.12 32.13 5.12 TH +29.00 5.62 29.87 5.12 29.87 4.12 29.00 3.62 28.13 4.12 28.13 5.12 TH +25.00 5.62 25.87 5.12 25.87 4.12 25.00 3.62 24.13 4.12 24.13 5.12 TH +21.00 5.62 21.87 5.12 21.87 4.12 21.00 3.62 20.13 4.12 20.13 5.12 TH +17.00 5.62 17.87 5.12 17.87 4.12 17.00 3.62 16.13 4.12 16.13 5.12 TH +13.00 5.62 13.87 5.12 13.87 4.12 13.00 3.62 12.13 4.12 12.13 5.12 TH +9.00 5.62 9.87 5.12 9.87 4.12 9.00 3.62 8.13 4.12 8.13 5.12 TH +62.00 7.35 62.87 6.85 62.87 5.85 62.00 5.35 61.13 5.85 61.13 6.85 TH +58.00 7.35 58.87 6.85 58.87 5.85 58.00 5.35 57.13 5.85 57.13 6.85 TH +54.00 7.35 54.87 6.85 54.87 5.85 54.00 5.35 53.13 5.85 53.13 6.85 TH +50.00 7.35 50.87 6.85 50.87 5.85 50.00 5.35 49.13 5.85 49.13 6.85 TH +46.00 7.35 46.87 6.85 46.87 5.85 46.00 5.35 45.13 5.85 45.13 6.85 TH +42.00 7.35 42.87 6.85 42.87 5.85 42.00 5.35 41.13 5.85 41.13 6.85 TH +38.00 7.35 38.87 6.85 38.87 5.85 38.00 5.35 37.13 5.85 37.13 6.85 TH +34.00 7.35 34.87 6.85 34.87 5.85 34.00 5.35 33.13 5.85 33.13 6.85 TH +30.00 7.35 30.87 6.85 30.87 5.85 30.00 5.35 29.13 5.85 29.13 6.85 TH +26.00 7.35 26.87 6.85 26.87 5.85 26.00 5.35 25.13 5.85 25.13 6.85 TH +22.00 7.35 22.87 6.85 22.87 5.85 22.00 5.35 21.13 5.85 21.13 6.85 TH +18.00 7.35 18.87 6.85 18.87 5.85 18.00 5.35 17.13 5.85 17.13 6.85 TH +14.00 7.35 14.87 6.85 14.87 5.85 14.00 5.35 13.13 5.85 13.13 6.85 TH +10.00 7.35 10.87 6.85 10.87 5.85 10.00 5.35 9.13 5.85 9.13 6.85 TH +8.00 7.35 8.87 6.85 8.87 5.85 8.00 5.35 7.13 5.85 7.13 6.85 TH +7.00 9.08 7.87 8.58 7.87 7.58 7.00 7.08 6.13 7.58 6.13 8.58 TH +64.00 10.81 64.87 10.31 64.87 9.31 64.00 8.81 63.13 9.31 63.13 10.31 TH +60.00 10.81 60.87 10.31 60.87 9.31 60.00 8.81 59.13 9.31 59.13 10.31 TH +56.00 10.81 56.87 10.31 56.87 9.31 56.00 8.81 55.13 9.31 55.13 10.31 TH +52.00 10.81 52.87 10.31 52.87 9.31 52.00 8.81 51.13 9.31 51.13 10.31 TH +48.00 10.81 48.87 10.31 48.87 9.31 48.00 8.81 47.13 9.31 47.13 10.31 TH +44.00 10.81 44.87 10.31 44.87 9.31 44.00 8.81 43.13 9.31 43.13 10.31 TH +40.00 10.81 40.87 10.31 40.87 9.31 40.00 8.81 39.13 9.31 39.13 10.31 TH +36.00 10.81 36.87 10.31 36.87 9.31 36.00 8.81 35.13 9.31 35.13 10.31 TH +32.00 10.81 32.87 10.31 32.87 9.31 32.00 8.81 31.13 9.31 31.13 10.31 TH +28.00 10.81 28.87 10.31 28.87 9.31 28.00 8.81 27.13 9.31 27.13 10.31 TH +24.00 10.81 24.87 10.31 24.87 9.31 24.00 8.81 23.13 9.31 23.13 10.31 TH +20.00 10.81 20.87 10.31 20.87 9.31 20.00 8.81 19.13 9.31 19.13 10.31 TH +16.00 10.81 16.87 10.31 16.87 9.31 16.00 8.81 15.13 9.31 15.13 10.31 TH +12.00 10.81 12.87 10.31 12.87 9.31 12.00 8.81 11.13 9.31 11.13 10.31 TH +63.00 12.55 63.87 12.05 63.87 11.05 63.00 10.55 62.13 11.05 62.13 12.05 TH +59.00 12.55 59.87 12.05 59.87 11.05 59.00 10.55 58.13 11.05 58.13 12.05 TH +55.00 12.55 55.87 12.05 55.87 11.05 55.00 10.55 54.13 11.05 54.13 12.05 TH +51.00 12.55 51.87 12.05 51.87 11.05 51.00 10.55 50.13 11.05 50.13 12.05 TH +47.00 12.55 47.87 12.05 47.87 11.05 47.00 10.55 46.13 11.05 46.13 12.05 TH +43.00 12.55 43.87 12.05 43.87 11.05 43.00 10.55 42.13 11.05 42.13 12.05 TH +39.00 12.55 39.87 12.05 39.87 11.05 39.00 10.55 38.13 11.05 38.13 12.05 TH +35.00 12.55 35.87 12.05 35.87 11.05 35.00 10.55 34.13 11.05 34.13 12.05 TH +31.00 12.55 31.87 12.05 31.87 11.05 31.00 10.55 30.13 11.05 30.13 12.05 TH +27.00 12.55 27.87 12.05 27.87 11.05 27.00 10.55 26.13 11.05 26.13 12.05 TH +23.00 12.55 23.87 12.05 23.87 11.05 23.00 10.55 22.13 11.05 22.13 12.05 TH +19.00 12.55 19.87 12.05 19.87 11.05 19.00 10.55 18.13 11.05 18.13 12.05 TH +15.00 12.55 15.87 12.05 15.87 11.05 15.00 10.55 14.13 11.05 14.13 12.05 TH +11.00 12.55 11.87 12.05 11.87 11.05 11.00 10.55 10.13 11.05 10.13 12.05 TH +9.00 12.55 9.87 12.05 9.87 11.05 9.00 10.55 8.13 11.05 8.13 12.05 TH +8.00 14.28 8.87 13.78 8.87 12.78 8.00 12.28 7.13 12.78 7.13 13.78 TH +65.00 16.01 65.87 15.51 65.87 14.51 65.00 14.01 64.13 14.51 64.13 15.51 TH +61.00 16.01 61.87 15.51 61.87 14.51 61.00 14.01 60.13 14.51 60.13 15.51 TH +57.00 16.01 57.87 15.51 57.87 14.51 57.00 14.01 56.13 14.51 56.13 15.51 TH +53.00 16.01 53.87 15.51 53.87 14.51 53.00 14.01 52.13 14.51 52.13 15.51 TH +49.00 16.01 49.87 15.51 49.87 14.51 49.00 14.01 48.13 14.51 48.13 15.51 TH +45.00 16.01 45.87 15.51 45.87 14.51 45.00 14.01 44.13 14.51 44.13 15.51 TH +41.00 16.01 41.87 15.51 41.87 14.51 41.00 14.01 40.13 14.51 40.13 15.51 TH +37.00 16.01 37.87 15.51 37.87 14.51 37.00 14.01 36.13 14.51 36.13 15.51 TH +33.00 16.01 33.87 15.51 33.87 14.51 33.00 14.01 32.13 14.51 32.13 15.51 TH +29.00 16.01 29.87 15.51 29.87 14.51 29.00 14.01 28.13 14.51 28.13 15.51 TH +25.00 16.01 25.87 15.51 25.87 14.51 25.00 14.01 24.13 14.51 24.13 15.51 TH +21.00 16.01 21.87 15.51 21.87 14.51 21.00 14.01 20.13 14.51 20.13 15.51 TH +17.00 16.01 17.87 15.51 17.87 14.51 17.00 14.01 16.13 14.51 16.13 15.51 TH +13.00 16.01 13.87 15.51 13.87 14.51 13.00 14.01 12.13 14.51 12.13 15.51 TH +7.00 16.01 7.87 15.51 7.87 14.51 7.00 14.01 6.13 14.51 6.13 15.51 TH +62.00 17.74 62.87 17.24 62.87 16.24 62.00 15.74 61.13 16.24 61.13 17.24 TH +58.00 17.74 58.87 17.24 58.87 16.24 58.00 15.74 57.13 16.24 57.13 17.24 TH +54.00 17.74 54.87 17.24 54.87 16.24 54.00 15.74 53.13 16.24 53.13 17.24 TH +50.00 17.74 50.87 17.24 50.87 16.24 50.00 15.74 49.13 16.24 49.13 17.24 TH +46.00 17.74 46.87 17.24 46.87 16.24 46.00 15.74 45.13 16.24 45.13 17.24 TH +44.00 17.74 44.87 17.24 44.87 16.24 44.00 15.74 43.13 16.24 43.13 17.24 TH +42.00 17.74 42.87 17.24 42.87 16.24 42.00 15.74 41.13 16.24 41.13 17.24 TH +40.00 17.74 40.87 17.24 40.87 16.24 40.00 15.74 39.13 16.24 39.13 17.24 TH +38.00 17.74 38.87 17.24 38.87 16.24 38.00 15.74 37.13 16.24 37.13 17.24 TH +34.00 17.74 34.87 17.24 34.87 16.24 34.00 15.74 33.13 16.24 33.13 17.24 TH +24.00 17.74 24.87 17.24 24.87 16.24 24.00 15.74 23.13 16.24 23.13 17.24 TH +18.00 17.74 18.87 17.24 18.87 16.24 18.00 15.74 17.13 16.24 17.13 17.24 TH +14.00 17.74 14.87 17.24 14.87 16.24 14.00 15.74 13.13 16.24 13.13 17.24 TH +10.00 17.74 10.87 17.24 10.87 16.24 10.00 15.74 9.13 16.24 9.13 17.24 TH +43.00 19.47 43.87 18.97 43.87 17.97 43.00 17.47 42.13 17.97 42.13 18.97 TH +33.00 19.47 33.87 18.97 33.87 17.97 33.00 17.47 32.13 17.97 32.13 18.97 TH +23.00 19.47 23.87 18.97 23.87 17.97 23.00 17.47 22.13 17.97 22.13 18.97 TH +64.00 21.21 64.87 20.71 64.87 19.71 64.00 19.21 63.13 19.71 63.13 20.71 TH +60.00 21.21 60.87 20.71 60.87 19.71 60.00 19.21 59.13 19.71 59.13 20.71 TH +56.00 21.21 56.87 20.71 56.87 19.71 56.00 19.21 55.13 19.71 55.13 20.71 TH +52.00 21.21 52.87 20.71 52.87 19.71 52.00 19.21 51.13 19.71 51.13 20.71 TH +46.00 21.21 46.87 20.71 46.87 19.71 46.00 19.21 45.13 19.71 45.13 20.71 TH +44.00 21.21 44.87 20.71 44.87 19.71 44.00 19.21 43.13 19.71 43.13 20.71 TH +28.00 21.21 28.87 20.71 28.87 19.71 28.00 19.21 27.13 19.71 27.13 20.71 TH +22.00 21.21 22.87 20.71 22.87 19.71 22.00 19.21 21.13 19.71 21.13 20.71 TH +20.00 21.21 20.87 20.71 20.87 19.71 20.00 19.21 19.13 19.71 19.13 20.71 TH +16.00 21.21 16.87 20.71 16.87 19.71 16.00 19.21 15.13 19.71 15.13 20.71 TH +12.00 21.21 12.87 20.71 12.87 19.71 12.00 19.21 11.13 19.71 11.13 20.71 TH +8.00 21.21 8.87 20.71 8.87 19.71 8.00 19.21 7.13 19.71 7.13 20.71 TH +63.00 22.94 63.87 22.44 63.87 21.44 63.00 20.94 62.13 21.44 62.13 22.44 TH +59.00 22.94 59.87 22.44 59.87 21.44 59.00 20.94 58.13 21.44 58.13 22.44 TH +55.00 22.94 55.87 22.44 55.87 21.44 55.00 20.94 54.13 21.44 54.13 22.44 TH +51.00 22.94 51.87 22.44 51.87 21.44 51.00 20.94 50.13 21.44 50.13 22.44 TH +47.00 22.94 47.87 22.44 47.87 21.44 47.00 20.94 46.13 21.44 46.13 22.44 TH +45.00 22.94 45.87 22.44 45.87 21.44 45.00 20.94 44.13 21.44 44.13 22.44 TH +23.00 22.94 23.87 22.44 23.87 21.44 23.00 20.94 22.13 21.44 22.13 22.44 TH +19.00 22.94 19.87 22.44 19.87 21.44 19.00 20.94 18.13 21.44 18.13 22.44 TH +15.00 22.94 15.87 22.44 15.87 21.44 15.00 20.94 14.13 21.44 14.13 22.44 TH +11.00 22.94 11.87 22.44 11.87 21.44 11.00 20.94 10.13 21.44 10.13 22.44 TH +9.00 22.94 9.87 22.44 9.87 21.44 9.00 20.94 8.13 21.44 8.13 22.44 TH +50.00 24.67 50.87 24.17 50.87 23.17 50.00 22.67 49.13 23.17 49.13 24.17 TH +22.00 24.67 22.87 24.17 22.87 23.17 22.00 22.67 21.13 23.17 21.13 24.17 TH +65.00 26.40 65.87 25.90 65.87 24.90 65.00 24.40 64.13 24.90 64.13 25.90 TH +61.00 26.40 61.87 25.90 61.87 24.90 61.00 24.40 60.13 24.90 60.13 25.90 TH +57.00 26.40 57.87 25.90 57.87 24.90 57.00 24.40 56.13 24.90 56.13 25.90 TH +49.00 26.40 49.87 25.90 49.87 24.90 49.00 24.40 48.13 24.90 48.13 25.90 TH +27.00 26.40 27.87 25.90 27.87 24.90 27.00 24.40 26.13 24.90 26.13 25.90 TH +25.00 26.40 25.87 25.90 25.87 24.90 25.00 24.40 24.13 24.90 24.13 25.90 TH +21.00 26.40 21.87 25.90 21.87 24.90 21.00 24.40 20.13 24.90 20.13 25.90 TH +17.00 26.40 17.87 25.90 17.87 24.90 17.00 24.40 16.13 24.90 16.13 25.90 TH +13.00 26.40 13.87 25.90 13.87 24.90 13.00 24.40 12.13 24.90 12.13 25.90 TH +62.00 28.13 62.87 27.63 62.87 26.63 62.00 26.13 61.13 26.63 61.13 27.63 TH +58.00 28.13 58.87 27.63 58.87 26.63 58.00 26.13 57.13 26.63 57.13 27.63 TH +54.00 28.13 54.87 27.63 54.87 26.63 54.00 26.13 53.13 26.63 53.13 27.63 TH +52.00 28.13 52.87 27.63 52.87 26.63 52.00 26.13 51.13 26.63 51.13 27.63 TH +50.00 28.13 50.87 27.63 50.87 26.63 50.00 26.13 49.13 26.63 49.13 27.63 TH +48.00 28.13 48.87 27.63 48.87 26.63 48.00 26.13 47.13 26.63 47.13 27.63 TH +24.00 28.13 24.87 27.63 24.87 26.63 24.00 26.13 23.13 26.63 23.13 27.63 TH +18.00 28.13 18.87 27.63 18.87 26.63 18.00 26.13 17.13 26.63 17.13 27.63 TH +14.00 28.13 14.87 27.63 14.87 26.63 14.00 26.13 13.13 26.63 13.13 27.63 TH +10.00 28.13 10.87 27.63 10.87 26.63 10.00 26.13 9.13 26.63 9.13 27.63 TH +8.00 28.13 8.87 27.63 8.87 26.63 8.00 26.13 7.13 26.63 7.13 27.63 TH +49.00 29.87 49.87 29.37 49.87 28.37 49.00 27.87 48.13 28.37 48.13 29.37 TH +25.00 29.87 25.87 29.37 25.87 28.37 25.00 27.87 24.13 28.37 24.13 29.37 TH +9.00 29.87 9.87 29.37 9.87 28.37 9.00 27.87 8.13 28.37 8.13 29.37 TH +64.00 31.60 64.87 31.10 64.87 30.10 64.00 29.60 63.13 30.10 63.13 31.10 TH +60.00 31.60 60.87 31.10 60.87 30.10 60.00 29.60 59.13 30.10 59.13 31.10 TH +56.00 31.60 56.87 31.10 56.87 30.10 56.00 29.60 55.13 30.10 55.13 31.10 TH +24.00 31.60 24.87 31.10 24.87 30.10 24.00 29.60 23.13 30.10 23.13 31.10 TH +22.00 31.60 22.87 31.10 22.87 30.10 22.00 29.60 21.13 30.10 21.13 31.10 TH +20.00 31.60 20.87 31.10 20.87 30.10 20.00 29.60 19.13 30.10 19.13 31.10 TH +16.00 31.60 16.87 31.10 16.87 30.10 16.00 29.60 15.13 30.10 15.13 31.10 TH +12.00 31.60 12.87 31.10 12.87 30.10 12.00 29.60 11.13 30.10 11.13 31.10 TH +63.00 33.33 63.87 32.83 63.87 31.83 63.00 31.33 62.13 31.83 62.13 32.83 TH +59.00 33.33 59.87 32.83 59.87 31.83 59.00 31.33 58.13 31.83 58.13 32.83 TH +55.00 33.33 55.87 32.83 55.87 31.83 55.00 31.33 54.13 31.83 54.13 32.83 TH +51.00 33.33 51.87 32.83 51.87 31.83 51.00 31.33 50.13 31.83 50.13 32.83 TH +49.00 33.33 49.87 32.83 49.87 31.83 49.00 31.33 48.13 31.83 48.13 32.83 TH +47.00 33.33 47.87 32.83 47.87 31.83 47.00 31.33 46.13 31.83 46.13 32.83 TH +23.00 33.33 23.87 32.83 23.87 31.83 23.00 31.33 22.13 31.83 22.13 32.83 TH +19.00 33.33 19.87 32.83 19.87 31.83 19.00 31.33 18.13 31.83 18.13 32.83 TH +15.00 33.33 15.87 32.83 15.87 31.83 15.00 31.33 14.13 31.83 14.13 32.83 TH +11.00 33.33 11.87 32.83 11.87 31.83 11.00 31.33 10.13 31.83 10.13 32.83 TH +9.00 33.33 9.87 32.83 9.87 31.83 9.00 31.33 8.13 31.83 8.13 32.83 TH +7.00 33.33 7.87 32.83 7.87 31.83 7.00 31.33 6.13 31.83 6.13 32.83 TH +48.00 35.06 48.87 34.56 48.87 33.56 48.00 33.06 47.13 33.56 47.13 34.56 TH +8.00 35.06 8.87 34.56 8.87 33.56 8.00 33.06 7.13 33.56 7.13 34.56 TH +65.00 36.79 65.87 36.29 65.87 35.29 65.00 34.79 64.13 35.29 64.13 36.29 TH +61.00 36.79 61.87 36.29 61.87 35.29 61.00 34.79 60.13 35.29 60.13 36.29 TH +57.00 36.79 57.87 36.29 57.87 35.29 57.00 34.79 56.13 35.29 56.13 36.29 TH +53.00 36.79 53.87 36.29 53.87 35.29 53.00 34.79 52.13 35.29 52.13 36.29 TH +51.00 36.79 51.87 36.29 51.87 35.29 51.00 34.79 50.13 35.29 50.13 36.29 TH +29.00 36.79 29.87 36.29 29.87 35.29 29.00 34.79 28.13 35.29 28.13 36.29 TH +27.00 36.79 27.87 36.29 27.87 35.29 27.00 34.79 26.13 35.29 26.13 36.29 TH +25.00 36.79 25.87 36.29 25.87 35.29 25.00 34.79 24.13 35.29 24.13 36.29 TH +23.00 36.79 23.87 36.29 23.87 35.29 23.00 34.79 22.13 35.29 22.13 36.29 TH +21.00 36.79 21.87 36.29 21.87 35.29 21.00 34.79 20.13 35.29 20.13 36.29 TH +17.00 36.79 17.87 36.29 17.87 35.29 17.00 34.79 16.13 35.29 16.13 36.29 TH +13.00 36.79 13.87 36.29 13.87 35.29 13.00 34.79 12.13 35.29 12.13 36.29 TH +9.00 36.79 9.87 36.29 9.87 35.29 9.00 34.79 8.13 35.29 8.13 36.29 TH +7.00 36.79 7.87 36.29 7.87 35.29 7.00 34.79 6.13 35.29 6.13 36.29 TH +62.00 38.53 62.87 38.03 62.87 37.03 62.00 36.53 61.13 37.03 61.13 38.03 TH +58.00 38.53 58.87 38.03 58.87 37.03 58.00 36.53 57.13 37.03 57.13 38.03 TH +54.00 38.53 54.87 38.03 54.87 37.03 54.00 36.53 53.13 37.03 53.13 38.03 TH +50.00 38.53 50.87 38.03 50.87 37.03 50.00 36.53 49.13 37.03 49.13 38.03 TH +46.00 38.53 46.87 38.03 46.87 37.03 46.00 36.53 45.13 37.03 45.13 38.03 TH +26.00 38.53 26.87 38.03 26.87 37.03 26.00 36.53 25.13 37.03 25.13 38.03 TH +24.00 38.53 24.87 38.03 24.87 37.03 24.00 36.53 23.13 37.03 23.13 38.03 TH +22.00 38.53 22.87 38.03 22.87 37.03 22.00 36.53 21.13 37.03 21.13 38.03 TH +18.00 38.53 18.87 38.03 18.87 37.03 18.00 36.53 17.13 37.03 17.13 38.03 TH +14.00 38.53 14.87 38.03 14.87 37.03 14.00 36.53 13.13 37.03 13.13 38.03 TH +10.00 38.53 10.87 38.03 10.87 37.03 10.00 36.53 9.13 37.03 9.13 38.03 TH +47.00 40.26 47.87 39.76 47.87 38.76 47.00 38.26 46.13 38.76 46.13 39.76 TH +45.00 40.26 45.87 39.76 45.87 38.76 45.00 38.26 44.13 38.76 44.13 39.76 TH +41.00 40.26 41.87 39.76 41.87 38.76 41.00 38.26 40.13 38.76 40.13 39.76 TH +39.00 40.26 39.87 39.76 39.87 38.76 39.00 38.26 38.13 38.76 38.13 39.76 TH +37.00 40.26 37.87 39.76 37.87 38.76 37.00 38.26 36.13 38.76 36.13 39.76 TH +33.00 40.26 33.87 39.76 33.87 38.76 33.00 38.26 32.13 38.76 32.13 39.76 TH +31.00 40.26 31.87 39.76 31.87 38.76 31.00 38.26 30.13 38.76 30.13 39.76 TH +29.00 40.26 29.87 39.76 29.87 38.76 29.00 38.26 28.13 38.76 28.13 39.76 TH +25.00 40.26 25.87 39.76 25.87 38.76 25.00 38.26 24.13 38.76 24.13 39.76 TH +9.00 40.26 9.87 39.76 9.87 38.76 9.00 38.26 8.13 38.76 8.13 39.76 TH +7.00 40.26 7.87 39.76 7.87 38.76 7.00 38.26 6.13 38.76 6.13 39.76 TH +64.00 41.99 64.87 41.49 64.87 40.49 64.00 39.99 63.13 40.49 63.13 41.49 TH +60.00 41.99 60.87 41.49 60.87 40.49 60.00 39.99 59.13 40.49 59.13 41.49 TH +56.00 41.99 56.87 41.49 56.87 40.49 56.00 39.99 55.13 40.49 55.13 41.49 TH +52.00 41.99 52.87 41.49 52.87 40.49 52.00 39.99 51.13 40.49 51.13 41.49 TH +46.00 41.99 46.87 41.49 46.87 40.49 46.00 39.99 45.13 40.49 45.13 41.49 TH +44.00 41.99 44.87 41.49 44.87 40.49 44.00 39.99 43.13 40.49 43.13 41.49 TH +34.00 41.99 34.87 41.49 34.87 40.49 34.00 39.99 33.13 40.49 33.13 41.49 TH +30.00 41.99 30.87 41.49 30.87 40.49 30.00 39.99 29.13 40.49 29.13 41.49 TH +28.00 41.99 28.87 41.49 28.87 40.49 28.00 39.99 27.13 40.49 27.13 41.49 TH +20.00 41.99 20.87 41.49 20.87 40.49 20.00 39.99 19.13 40.49 19.13 41.49 TH +16.00 41.99 16.87 41.49 16.87 40.49 16.00 39.99 15.13 40.49 15.13 41.49 TH +12.00 41.99 12.87 41.49 12.87 40.49 12.00 39.99 11.13 40.49 11.13 41.49 TH +8.00 41.99 8.87 41.49 8.87 40.49 8.00 39.99 7.13 40.49 7.13 41.49 TH +63.00 43.72 63.87 43.22 63.87 42.22 63.00 41.72 62.13 42.22 62.13 43.22 TH +59.00 43.72 59.87 43.22 59.87 42.22 59.00 41.72 58.13 42.22 58.13 43.22 TH +55.00 43.72 55.87 43.22 55.87 42.22 55.00 41.72 54.13 42.22 54.13 43.22 TH +51.00 43.72 51.87 43.22 51.87 42.22 51.00 41.72 50.13 42.22 50.13 43.22 TH +47.00 43.72 47.87 43.22 47.87 42.22 47.00 41.72 46.13 42.22 46.13 43.22 TH +43.00 43.72 43.87 43.22 43.87 42.22 43.00 41.72 42.13 42.22 42.13 43.22 TH +39.00 43.72 39.87 43.22 39.87 42.22 39.00 41.72 38.13 42.22 38.13 43.22 TH +35.00 43.72 35.87 43.22 35.87 42.22 35.00 41.72 34.13 42.22 34.13 43.22 TH +31.00 43.72 31.87 43.22 31.87 42.22 31.00 41.72 30.13 42.22 30.13 43.22 TH +27.00 43.72 27.87 43.22 27.87 42.22 27.00 41.72 26.13 42.22 26.13 43.22 TH +25.00 43.72 25.87 43.22 25.87 42.22 25.00 41.72 24.13 42.22 24.13 43.22 TH +23.00 43.72 23.87 43.22 23.87 42.22 23.00 41.72 22.13 42.22 22.13 43.22 TH +21.00 43.72 21.87 43.22 21.87 42.22 21.00 41.72 20.13 42.22 20.13 43.22 TH +19.00 43.72 19.87 43.22 19.87 42.22 19.00 41.72 18.13 42.22 18.13 43.22 TH +15.00 43.72 15.87 43.22 15.87 42.22 15.00 41.72 14.13 42.22 14.13 43.22 TH +11.00 43.72 11.87 43.22 11.87 42.22 11.00 41.72 10.13 42.22 10.13 43.22 TH +9.00 43.72 9.87 43.22 9.87 42.22 9.00 41.72 8.13 42.22 8.13 43.22 TH +7.00 43.72 7.87 43.22 7.87 42.22 7.00 41.72 6.13 42.22 6.13 43.22 TH +24.00 45.45 24.87 44.95 24.87 43.95 24.00 43.45 23.13 43.95 23.13 44.95 TH +22.00 45.45 22.87 44.95 22.87 43.95 22.00 43.45 21.13 43.95 21.13 44.95 TH +20.00 45.45 20.87 44.95 20.87 43.95 20.00 43.45 19.13 43.95 19.13 44.95 TH +18.00 45.45 18.87 44.95 18.87 43.95 18.00 43.45 17.13 43.95 17.13 44.95 TH +14.00 45.45 14.87 44.95 14.87 43.95 14.00 43.45 13.13 43.95 13.13 44.95 TH +10.00 45.45 10.87 44.95 10.87 43.95 10.00 43.45 9.13 43.95 9.13 44.95 TH +8.00 45.45 8.87 44.95 8.87 43.95 8.00 43.45 7.13 43.95 7.13 44.95 TH +65.00 47.19 65.87 46.69 65.87 45.69 65.00 45.19 64.13 45.69 64.13 46.69 TH +61.00 47.19 61.87 46.69 61.87 45.69 61.00 45.19 60.13 45.69 60.13 46.69 TH +57.00 47.19 57.87 46.69 57.87 45.69 57.00 45.19 56.13 45.69 56.13 46.69 TH +53.00 47.19 53.87 46.69 53.87 45.69 53.00 45.19 52.13 45.69 52.13 46.69 TH +49.00 47.19 49.87 46.69 49.87 45.69 49.00 45.19 48.13 45.69 48.13 46.69 TH +45.00 47.19 45.87 46.69 45.87 45.69 45.00 45.19 44.13 45.69 44.13 46.69 TH +41.00 47.19 41.87 46.69 41.87 45.69 41.00 45.19 40.13 45.69 40.13 46.69 TH +37.00 47.19 37.87 46.69 37.87 45.69 37.00 45.19 36.13 45.69 36.13 46.69 TH +33.00 47.19 33.87 46.69 33.87 45.69 33.00 45.19 32.13 45.69 32.13 46.69 TH +29.00 47.19 29.87 46.69 29.87 45.69 29.00 45.19 28.13 45.69 28.13 46.69 TH +9.00 47.19 9.87 46.69 9.87 45.69 9.00 45.19 8.13 45.69 8.13 46.69 TH +64.00 48.92 64.87 48.42 64.87 47.42 64.00 46.92 63.13 47.42 63.13 48.42 TH +62.00 48.92 62.87 48.42 62.87 47.42 62.00 46.92 61.13 47.42 61.13 48.42 TH +60.00 48.92 60.87 48.42 60.87 47.42 60.00 46.92 59.13 47.42 59.13 48.42 TH +58.00 48.92 58.87 48.42 58.87 47.42 58.00 46.92 57.13 47.42 57.13 48.42 TH +56.00 48.92 56.87 48.42 56.87 47.42 56.00 46.92 55.13 47.42 55.13 48.42 TH +54.00 48.92 54.87 48.42 54.87 47.42 54.00 46.92 53.13 47.42 53.13 48.42 TH +52.00 48.92 52.87 48.42 52.87 47.42 52.00 46.92 51.13 47.42 51.13 48.42 TH +50.00 48.92 50.87 48.42 50.87 47.42 50.00 46.92 49.13 47.42 49.13 48.42 TH +40.00 48.92 40.87 48.42 40.87 47.42 40.00 46.92 39.13 47.42 39.13 48.42 TH +38.00 48.92 38.87 48.42 38.87 47.42 38.00 46.92 37.13 47.42 37.13 48.42 TH +36.00 48.92 36.87 48.42 36.87 47.42 36.00 46.92 35.13 47.42 35.13 48.42 TH +34.00 48.92 34.87 48.42 34.87 47.42 34.00 46.92 33.13 47.42 33.13 48.42 TH +22.00 48.92 22.87 48.42 22.87 47.42 22.00 46.92 21.13 47.42 21.13 48.42 TH +18.00 48.92 18.87 48.42 18.87 47.42 18.00 46.92 17.13 47.42 17.13 48.42 TH +63.00 50.65 63.87 50.15 63.87 49.15 63.00 48.65 62.13 49.15 62.13 50.15 TH +59.00 50.65 59.87 50.15 59.87 49.15 59.00 48.65 58.13 49.15 58.13 50.15 TH +57.00 50.65 57.87 50.15 57.87 49.15 57.00 48.65 56.13 49.15 56.13 50.15 TH +53.00 50.65 53.87 50.15 53.87 49.15 53.00 48.65 52.13 49.15 52.13 50.15 TH +49.00 50.65 49.87 50.15 49.87 49.15 49.00 48.65 48.13 49.15 48.13 50.15 TH +47.00 50.65 47.87 50.15 47.87 49.15 47.00 48.65 46.13 49.15 46.13 50.15 TH +45.00 50.65 45.87 50.15 45.87 49.15 45.00 48.65 44.13 49.15 44.13 50.15 TH +43.00 50.65 43.87 50.15 43.87 49.15 43.00 48.65 42.13 49.15 42.13 50.15 TH +33.00 50.65 33.87 50.15 33.87 49.15 33.00 48.65 32.13 49.15 32.13 50.15 TH +31.00 50.65 31.87 50.15 31.87 49.15 31.00 48.65 30.13 49.15 30.13 50.15 TH +29.00 50.65 29.87 50.15 29.87 49.15 29.00 48.65 28.13 49.15 28.13 50.15 TH +27.00 50.65 27.87 50.15 27.87 49.15 27.00 48.65 26.13 49.15 26.13 50.15 TH +23.00 50.65 23.87 50.15 23.87 49.15 23.00 48.65 22.13 49.15 22.13 50.15 TH +19.00 50.65 19.87 50.15 19.87 49.15 19.00 48.65 18.13 49.15 18.13 50.15 TH +15.00 50.65 15.87 50.15 15.87 49.15 15.00 48.65 14.13 49.15 14.13 50.15 TH +11.00 50.65 11.87 50.15 11.87 49.15 11.00 48.65 10.13 49.15 10.13 50.15 TH +64.00 52.38 64.87 51.88 64.87 50.88 64.00 50.38 63.13 50.88 63.13 51.88 TH +60.00 52.38 60.87 51.88 60.87 50.88 60.00 50.38 59.13 50.88 59.13 51.88 TH +56.00 52.38 56.87 51.88 56.87 50.88 56.00 50.38 55.13 50.88 55.13 51.88 TH +52.00 52.38 52.87 51.88 52.87 50.88 52.00 50.38 51.13 50.88 51.13 51.88 TH +38.00 52.38 38.87 51.88 38.87 50.88 38.00 50.38 37.13 50.88 37.13 51.88 TH +34.00 52.38 34.87 51.88 34.87 50.88 34.00 50.38 33.13 50.88 33.13 51.88 TH +30.00 52.38 30.87 51.88 30.87 50.88 30.00 50.38 29.13 50.88 29.13 51.88 TH +26.00 52.38 26.87 51.88 26.87 50.88 26.00 50.38 25.13 50.88 25.13 51.88 TH +24.00 52.38 24.87 51.88 24.87 50.88 24.00 50.38 23.13 50.88 23.13 51.88 TH +22.00 52.38 22.87 51.88 22.87 50.88 22.00 50.38 21.13 50.88 21.13 51.88 TH +20.00 52.38 20.87 51.88 20.87 50.88 20.00 50.38 19.13 50.88 19.13 51.88 TH +18.00 52.38 18.87 51.88 18.87 50.88 18.00 50.38 17.13 50.88 17.13 51.88 TH +16.00 52.38 16.87 51.88 16.87 50.88 16.00 50.38 15.13 50.88 15.13 51.88 TH +12.00 52.38 12.87 51.88 12.87 50.88 12.00 50.38 11.13 50.88 11.13 51.88 TH +8.00 52.38 8.87 51.88 8.87 50.88 8.00 50.38 7.13 50.88 7.13 51.88 TH +65.00 54.11 65.87 53.61 65.87 52.61 65.00 52.11 64.13 52.61 64.13 53.61 TH +63.00 54.11 63.87 53.61 63.87 52.61 63.00 52.11 62.13 52.61 62.13 53.61 TH +61.00 54.11 61.87 53.61 61.87 52.61 61.00 52.11 60.13 52.61 60.13 53.61 TH +59.00 54.11 59.87 53.61 59.87 52.61 59.00 52.11 58.13 52.61 58.13 53.61 TH +55.00 54.11 55.87 53.61 55.87 52.61 55.00 52.11 54.13 52.61 54.13 53.61 TH +51.00 54.11 51.87 53.61 51.87 52.61 51.00 52.11 50.13 52.61 50.13 53.61 TH +49.00 54.11 49.87 53.61 49.87 52.61 49.00 52.11 48.13 52.61 48.13 53.61 TH +45.00 54.11 45.87 53.61 45.87 52.61 45.00 52.11 44.13 52.61 44.13 53.61 TH +33.00 54.11 33.87 53.61 33.87 52.61 33.00 52.11 32.13 52.61 32.13 53.61 TH +31.00 54.11 31.87 53.61 31.87 52.61 31.00 52.11 30.13 52.61 30.13 53.61 TH +29.00 54.11 29.87 53.61 29.87 52.61 29.00 52.11 28.13 52.61 28.13 53.61 TH +27.00 54.11 27.87 53.61 27.87 52.61 27.00 52.11 26.13 52.61 26.13 53.61 TH +23.00 54.11 23.87 53.61 23.87 52.61 23.00 52.11 22.13 52.61 22.13 53.61 TH +19.00 54.11 19.87 53.61 19.87 52.61 19.00 52.11 18.13 52.61 18.13 53.61 TH +17.00 54.11 17.87 53.61 17.87 52.61 17.00 52.11 16.13 52.61 16.13 53.61 TH +13.00 54.11 13.87 53.61 13.87 52.61 13.00 52.11 12.13 52.61 12.13 53.61 TH +9.00 54.11 9.87 53.61 9.87 52.61 9.00 52.11 8.13 52.61 8.13 53.61 TH +62.00 55.85 62.87 55.35 62.87 54.35 62.00 53.85 61.13 54.35 61.13 55.35 TH +58.00 55.85 58.87 55.35 58.87 54.35 58.00 53.85 57.13 54.35 57.13 55.35 TH +56.00 55.85 56.87 55.35 56.87 54.35 56.00 53.85 55.13 54.35 55.13 55.35 TH +52.00 55.85 52.87 55.35 52.87 54.35 52.00 53.85 51.13 54.35 51.13 55.35 TH +48.00 55.85 48.87 55.35 48.87 54.35 48.00 53.85 47.13 54.35 47.13 55.35 TH +46.00 55.85 46.87 55.35 46.87 54.35 46.00 53.85 45.13 54.35 45.13 55.35 TH +44.00 55.85 44.87 55.35 44.87 54.35 44.00 53.85 43.13 54.35 43.13 55.35 TH +42.00 55.85 42.87 55.35 42.87 54.35 42.00 53.85 41.13 54.35 41.13 55.35 TH +38.00 55.85 38.87 55.35 38.87 54.35 38.00 53.85 37.13 54.35 37.13 55.35 TH +34.00 55.85 34.87 55.35 34.87 54.35 34.00 53.85 33.13 54.35 33.13 55.35 TH +32.00 55.85 32.87 55.35 32.87 54.35 32.00 53.85 31.13 54.35 31.13 55.35 TH +28.00 55.85 28.87 55.35 28.87 54.35 28.00 53.85 27.13 54.35 27.13 55.35 TH +24.00 55.85 24.87 55.35 24.87 54.35 24.00 53.85 23.13 54.35 23.13 55.35 TH +20.00 55.85 20.87 55.35 20.87 54.35 20.00 53.85 19.13 54.35 19.13 55.35 TH +16.00 55.85 16.87 55.35 16.87 54.35 16.00 53.85 15.13 54.35 15.13 55.35 TH +14.00 55.85 14.87 55.35 14.87 54.35 14.00 53.85 13.13 54.35 13.13 55.35 TH +12.00 55.85 12.87 55.35 12.87 54.35 12.00 53.85 11.13 54.35 11.13 55.35 TH +10.00 55.85 10.87 55.35 10.87 54.35 10.00 53.85 9.13 54.35 9.13 55.35 TH +63.00 57.58 63.87 57.08 63.87 56.08 63.00 55.58 62.13 56.08 62.13 57.08 TH +59.00 57.58 59.87 57.08 59.87 56.08 59.00 55.58 58.13 56.08 58.13 57.08 TH +39.00 57.58 39.87 57.08 39.87 56.08 39.00 55.58 38.13 56.08 38.13 57.08 TH +35.00 57.58 35.87 57.08 35.87 56.08 35.00 55.58 34.13 56.08 34.13 57.08 TH +33.00 57.58 33.87 57.08 33.87 56.08 33.00 55.58 32.13 56.08 32.13 57.08 TH +29.00 57.58 29.87 57.08 29.87 56.08 29.00 55.58 28.13 56.08 28.13 57.08 TH +25.00 57.58 25.87 57.08 25.87 56.08 25.00 55.58 24.13 56.08 24.13 57.08 TH +21.00 57.58 21.87 57.08 21.87 56.08 21.00 55.58 20.13 56.08 20.13 57.08 TH +15.00 57.58 15.87 57.08 15.87 56.08 15.00 55.58 14.13 56.08 14.13 57.08 TH +11.00 57.58 11.87 57.08 11.87 56.08 11.00 55.58 10.13 56.08 10.13 57.08 TH +37.00 28.87 9.00 TD +0.00 0.00 1.00 setrgbcolor +37.00 28.87 7.43 TD +0.00 0.00 0.00 setrgbcolor +37.00 28.87 5.86 TD +0.00 0.00 1.00 setrgbcolor +37.00 28.87 4.29 TD +0.00 0.00 0.00 setrgbcolor +37.00 28.87 2.72 TD +0.00 0.00 1.00 setrgbcolor +37.00 28.87 1.15 TD diff --git a/backend/tests/data/svg/telepen_height0.4_rotate_180.svg b/backend/tests/data/svg/telepen_height0.4_rotate_180.svg new file mode 100644 index 00000000..ad2687ea --- /dev/null +++ b/backend/tests/data/svg/telepen_height0.4_rotate_180.svg @@ -0,0 +1,38 @@ + + + + Zint Generated Symbol + + + + + + + + + + + + + + + + + + + + + + + + + + + + A + + + diff --git a/backend/tests/test_codablock.c b/backend/tests/test_codablock.c index 5b1c84d8..5ee3b65e 100644 --- a/backend/tests/test_codablock.c +++ b/backend/tests/test_codablock.c @@ -34,6 +34,8 @@ static void test_large(int index, int debug) { struct item { + int option_1; + int option_2; char *pattern; int length; int ret; @@ -43,20 +45,46 @@ static void test_large(int index, int debug) { // é U+00E9 (\351, 233), UTF-8 C3A9, CodeB-only extended ASCII // s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<")) struct item data[] = { - /* 0*/ { "A", 2666, 0, 44, 728 }, - /* 1*/ { "A", 2725, 0, 44, 739 }, - /* 2*/ { "A", 2726, 0, 44, 739 }, // 4.2.1 c.3 says max 2725 but actually 44 * 62 - 2 == 2726 as mentioned later in 4.8.1 - /* 3*/ { "A", 2727, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 4*/ { "12", 2726 * 2, 0, 44, 739 }, - /* 5*/ { "12", 2726 * 2 + 1, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 6*/ { "\351", 2726 / 2, 0, 44, 739 }, - /* 7*/ { "\351", 2726 / 2 + 1, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 0*/ { -1, -1, "A", 2666, 0, 44, 728 }, + /* 1*/ { -1, -1, "A", 2725, 0, 44, 739 }, + /* 2*/ { -1, -1, "A", 2726, 0, 44, 739 }, // 4.2.1 c.3 says max 2725 but actually 44 * 62 - 2 == 2726 as mentioned later in 4.8.1 + /* 3*/ { -1, -1, "A", 2727, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 4*/ { -1, -1, "A", ZINT_MAX_DATA_LEN, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 5*/ { -1, -1, "12", 2726 * 2, 0, 44, 739 }, + /* 6*/ { -1, -1, "12", 2726 * 2 + 1, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 7*/ { -1, -1, "\351", 2726 / 2, 0, 44, 739 }, + /* 8*/ { -1, -1, "\351", 2726 / 2 + 1, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 9*/ { 1, -1, "A", 60, 0, 1, 695 }, // CODE128 60 max + /* 10*/ { 1, -1, "A", 61, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 11*/ { 2, -1, "A", 122, 0, 2, 739 }, + /* 12*/ { 2, 10, "A", 122, 0, 2, 739 }, // Cols 10 -> 67 + /* 13*/ { 2, 67, "A", 122, 0, 2, 739 }, + /* 14*/ { 2, -1, "A", 123, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 15*/ { 2, -1, "A", 63 * 2, ZINT_ERROR_TOO_LONG, -1, -1 }, // Triggers initial testColumns > 62 + /* 16*/ { 2, -1, "A", 2726 * 2 + 1, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 17*/ { 2, 9, "A", 2726 * 2 + 1, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 18*/ { 3, -1, "A", 184, 0, 3, 739 }, + /* 19*/ { 3, -1, "A", 185, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 20*/ { 10, -1, "A", 618, 0, 10, 739 }, + /* 21*/ { 10, -1, "A", 619, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 22*/ { 20, -1, "A", 1238, 0, 20, 739 }, + /* 23*/ { 20, -1, "A", 1239, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 24*/ { 30, -1, "A", 1858, 0, 30, 739 }, + /* 25*/ { 30, -1, "A", 1859, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 26*/ { 40, -1, "A", 2478, 0, 40, 739 }, + /* 27*/ { 40, -1, "A", 2479, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 28*/ { 43, -1, "A", 2664, 0, 43, 739 }, + /* 29*/ { 43, -1, "A", 2665, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 30*/ { 44, -1, "A", 2726, 0, 44, 739 }, + /* 31*/ { 44, -1, "A", 2727, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 32*/ { 44, 60, "A", 2726, 0, 44, 739 }, // Cols 60 -> 67 + /* 33*/ { 44, 67, "A", 2726, 0, 44, 739 }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol; - char data_buf[2726 * 2 + 2]; + char data_buf[ZINT_MAX_DATA_LEN + 2]; testStart("test_large"); @@ -70,7 +98,7 @@ static void test_large(int index, int debug) { testUtilStrCpyRepeat(data_buf, data[i].pattern, data[i].length); assert_equal(data[i].length, (int) strlen(data_buf), "i:%d length %d != strlen(data_buf) %d\n", i, data[i].length, (int) strlen(data_buf)); - length = testUtilSetSymbol(symbol, BARCODE_CODABLOCKF, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data_buf, data[i].length, debug); + length = testUtilSetSymbol(symbol, BARCODE_CODABLOCKF, -1 /*input_mode*/, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data_buf, data[i].length, debug); ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); @@ -169,7 +197,8 @@ static void test_reader_init(int index, int generate, int debug) { }; struct item data[] = { /* 0*/ { BARCODE_CODABLOCKF, UNICODE_MODE, READER_INIT, "1234", 0, 2, 101, "67 64 40 60 63 0C 22 2B 6A 67 64 0B 63 64 3A 1C 29 6A", "CodeB FNC3 CodeC 12 34 / CodeB Pads" }, - /* 1*/ { BARCODE_HIBC_BLOCKF, UNICODE_MODE, READER_INIT, "123456", 0, 3, 101, "67 64 41 60 0B 11 12 22 6A 67 63 2B 22 38 64 2A 1B 6A 67 64 0C 63 64 2B 2F 52 6A", "CodeB FNC3 + 1 2 / CodeC 34 56 CodeB J" }, + /* 1*/ { BARCODE_CODABLOCKF, UNICODE_MODE, READER_INIT, "\001\002", 0, 2, 101, "67 62 40 60 41 42 63 32 6A 67 64 0B 63 64 45 42 0F 6A", "FNC3 SOH STX / CodeB Pads" }, + /* 2*/ { BARCODE_HIBC_BLOCKF, UNICODE_MODE, READER_INIT, "123456", 0, 3, 101, "67 64 41 60 0B 11 12 22 6A 67 63 2B 22 38 64 2A 1B 6A 67 64 0C 63 64 2B 2F 52 6A", "CodeB FNC3 + 1 2 / CodeC 34 56 CodeB J" }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -277,7 +306,8 @@ static void test_input(int index, int generate, int debug) { /* 34*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, "\000a\037\177}12", 7, 0, 3, 101, "67 62 41 40 62 41 5F 3B 6A 67 64 0B 5F 5D 11 12 2D 6A 67 64 0C 63 64 40 05 26 6A", "" }, /* 35*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, "abcdéf", -1, 0, 3, 101, "67 64 41 41 42 43 44 5D 6A 67 64 0B 64 49 46 63 0A 6A 67 64 0C 63 64 4F 26 02 6A", "" }, /* 36*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, "a12é\000", 6, 0, 3, 101, "67 64 41 41 11 12 63 2C 6A 67 64 0B 64 49 62 40 2B 6A 67 64 0C 63 64 33 34 31 6A", "" }, - /* 37*/ { BARCODE_HIBC_BLOCKF, UNICODE_MODE, -1, "A99912345/$$52001510X3", -1, 0, 6, 101, "(54) 67 64 44 0B 21 19 19 3A 6A 67 63 2B 5B 17 2D 64 24 6A 67 64 0C 0F 04 04 15 16 6A 67", "" }, + /* 37*/ { BARCODE_CODABLOCKF, UNICODE_MODE, 11, "1234\001", -1, 0, 2, 123, "67 63 00 0C 22 65 41 63 64 54 6A 67 64 0B 63 64 63 64 3F 20 24 6A", "" }, + /* 38*/ { BARCODE_HIBC_BLOCKF, UNICODE_MODE, -1, "A99912345/$$52001510X3", -1, 0, 6, 101, "(54) 67 64 44 0B 21 19 19 3A 6A 67 63 2B 5B 17 2D 64 24 6A 67 64 0C 0F 04 04 15 16 6A 67", "" }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; diff --git a/backend/tests/test_code16k.c b/backend/tests/test_code16k.c index d09af678..a787e17e 100644 --- a/backend/tests/test_code16k.c +++ b/backend/tests/test_code16k.c @@ -168,20 +168,22 @@ static void test_input(int index, int generate, int debug) { /* 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 | GS1PARENS_MODE, "(90)12", -1, 0, 2, 70, "(10) 4 90 12 103 103 103 103 103 79 62", "ModeCFNC1 90 12 Pad (5)" }, - /* 8*/ { 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" }, - /* 9*/ { 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" }, - /* 10*/ { 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" }, - /* 11*/ { 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)" }, - /* 12*/ { 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)" }, - /* 13*/ { 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" }, - /* 14*/ { UNICODE_MODE, "abß", -1, 0, 2, 70, "(10) 1 65 66 100 63 103 103 103 66 56", "ModeB a b FNC4 ß Pad (3)" }, - /* 15*/ { 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)" }, - /* 16*/ { 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" }, - /* 17*/ { UNICODE_MODE, "ééé", -1, 0, 2, 70, "(10) 1 100 73 100 73 100 73 103 105 106", "ModeB FNC4 é FNC4 é FNC4 é Pad" }, - /* 18*/ { 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)" }, - /* 19*/ { 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" }, - /* 20*/ { 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 é" }, + /* 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 é" }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; diff --git a/backend/tests/test_common.c b/backend/tests/test_common.c index 03de3863..f23ec65f 100644 --- a/backend/tests/test_common.c +++ b/backend/tests/test_common.c @@ -145,10 +145,10 @@ static void test_set_height(int index, int debug) { static void test_is_valid_utf8(int index) { struct item { - char* data; + char *data; int length; int ret; - char* comment; + char *comment; }; // s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<")) struct item data[] = { diff --git a/backend/tests/test_gridmtx.c b/backend/tests/test_gridmtx.c index 0c0356d6..1fb2d914 100644 --- a/backend/tests/test_gridmtx.c +++ b/backend/tests/test_gridmtx.c @@ -45,22 +45,25 @@ static void test_large(int index, int debug) { struct item data[] = { /* 0*/ { -1, "1", 2751, 0, 162, 162 }, /* 1*/ { -1, "1", 2752, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 2*/ { -1, "A", 1836, 0, 162, 162 }, - /* 3*/ { -1, "A", 1837, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 4*/ { -1, "\200", 1143, 0, 162, 162 }, - /* 5*/ { -1, "\200", 1144, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 6*/ { 1, "1", 18, 0, 18, 18 }, - /* 7*/ { 1, "1", 19, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 8*/ { 1, "A", 13, 0, 18, 18 }, - /* 9*/ { 1, "A", 14, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 10*/ { 1, "\200", 7, 0, 18, 18 }, - /* 11*/ { 1, "\200", 8, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 2*/ { -1, "1", 2755, ZINT_ERROR_TOO_LONG, -1, -1 }, // Triggers buffer > 9191 + /* 3*/ { -1, "A", 1836, 0, 162, 162 }, + /* 4*/ { -1, "A", 1837, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 5*/ { -1, "\200", 1143, 0, 162, 162 }, + /* 6*/ { -1, "\200", 1144, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 7*/ { 1, "1", 18, 0, 18, 18 }, + /* 8*/ { 1, "1", 19, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 9*/ { 1, "A", 13, 0, 18, 18 }, + /* 10*/ { 1, "A", 14, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 11*/ { 1, "\200", 7, 0, 18, 18 }, + /* 12*/ { 1, "\200", 8, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 13*/ { 11, "1", 1995, 0, 138, 138 }, + /* 14*/ { 11, "1", 1996, ZINT_ERROR_TOO_LONG, -1, -1 }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol; - char data_buf[2753]; + char data_buf[2755 + 1]; testStart("test_large"); @@ -114,6 +117,8 @@ static void test_options(int index, int debug) { /* 9*/ { "123456789012345678", 5, 1, 0, 0, 18 }, // Version specified so overrides ECC level which gets reduced to 4 /* 10*/ { "123456789012345678", 5, 0, 0, 0, 30 }, // Version not specified so increased to allow for ECC level /* 11*/ { "123456789012345678", 6, 0, 0, 0, 30 }, // ECC > max ECC 5 so ignored and auto-settings version 2, ECC 4 used + /* 12*/ { "123456789012345678", 1, 0, 0, 0, 30 }, // ECC < min ECC 2, ECC 2 used + /* 13*/ { "123456789012345678", 4, 1, 0, 0, 18 }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -151,6 +156,7 @@ static void test_input(int index, int generate, int debug) { struct item { int input_mode; int eci; + int output_options; int option_3; char *data; int ret; @@ -164,95 +170,117 @@ static void test_input(int index, int generate, int debug) { // ㈩ U+3229 in GB 2312 0x226E // 一 U+4E00 in GB 2312 0x523B struct item data[] = { - /* 0*/ { UNICODE_MODE, 0, -1, "é", 0, 0, "30 01 69 00", "B1 (ISO 8859-1)" }, - /* 1*/ { UNICODE_MODE, 3, -1, "é", 0, 3, "60 01 58 00 74 40", "ECI-3 B1 (ISO 8859-1)" }, - /* 2*/ { UNICODE_MODE, 29, -1, "é", 0, 29, "60 0E 44 2A 37 7C 00", "ECI-29 H1 (GB 2312)" }, - /* 3*/ { UNICODE_MODE, 26, -1, "é", 0, 26, "60 0D 18 01 61 6A 20", "ECI-26 B2 (UTF-8)" }, - /* 4*/ { UNICODE_MODE, 26, ZINT_FULL_MULTIBYTE, "é", 0, 26, "60 0D 05 28 4F 7C 00", "ECI-26 H1 (UTF-8) (full multibyte)" }, - /* 5*/ { DATA_MODE, 0, -1, "é", 0, 0, "30 03 43 54 40", "B2 (UTF-8)" }, - /* 6*/ { DATA_MODE, 0, ZINT_FULL_MULTIBYTE, "é", 0, 0, "0A 51 1F 78 00", "H1 (UTF-8) (full multibyte)" }, - /* 7*/ { DATA_MODE, 0, -1, "\351", 0, 0, "30 01 69 00", "B1 (ISO 8859-1) (0xE9)" }, - /* 8*/ { UNICODE_MODE, 0, -1, "β", 0, 0, "08 40 2F 78 00", "H1 (GB 2312)" }, - /* 9*/ { UNICODE_MODE, 9, -1, "β", 0, 9, "60 04 58 00 71 00", "ECI-9 B1 (ISO 8859-7)" }, - /* 10*/ { UNICODE_MODE, 29, -1, "β", 0, 29, "60 0E 44 20 17 7C 00", "ECI-29 H1 (GB 2312)" }, - /* 11*/ { UNICODE_MODE, 26, -1, "β", 0, 26, "60 0D 18 01 67 2C 40", "ECI-26 H1 (UTF-8)" }, - /* 12*/ { UNICODE_MODE, 26, ZINT_FULL_MULTIBYTE, "β", 0, 26, "60 0D 05 6B 17 7C 00", "ECI-26 H1 (UTF-8) (full multibyte)" }, - /* 13*/ { DATA_MODE, 0, -1, "β", 0, 0, "30 03 4E 59 00", "B2 (UTF-8)" }, - /* 14*/ { DATA_MODE, 0, ZINT_FULL_MULTIBYTE, "β", 0, 0, "0B 56 2F 78 00", "H1 (UTF-8) (full multibyte)" }, - /* 15*/ { UNICODE_MODE, 0, -1, "ÿ", 0, 0, "30 01 7F 00", "B1 (ISO 8859-1)" }, - /* 16*/ { UNICODE_MODE, 0, -1, "ÿÿÿ", 0, 0, "30 05 7F 7F 7F 60", "B3 (ISO 8859-1)" }, - /* 17*/ { UNICODE_MODE, 0, -1, "㈩一", 0, 0, "08 15 68 0E 7F 70 00", "H2 (GB 2312)" }, - /* 18*/ { UNICODE_MODE, 29, -1, "㈩一", 0, 29, "60 0E 44 0A 74 07 3F 78 00", "ECI-29 H2 (GB 2312)" }, - /* 19*/ { DATA_MODE, 0, -1, "\177\177", 0, 0, "30 02 7F 3F 40", "B2 (ASCII)" }, - /* 20*/ { DATA_MODE, 0, -1, "\177\177\177", 0, 0, "30 04 7F 3F 5F 60", "B3 (ASCII)" }, - /* 21*/ { UNICODE_MODE, 0, -1, "123", 0, 0, "10 1E 7F 68", "N3 (ASCII)" }, - /* 22*/ { UNICODE_MODE, 0, -1, " 123", 0, 0, "11 7A 03 6F 7D 00", "N4 (ASCII)" }, - /* 23*/ { UNICODE_MODE, 0, -1, "1+23", 0, 0, "11 7B 03 6F 7D 00", "N4 (ASCII)" }, - /* 24*/ { UNICODE_MODE, 0, -1, "12.3", 0, 0, "11 7C 63 6F 7D 00", "N4 (ASCII)" }, - /* 25*/ { UNICODE_MODE, 0, -1, "123,", 0, 0, "10 1E 7F 73 76 5E 60", "N3 L1 (ASCII)" }, - /* 26*/ { UNICODE_MODE, 0, -1, "123,4", 0, 0, "14 1E 7F 51 48 3F 50", "N5 (ASCII)" }, - /* 27*/ { UNICODE_MODE, 0, -1, "\015\012123", 0, 0, "11 7D 63 6F 7D 00", "N4 (ASCII) (EOL)" }, - /* 28*/ { UNICODE_MODE, 0, -1, "1\015\01223", 0, 0, "11 7E 03 6F 7D 00", "N4 (ASCII) (EOL)" }, - /* 29*/ { UNICODE_MODE, 0, -1, "12\015\0123", 0, 0, "11 7E 23 6F 7D 00", "N4 (ASCII) (EOL)" }, - /* 30*/ { UNICODE_MODE, 0, -1, "123\015\012", 0, 0, "10 1E 7F 7C 01 06 42 40", "N3 B2 (ASCII) (EOL)" }, - /* 31*/ { UNICODE_MODE, 0, -1, "123\015\0124", 0, 0, "14 1E 7F 5D 48 3F 50", "N5 (ASCII) (EOL)" }, - /* 32*/ { UNICODE_MODE, 0, -1, "2.2.0", 0, 0, "15 7C 46 73 78 40 07 7A", "N5 (ASCII)" }, - /* 33*/ { UNICODE_MODE, 0, -1, "2.2.0.5", 0, 0, "30 0C 32 17 0C 45 63 01 38 6A 00", "B7 (ASCII)" }, - /* 34*/ { UNICODE_MODE, 0, -1, "2.2.0.56", 0, 0, "13 7C 46 73 78 40 07 71 46 0F 74", "N8 (ASCII)" }, - /* 35*/ { UNICODE_MODE, 0, -1, "1 1234ABCD12.2abcd-12", 0, 0, "13 7A 23 41 2A 3F 68 01 08 3E 4F 66 1E 5F 70 00 44 1F 2F 6E 0F 0F 74", "N6 U4 N4 L4 N3 (ASCII)" }, - /* 36*/ { UNICODE_MODE, 0, -1, "1 123ABCDE12.2abcd-12", 0, 0, "28 1F 40 42 06 28 59 43 27 01 05 7D 56 42 49 16 34 7F 6D 30 08 2F 60", "M21 (ASCII)" }, - /* 37*/ { UNICODE_MODE, 0, -1, "国外通信教材 Matlab6.5", 0, 0, "09 63 27 20 4E 24 1F 05 21 58 22 13 7E 1E 4C 78 09 56 00 3D 3F 4A 45 3F 50", "H6 U2 L5 N3 (GB 2312) (Same as D.2 example)" }, - /* 38*/ { UNICODE_MODE, 0, -1, "AAT", 0, 0, "20 00 4F 30", "U3 (ASCII)" }, - /* 39*/ { UNICODE_MODE, 0, -1, "aat", 0, 0, "18 00 4F 30", "L3 (ASCII)" }, - /* 40*/ { UNICODE_MODE, 0, -1, "AAT2556", 0, 0, "20 00 4F 58 7F 65 47 7A", "U3 N4 (ASCII) (note same bit count as M7)" }, - /* 41*/ { UNICODE_MODE, 0, -1, "AAT2556 ", 0, 0, "29 22 4E 42 0A 14 37 6F 60", "M8 (ASCII)" }, - /* 42*/ { UNICODE_MODE, 0, -1, "AAT2556 电", 0, 0, "29 22 4E 42 0A 14 37 6F 62 2C 1F 7E 00", "M8 H1 (GB 2312)" }, - /* 43*/ { UNICODE_MODE, 0, -1, " 200", 0, 0, "11 7A 06 23 7D 00", "N4 (ASCII)" }, - /* 44*/ { UNICODE_MODE, 0, -1, " 200mA至", 0, 0, "2F 60 40 00 60 2B 78 63 41 7F 40", "M6 H1 (GB 2312)" }, - /* 45*/ { UNICODE_MODE, 0, -1, "2A tel:86 019 82512738", 0, 0, "28 22 5F 4F 29 48 5F 6D 7E 6F 55 57 1F 28 63 0F 5A 11 64 0F 74", "M2 L5(with control) N15 (ASCII)" }, - /* 46*/ { UNICODE_MODE, 0, -1, "至2A tel:86 019 82512738", 0, 0, "30 07 56 60 4C 48 13 6A 32 17 7B 3F 5B 75 35 67 6A 18 63 76 44 39 03 7D 00", "B4 L5(with control) N15 (GB 2312)" }, - /* 47*/ { UNICODE_MODE, 0, -1, "AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738", 0, 0, "(62) 29 22 22 1C 4E 41 42 7E 0A 40 14 00 37 7E 6F 00 62 7E 2C 00 1C 7E 4B 00 41 7E 18 00", "M8 H11 M6 B4 L5(with control) N15 (GB 2312) (*NOT SAME* as D3 example Figure D.1, M8 H11 M6 H1 M3 L4(with control) N15, which uses a few more bits)" }, - /* 48*/ { UNICODE_MODE, 0, -1, "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::", 0, 0, "(588) 37 68 68 68 68 68 74 7E 74 74 74 74 74 3A 3A 3A 3A 3A 3A 3A 1D 1D 1D 1D 1D 1D 1D 0E", "B512 (ASCII)" }, - /* 49*/ { UNICODE_MODE, 0, -1, "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::\177", 0, 0, "(591) 37 68 68 68 68 68 74 7E 74 74 74 74 74 3A 3A 3A 3A 3A 3A 3A 1D 1D 1D 1D 1D 1D 1D 0E", "B513 (ASCII)" }, - /* 50*/ { UNICODE_MODE, 0, -1, ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::至", 0, 0, "(591) 37 68 68 68 68 68 74 7C 74 74 74 74 74 3A 3A 3A 3A 3A 3A 3A 1D 1D 1D 1D 1D 1D 1D 0E", "B511 H1 (GB 2312)" }, - /* 51*/ { UNICODE_MODE, 0, -1, ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::至:", 0, 0, "(592) 37 68 68 68 68 68 74 7E 74 74 74 74 74 3A 3A 3A 3A 3A 3A 3A 1D 1D 1D 1D 1D 1D 1D 0E", "B513 (GB 2312)" }, - /* 52*/ { UNICODE_MODE, 0, -1, "˘", ZINT_WARN_USES_ECI, 4, "Warning 60 02 18 00 51 00", "ECI-4 B1 (ISO 8859-2)" }, - /* 53*/ { UNICODE_MODE, 4, -1, "˘", 0, 4, "60 02 18 00 51 00", "ECI-4 B1 (ISO 8859-2)" }, - /* 54*/ { UNICODE_MODE, 0, -1, "Ħ", ZINT_WARN_USES_ECI, 5, "Warning 60 02 58 00 50 40", "ECI-5 B1 (ISO 8859-3)" }, - /* 55*/ { UNICODE_MODE, 5, -1, "Ħ", 0, 5, "60 02 58 00 50 40", "ECI-5 B1 (ISO 8859-3)" }, - /* 56*/ { UNICODE_MODE, 6, -1, "ĸ", 0, 6, "60 03 18 00 51 00", "ECI-6 B1 (ISO 8859-4)" }, - /* 57*/ { UNICODE_MODE, 7, -1, "Ж", 0, 7, "60 03 58 00 5B 00", "ECI-7 B1 (ISO 8859-5)" }, - /* 58*/ { UNICODE_MODE, 0, -1, "Ș", ZINT_WARN_USES_ECI, 18, "Warning 60 09 18 00 55 00", "ECI-18 B1 (ISO 8859-16)" }, - /* 59*/ { UNICODE_MODE, 18, -1, "Ș", 0, 18, "60 09 18 00 55 00", "ECI-18 B1 (ISO 8859-16)" }, - /* 60*/ { UNICODE_MODE, 0, -1, "テ", 0, 0, "08 34 6F 78 00", "H1 (GB 2312)" }, - /* 61*/ { UNICODE_MODE, 20, -1, "テ", 0, 20, "60 0A 18 01 41 59 20", "ECI-20 B2 (SHIFT JIS)" }, - /* 62*/ { UNICODE_MODE, 20, -1, "テテ", 0, 20, "60 0A 18 03 41 59 30 36 28 00", "ECI-20 B4 (SHIFT JIS)" }, - /* 63*/ { UNICODE_MODE, 20, -1, "\\\\", 0, 20, "60 0A 18 03 40 57 70 15 78 00", "ECI-20 B4 (SHIFT JIS)" }, - /* 64*/ { UNICODE_MODE, 0, -1, "…", 0, 0, "08 01 5F 78 00", "H1 (GB 2312)" }, - /* 65*/ { UNICODE_MODE, 21, -1, "…", 0, 21, "60 0A 58 00 42 40", "ECI-21 B1 (Win 1250)" }, - /* 66*/ { UNICODE_MODE, 0, -1, "Ґ", ZINT_WARN_USES_ECI, 22, "Warning 60 0B 18 00 52 40", "ECI-22 B1 (Win 1251)" }, - /* 67*/ { UNICODE_MODE, 22, -1, "Ґ", 0, 22, "60 0B 18 00 52 40", "ECI-22 B1 (Win 1251)" }, - /* 68*/ { UNICODE_MODE, 0, -1, "˜", ZINT_WARN_USES_ECI, 23, "Warning 60 0B 58 00 4C 00", "ECI-23 B1 (Win 1252)" }, - /* 69*/ { UNICODE_MODE, 23, -1, "˜", 0, 23, "60 0B 58 00 4C 00", "ECI-23 B1 (Win 1252)" }, - /* 70*/ { UNICODE_MODE, 24, -1, "پ", 0, 24, "60 0C 18 00 40 40", "ECI-24 B1 (Win 1256)" }, - /* 71*/ { UNICODE_MODE, 0, -1, "က", ZINT_WARN_USES_ECI, 26, "Warning 60 0D 18 02 70 60 10 00", "ECI-26 B3 (UTF-8)" }, - /* 72*/ { UNICODE_MODE, 25, -1, "က", 0, 25, "60 0C 58 01 08 00 00", "ECI-25 B2 (UCS-2BE)" }, - /* 73*/ { UNICODE_MODE, 25, -1, "ကက", 0, 25, "60 0C 58 03 08 00 02 00 00 00", "ECI-25 B4 (UCS-2BE)" }, - /* 74*/ { UNICODE_MODE, 25, -1, "12", 0, 25, "60 0C 58 03 00 0C 20 03 10 00", "ECI-25 B4 (UCS-2BE ASCII)" }, - /* 75*/ { UNICODE_MODE, 27, -1, "@", 0, 27, "60 0D 4F 77 2E 60", "ECI-27 L1 (ASCII)" }, - /* 76*/ { UNICODE_MODE, 0, -1, "龘", ZINT_WARN_USES_ECI, 26, "Warning 60 0D 18 02 74 6F 53 00", "ECI-26 B3 (UTF-8)" }, - /* 77*/ { UNICODE_MODE, 28, -1, "龘", 0, 28, "60 0E 18 01 7C 75 20", "ECI-28 B2 (Big5)" }, - /* 78*/ { UNICODE_MODE, 28, -1, "龘龘", 0, 28, "60 0E 18 03 7C 75 3F 1D 28 00", "ECI-28 B4 (Big5)" }, - /* 79*/ { UNICODE_MODE, 0, -1, "齄", 0, 0, "0F 4B 6F 78 00", "H1 (GB 2312)" }, - /* 80*/ { UNICODE_MODE, 29, -1, "齄", 0, 29, "60 0E 47 65 77 7C 00", "ECI-29 H1 (GB 2312)" }, - /* 81*/ { UNICODE_MODE, 29, -1, "齄齄", 0, 29, "60 0E 47 65 77 4B 6F 78 00", "ECI-29 H2 (GB 2312)" }, - /* 82*/ { UNICODE_MODE, 0, -1, "가", ZINT_WARN_USES_ECI, 26, "Warning 60 0D 18 02 75 2C 10 00", "ECI-26 B3 (UTF-8)" }, - /* 83*/ { UNICODE_MODE, 30, -1, "가", 0, 30, "60 0F 18 01 58 28 20", "ECI-30 B2 (EUC-KR)" }, - /* 84*/ { UNICODE_MODE, 30, -1, "가가", 0, 30, "60 0F 18 03 58 28 36 0A 08 00", "ECI-30 B4 (EUC-KR)" }, - /* 85*/ { UNICODE_MODE, 170, -1, "?", 0, 170, "60 55 0F 77 26 60", "ECI-170 L1 (ASCII invariant)" }, - /* 86*/ { DATA_MODE, 899, -1, "\200", 0, 899, "63 41 58 00 40 00", "ECI-899 B1 (8-bit binary)" }, - /* 87*/ { UNICODE_MODE, 900, -1, "é", 0, 900, "63 42 18 01 61 6A 20", "ECI-900 B2 (no conversion)" }, - /* 88*/ { UNICODE_MODE, 3, -1, "β", ZINT_ERROR_INVALID_DATA, 3, "Error 535: Invalid character in input data for ECI 3", "" }, + /* 0*/ { UNICODE_MODE, 0, -1, -1, "é", 0, 0, "30 01 69 00", "B1 (ISO 8859-1)" }, + /* 1*/ { UNICODE_MODE, 3, -1, -1, "é", 0, 3, "60 01 58 00 74 40", "ECI-3 B1 (ISO 8859-1)" }, + /* 2*/ { UNICODE_MODE, 29, -1, -1, "é", 0, 29, "60 0E 44 2A 37 7C 00", "ECI-29 H1 (GB 2312)" }, + /* 3*/ { UNICODE_MODE, 26, -1, -1, "é", 0, 26, "60 0D 18 01 61 6A 20", "ECI-26 B2 (UTF-8)" }, + /* 4*/ { UNICODE_MODE, 26, -1, ZINT_FULL_MULTIBYTE, "é", 0, 26, "60 0D 05 28 4F 7C 00", "ECI-26 H1 (UTF-8) (full multibyte)" }, + /* 5*/ { DATA_MODE, 0, -1, -1, "é", 0, 0, "30 03 43 54 40", "B2 (UTF-8)" }, + /* 6*/ { DATA_MODE, 0, -1, ZINT_FULL_MULTIBYTE, "é", 0, 0, "0A 51 1F 78 00", "H1 (UTF-8) (full multibyte)" }, + /* 7*/ { DATA_MODE, 0, -1, -1, "\351", 0, 0, "30 01 69 00", "B1 (ISO 8859-1) (0xE9)" }, + /* 8*/ { UNICODE_MODE, 0, -1, -1, "β", 0, 0, "08 40 2F 78 00", "H1 (GB 2312)" }, + /* 9*/ { UNICODE_MODE, 9, -1, -1, "β", 0, 9, "60 04 58 00 71 00", "ECI-9 B1 (ISO 8859-7)" }, + /* 10*/ { UNICODE_MODE, 29, -1, -1, "β", 0, 29, "60 0E 44 20 17 7C 00", "ECI-29 H1 (GB 2312)" }, + /* 11*/ { UNICODE_MODE, 26, -1, -1, "β", 0, 26, "60 0D 18 01 67 2C 40", "ECI-26 H1 (UTF-8)" }, + /* 12*/ { UNICODE_MODE, 26, -1, ZINT_FULL_MULTIBYTE, "β", 0, 26, "60 0D 05 6B 17 7C 00", "ECI-26 H1 (UTF-8) (full multibyte)" }, + /* 13*/ { DATA_MODE, 0, -1, -1, "β", 0, 0, "30 03 4E 59 00", "B2 (UTF-8)" }, + /* 14*/ { DATA_MODE, 0, -1, ZINT_FULL_MULTIBYTE, "β", 0, 0, "0B 56 2F 78 00", "H1 (UTF-8) (full multibyte)" }, + /* 15*/ { UNICODE_MODE, 0, -1, -1, "ÿ", 0, 0, "30 01 7F 00", "B1 (ISO 8859-1)" }, + /* 16*/ { UNICODE_MODE, 0, -1, -1, "ÿÿÿ", 0, 0, "30 05 7F 7F 7F 60", "B3 (ISO 8859-1)" }, + /* 17*/ { UNICODE_MODE, 0, -1, -1, "㈩一", 0, 0, "08 15 68 0E 7F 70 00", "H2 (GB 2312)" }, + /* 18*/ { UNICODE_MODE, 29, -1, -1, "㈩一", 0, 29, "60 0E 44 0A 74 07 3F 78 00", "ECI-29 H2 (GB 2312)" }, + /* 19*/ { DATA_MODE, 0, -1, -1, "\177\177", 0, 0, "30 02 7F 3F 40", "B2 (ASCII)" }, + /* 20*/ { DATA_MODE, 0, -1, -1, "\177\177\177", 0, 0, "30 04 7F 3F 5F 60", "B3 (ASCII)" }, + /* 21*/ { UNICODE_MODE, 0, -1, -1, "123", 0, 0, "10 1E 7F 68", "N3 (ASCII)" }, + /* 22*/ { UNICODE_MODE, 0, -1, -1, " 123", 0, 0, "11 7A 03 6F 7D 00", "N4 (ASCII)" }, + /* 23*/ { UNICODE_MODE, 0, -1, -1, "1+23", 0, 0, "11 7B 03 6F 7D 00", "N4 (ASCII)" }, + /* 24*/ { UNICODE_MODE, 0, -1, -1, "12.3", 0, 0, "11 7C 63 6F 7D 00", "N4 (ASCII)" }, + /* 25*/ { UNICODE_MODE, 0, -1, -1, "123,", 0, 0, "10 1E 7F 73 76 5E 60", "N3 L1 (ASCII)" }, + /* 26*/ { UNICODE_MODE, 0, -1, -1, "123,4", 0, 0, "14 1E 7F 51 48 3F 50", "N5 (ASCII)" }, + /* 27*/ { UNICODE_MODE, 0, -1, -1, "\015\012123", 0, 0, "11 7D 63 6F 7D 00", "N4 (ASCII) (EOL)" }, + /* 28*/ { UNICODE_MODE, 0, -1, -1, "1\015\01223", 0, 0, "11 7E 03 6F 7D 00", "N4 (ASCII) (EOL)" }, + /* 29*/ { UNICODE_MODE, 0, -1, -1, "12\015\0123", 0, 0, "11 7E 23 6F 7D 00", "N4 (ASCII) (EOL)" }, + /* 30*/ { UNICODE_MODE, 0, -1, -1, "123\015\012", 0, 0, "10 1E 7F 7C 01 06 42 40", "N3 B2 (ASCII) (EOL)" }, + /* 31*/ { UNICODE_MODE, 0, -1, -1, "123\015\0124", 0, 0, "14 1E 7F 5D 48 3F 50", "N5 (ASCII) (EOL)" }, + /* 32*/ { UNICODE_MODE, 0, -1, -1, "2.2.0", 0, 0, "15 7C 46 73 78 40 07 7A", "N5 (ASCII)" }, + /* 33*/ { UNICODE_MODE, 0, -1, -1, "2.2.0.5", 0, 0, "30 0C 32 17 0C 45 63 01 38 6A 00", "B7 (ASCII)" }, + /* 34*/ { UNICODE_MODE, 0, -1, -1, "2.2.0.56", 0, 0, "13 7C 46 73 78 40 07 71 46 0F 74", "N8 (ASCII)" }, + /* 35*/ { UNICODE_MODE, 0, -1, -1, "20.12.13.\015\012", 0, 0, "11 7C 66 27 79 0D 2F 7F 00 45 60 68 28 00", "N8 B3 (ASCII)" }, + /* 36*/ { UNICODE_MODE, 0, -1, -1, "ABCDE\011F", 0, 0, "20 01 08 32 3E 49 17 30", "U7 (ASCII)" }, + /* 37*/ { UNICODE_MODE, 0, -1, -1, "1 1234ABCD12.2abcd-12", 0, 0, "13 7A 23 41 2A 3F 68 01 08 3E 4F 66 1E 5F 70 00 44 1F 2F 6E 0F 0F 74", "N6 U4 N4 L4 N3 (ASCII)" }, + /* 38*/ { UNICODE_MODE, 0, -1, -1, "1 123ABCDE12.2abcd-12", 0, 0, "28 1F 40 42 06 28 59 43 27 01 05 7D 56 42 49 16 34 7F 6D 30 08 2F 60", "M21 (ASCII)" }, + /* 39*/ { UNICODE_MODE, 0, -1, -1, "国外通信教材 Matlab6.5", 0, 0, "09 63 27 20 4E 24 1F 05 21 58 22 13 7E 1E 4C 78 09 56 00 3D 3F 4A 45 3F 50", "H6 U2 L5 N3 (GB 2312) (Same as D.2 example)" }, + /* 40*/ { UNICODE_MODE, 0, -1, -1, "AAT", 0, 0, "20 00 4F 30", "U3 (ASCII)" }, + /* 41*/ { UNICODE_MODE, 0, -1, -1, "aat", 0, 0, "18 00 4F 30", "L3 (ASCII)" }, + /* 42*/ { UNICODE_MODE, 0, -1, -1, "AAT2556", 0, 0, "20 00 4F 58 7F 65 47 7A", "U3 N4 (ASCII) (note same bit count as M7)" }, + /* 43*/ { UNICODE_MODE, 0, -1, -1, "AAT2556 ", 0, 0, "29 22 4E 42 0A 14 37 6F 60", "M8 (ASCII)" }, + /* 44*/ { UNICODE_MODE, 0, -1, -1, "AAT2556 电", 0, 0, "29 22 4E 42 0A 14 37 6F 62 2C 1F 7E 00", "M8 H1 (GB 2312)" }, + /* 45*/ { UNICODE_MODE, 0, -1, -1, " 200", 0, 0, "11 7A 06 23 7D 00", "N4 (ASCII)" }, + /* 46*/ { UNICODE_MODE, 0, -1, -1, " 200mA至", 0, 0, "2F 60 40 00 60 2B 78 63 41 7F 40", "M6 H1 (GB 2312)" }, + /* 47*/ { UNICODE_MODE, 0, -1, -1, "2A tel:86 019 82512738", 0, 0, "28 22 5F 4F 29 48 5F 6D 7E 6F 55 57 1F 28 63 0F 5A 11 64 0F 74", "M2 L5(with control) N15 (ASCII)" }, + /* 48*/ { UNICODE_MODE, 0, -1, -1, "至2A tel:86 019 82512738", 0, 0, "30 07 56 60 4C 48 13 6A 32 17 7B 3F 5B 75 35 67 6A 18 63 76 44 39 03 7D 00", "B4 L5(with control) N15 (GB 2312)" }, + /* 49*/ { UNICODE_MODE, 0, -1, -1, "AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738", 0, 0, "(62) 29 22 22 1C 4E 41 42 7E 0A 40 14 00 37 7E 6F 00 62 7E 2C 00 1C 7E 4B 00 41 7E 18 00", "M8 H11 M6 B4 L5(with control) N15 (GB 2312) (*NOT SAME* as D3 example Figure D.1, M8 H11 M6 H1 M3 L4(with control) N15, which uses a few more bits)" }, + /* 50*/ { UNICODE_MODE, 0, -1, -1, "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::", 0, 0, "(588) 37 68 68 68 68 68 74 7E 74 74 74 74 74 3A 3A 3A 3A 3A 3A 3A 1D 1D 1D 1D 1D 1D 1D 0E", "B512 (ASCII)" }, + /* 51*/ { UNICODE_MODE, 0, -1, -1, "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::\177", 0, 0, "(591) 37 68 68 68 68 68 74 7E 74 74 74 74 74 3A 3A 3A 3A 3A 3A 3A 1D 1D 1D 1D 1D 1D 1D 0E", "B513 (ASCII)" }, + /* 52*/ { UNICODE_MODE, 0, -1, -1, ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::至", 0, 0, "(591) 37 68 68 68 68 68 74 7C 74 74 74 74 74 3A 3A 3A 3A 3A 3A 3A 1D 1D 1D 1D 1D 1D 1D 0E", "B511 H1 (GB 2312)" }, + /* 53*/ { UNICODE_MODE, 0, -1, -1, ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::至:", 0, 0, "(592) 37 68 68 68 68 68 74 7E 74 74 74 74 74 3A 3A 3A 3A 3A 3A 3A 1D 1D 1D 1D 1D 1D 1D 0E", "B513 (GB 2312)" }, + /* 54*/ { UNICODE_MODE, 0, -1, -1, "电电123456", 0, 0, "09 30 72 61 7F 70 41 76 72 1F 68", "H2 (GB 2312) N6" }, + /* 55*/ { UNICODE_MODE, 0, -1, -1, "电电abcdef", 0, 0, "09 30 72 61 7F 71 00 08 43 10 5D 40", "H2 (GB 2312) L6" }, + /* 56*/ { UNICODE_MODE, 0, -1, -1, "电电电电电\011\011\011", 0, 0, "09 30 72 61 65 43 4B 07 16 0F 7F 14 02 04 42 21 10", "H5 (GB 2312) B3" }, + /* 57*/ { UNICODE_MODE, 0, -1, -1, "1234567电电", 0, 0, "14 1E 6E 22 5E 3F 59 30 72 61 7F 70 00", "N7 H2 (GB 2312)" }, + /* 58*/ { UNICODE_MODE, 0, -1, -1, "12345678mA 2", 0, 0, "12 1E 6E 23 06 3F 76 02 5F 02 7E 00", "N8 M4" }, + /* 59*/ { UNICODE_MODE, 0, -1, -1, "ABCDEFG电电", 0, 0, "20 01 08 32 0A 37 05 43 4B 07 7F 40", "U7 H2 (GB 2312)" }, + /* 60*/ { UNICODE_MODE, 0, -1, -1, "ABCDEFGHIJ8mA 2", 0, 0, "20 01 08 32 0A 31 68 27 70 46 02 5F 02 7E 00", "U10 M5" }, + /* 61*/ { UNICODE_MODE, 0, -1, -1, "ABCDEFGHIJ\011\011\011\011", 0, 0, "20 01 08 32 0A 31 68 27 78 03 04 42 21 10 48 00", "U10 B4" }, + /* 62*/ { UNICODE_MODE, 0, -1, -1, "8mA B123456789", 0, 0, "29 0C 05 3E 17 7C 40 7B 39 0C 2B 7E 40", "M5 N9" }, + /* 63*/ { UNICODE_MODE, 0, -1, -1, "8mA aABCDEFGH", 0, 0, "29 0C 05 3E 49 7D 00 04 21 48 29 47 6C", "M5 U8" }, + /* 64*/ { UNICODE_MODE, 0, -1, -1, "\011\011\011\011123456", 0, 0, "30 06 09 04 42 21 12 03 6D 64 3F 50", "B4 N6" }, + /* 65*/ { UNICODE_MODE, 0, -1, -1, "\011\011\011\011ABCDEF", 0, 0, "30 06 09 04 42 21 14 00 11 06 21 3B", "B4 U6" }, + /* 66*/ { UNICODE_MODE, 0, -1, -1, "\011\011\011\0118mA 2", 0, 0, "30 06 09 04 42 21 15 11 40 57 60 5F 40", "B4 M5" }, + /* 67*/ { UNICODE_MODE, 0, -1, -1, "电电电电电\015\012", 0, 0, "09 30 72 61 65 43 4B 07 16 0F 73 03 7E 00", "H7 (GB 2312)" }, + /* 68*/ { UNICODE_MODE, 0, -1, -1, "电电电电电12", 0, 0, "09 30 72 61 65 43 4B 07 16 0F 7B 37 7E 00", "H7 (GB 2312)" }, + /* 69*/ { UNICODE_MODE, 0, -1, -1, "1234567.8\015\012123456", 0, 0, "10 1E 6E 23 79 30 67 77 0F 37 11 7E 40", "N17" }, + /* 70*/ { UNICODE_MODE, 0, -1, -1, "˘", ZINT_WARN_USES_ECI, 4, "Warning 60 02 18 00 51 00", "ECI-4 B1 (ISO 8859-2)" }, + /* 71*/ { UNICODE_MODE, 4, -1, -1, "˘", 0, 4, "60 02 18 00 51 00", "ECI-4 B1 (ISO 8859-2)" }, + /* 72*/ { UNICODE_MODE, 0, -1, -1, "Ħ", ZINT_WARN_USES_ECI, 5, "Warning 60 02 58 00 50 40", "ECI-5 B1 (ISO 8859-3)" }, + /* 73*/ { UNICODE_MODE, 5, -1, -1, "Ħ", 0, 5, "60 02 58 00 50 40", "ECI-5 B1 (ISO 8859-3)" }, + /* 74*/ { UNICODE_MODE, 6, -1, -1, "ĸ", 0, 6, "60 03 18 00 51 00", "ECI-6 B1 (ISO 8859-4)" }, + /* 75*/ { UNICODE_MODE, 7, -1, -1, "Ж", 0, 7, "60 03 58 00 5B 00", "ECI-7 B1 (ISO 8859-5)" }, + /* 76*/ { UNICODE_MODE, 0, -1, -1, "Ș", ZINT_WARN_USES_ECI, 18, "Warning 60 09 18 00 55 00", "ECI-18 B1 (ISO 8859-16)" }, + /* 77*/ { UNICODE_MODE, 18, -1, -1, "Ș", 0, 18, "60 09 18 00 55 00", "ECI-18 B1 (ISO 8859-16)" }, + /* 78*/ { UNICODE_MODE, 0, -1, -1, "テ", 0, 0, "08 34 6F 78 00", "H1 (GB 2312)" }, + /* 79*/ { UNICODE_MODE, 20, -1, -1, "テ", 0, 20, "60 0A 18 01 41 59 20", "ECI-20 B2 (SHIFT JIS)" }, + /* 80*/ { UNICODE_MODE, 20, -1, -1, "テテ", 0, 20, "60 0A 18 03 41 59 30 36 28 00", "ECI-20 B4 (SHIFT JIS)" }, + /* 81*/ { UNICODE_MODE, 20, -1, -1, "\\\\", 0, 20, "60 0A 18 03 40 57 70 15 78 00", "ECI-20 B4 (SHIFT JIS)" }, + /* 82*/ { UNICODE_MODE, 0, -1, -1, "…", 0, 0, "08 01 5F 78 00", "H1 (GB 2312)" }, + /* 83*/ { UNICODE_MODE, 21, -1, -1, "…", 0, 21, "60 0A 58 00 42 40", "ECI-21 B1 (Win 1250)" }, + /* 84*/ { UNICODE_MODE, 0, -1, -1, "Ґ", ZINT_WARN_USES_ECI, 22, "Warning 60 0B 18 00 52 40", "ECI-22 B1 (Win 1251)" }, + /* 85*/ { UNICODE_MODE, 22, -1, -1, "Ґ", 0, 22, "60 0B 18 00 52 40", "ECI-22 B1 (Win 1251)" }, + /* 86*/ { UNICODE_MODE, 0, -1, -1, "˜", ZINT_WARN_USES_ECI, 23, "Warning 60 0B 58 00 4C 00", "ECI-23 B1 (Win 1252)" }, + /* 87*/ { UNICODE_MODE, 23, -1, -1, "˜", 0, 23, "60 0B 58 00 4C 00", "ECI-23 B1 (Win 1252)" }, + /* 88*/ { UNICODE_MODE, 24, -1, -1, "پ", 0, 24, "60 0C 18 00 40 40", "ECI-24 B1 (Win 1256)" }, + /* 89*/ { UNICODE_MODE, 0, -1, -1, "က", ZINT_WARN_USES_ECI, 26, "Warning 60 0D 18 02 70 60 10 00", "ECI-26 B3 (UTF-8)" }, + /* 90*/ { UNICODE_MODE, 25, -1, -1, "က", 0, 25, "60 0C 58 01 08 00 00", "ECI-25 B2 (UCS-2BE)" }, + /* 91*/ { UNICODE_MODE, 25, -1, -1, "ကက", 0, 25, "60 0C 58 03 08 00 02 00 00 00", "ECI-25 B4 (UCS-2BE)" }, + /* 92*/ { UNICODE_MODE, 25, -1, -1, "12", 0, 25, "60 0C 58 03 00 0C 20 03 10 00", "ECI-25 B4 (UCS-2BE ASCII)" }, + /* 93*/ { UNICODE_MODE, 27, -1, -1, "@", 0, 27, "60 0D 4F 77 2E 60", "ECI-27 L1 (ASCII)" }, + /* 94*/ { UNICODE_MODE, 0, -1, -1, "龘", ZINT_WARN_USES_ECI, 26, "Warning 60 0D 18 02 74 6F 53 00", "ECI-26 B3 (UTF-8)" }, + /* 95*/ { UNICODE_MODE, 28, -1, -1, "龘", 0, 28, "60 0E 18 01 7C 75 20", "ECI-28 B2 (Big5)" }, + /* 96*/ { UNICODE_MODE, 28, -1, -1, "龘龘", 0, 28, "60 0E 18 03 7C 75 3F 1D 28 00", "ECI-28 B4 (Big5)" }, + /* 97*/ { UNICODE_MODE, 0, -1, -1, "齄", 0, 0, "0F 4B 6F 78 00", "H1 (GB 2312)" }, + /* 98*/ { UNICODE_MODE, 29, -1, -1, "齄", 0, 29, "60 0E 47 65 77 7C 00", "ECI-29 H1 (GB 2312)" }, + /* 99*/ { UNICODE_MODE, 29, -1, -1, "齄齄", 0, 29, "60 0E 47 65 77 4B 6F 78 00", "ECI-29 H2 (GB 2312)" }, + /*100*/ { UNICODE_MODE, 0, -1, -1, "가", ZINT_WARN_USES_ECI, 26, "Warning 60 0D 18 02 75 2C 10 00", "ECI-26 B3 (UTF-8)" }, + /*101*/ { UNICODE_MODE, 30, -1, -1, "가", 0, 30, "60 0F 18 01 58 28 20", "ECI-30 B2 (EUC-KR)" }, + /*102*/ { UNICODE_MODE, 30, -1, -1, "가가", 0, 30, "60 0F 18 03 58 28 36 0A 08 00", "ECI-30 B4 (EUC-KR)" }, + /*103*/ { UNICODE_MODE, 170, -1, -1, "?", 0, 170, "60 55 0F 77 26 60", "ECI-170 L1 (ASCII invariant)" }, + /*104*/ { DATA_MODE, 899, -1, -1, "\200", 0, 899, "63 41 58 00 40 00", "ECI-899 B1 (8-bit binary)" }, + /*105*/ { UNICODE_MODE, 900, -1, -1, "é", 0, 900, "63 42 18 01 61 6A 20", "ECI-900 B2 (no conversion)" }, + /*106*/ { UNICODE_MODE, 1024, -1, -1, "é", 0, 1024, "64 08 00 30 03 43 54 40", "ECI-1024 B2 (no conversion)" }, + /*107*/ { UNICODE_MODE, 32768, -1, -1, "é", 0, 32768, "66 08 00 01 40 0E 0E 52 00", "ECI-32768 B2 (no conversion)" }, + /*108*/ { UNICODE_MODE, 811800, -1, -1, "é", ZINT_ERROR_INVALID_OPTION, 811800, "Error 533: Invalid ECI", "" }, + /*109*/ { UNICODE_MODE, 3, -1, -1, "β", ZINT_ERROR_INVALID_DATA, 3, "Error 535: Invalid character in input data for ECI 3", "" }, + /*110*/ { UNICODE_MODE, 0, READER_INIT, -1, "12", 0, 0, "51 11 71 7E 40", "" }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -271,14 +299,14 @@ static void test_input(int index, int generate, int debug) { debug |= ZINT_DEBUG_TEST; // Needed to get codeword dump in errtxt - length = testUtilSetSymbol(symbol, BARCODE_GRIDMATRIX, data[i].input_mode, data[i].eci, -1 /*option_1*/, -1, data[i].option_3, -1 /*output_options*/, data[i].data, -1, debug); + length = testUtilSetSymbol(symbol, BARCODE_GRIDMATRIX, data[i].input_mode, data[i].eci, -1 /*option_1*/, -1, data[i].option_3, data[i].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\n", i, ret, data[i].ret); if (generate) { - printf(" /*%3d*/ { %s, %d, %s, \"%s\", %s, %d, \"%s\", \"%s\" },\n", - i, testUtilInputModeName(data[i].input_mode), data[i].eci, testUtilOption3Name(data[i].option_3), + printf(" /*%3d*/ { %s, %d, %s, %s, \"%s\", %s, %d, \"%s\", \"%s\" },\n", + i, testUtilInputModeName(data[i].input_mode), data[i].eci, testUtilOutputOptionsName(data[i].output_options), testUtilOption3Name(data[i].option_3), testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), testUtilErrorName(data[i].ret), ret < ZINT_ERROR ? symbol->eci : -1, symbol->errtxt, data[i].comment); } else { @@ -432,14 +460,12 @@ static void test_encode(int index, int generate, int debug) { printf(" },\n"); } else { if (ret < ZINT_ERROR) { + int width, row; 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); - } + 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); } } diff --git a/backend/tests/test_hanxin.c b/backend/tests/test_hanxin.c index 72f69c17..571addb5 100644 --- a/backend/tests/test_hanxin.c +++ b/backend/tests/test_hanxin.c @@ -255,7 +255,8 @@ static void test_input(int index, int generate, int debug) { /* 76*/ { UNICODE_MODE, 170, -1, "?", -1, 0, 170, "88 0A A2 FB 1F C0 00 00 00", "ECI-170 L1 (ASCII invariant)" }, /* 77*/ { DATA_MODE, 899, -1, "\200", -1, 0, 899, "88 38 33 00 0C 00 00 00 00", "ECI-899 B1 (8-bit binary)" }, /* 78*/ { UNICODE_MODE, 900, -1, "é", -1, 0, 900, "88 38 43 00 16 1D 48 00 00", "ECI-900 B2 (no conversion)" }, - /* 79*/ { UNICODE_MODE, 3, -1, "β", -1, ZINT_ERROR_INVALID_DATA, 3, "Error 545: Invalid character in input data for ECI 3", "" }, + /* 79*/ { UNICODE_MODE, 16384, -1, "é", -1, 0, 16384, "8C 04 00 03 00 16 1D 48 00", "ECI-16384 B2 (no conversion)" }, + /* 80*/ { UNICODE_MODE, 3, -1, "β", -1, ZINT_ERROR_INVALID_DATA, 3, "Error 545: Invalid character in input data for ECI 3", "" }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -1490,14 +1491,12 @@ static void test_encode(int index, int generate, int debug) { printf(" },\n"); } else { if (ret < ZINT_ERROR) { + int width, row; 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); - } + 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); } } diff --git a/backend/tests/test_library.c b/backend/tests/test_library.c index 5d187580..f5891c19 100644 --- a/backend/tests/test_library.c +++ b/backend/tests/test_library.c @@ -704,9 +704,9 @@ static void test_error_tag(int index) { struct item { int error_number; int warn_level; - char* data; + char *data; int ret; - char* expected; + char *expected; }; // s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<")) struct item data[] = { diff --git a/backend/tests/test_mailmark.c b/backend/tests/test_mailmark.c index ec949991..a4c01677 100644 --- a/backend/tests/test_mailmark.c +++ b/backend/tests/test_mailmark.c @@ -95,6 +95,7 @@ static void test_input(int index, int debug) { /* 51*/ { "01000000000000000C12JQ3U A", ZINT_ERROR_INVALID_DATA, -1, -1 }, // F N N L L N L S S bad 2nd S /* 52*/ { "01000000000000000C123JQ4U ", 0, 3, 155, }, // F N N N L L N L S /* 53*/ { "01000000000000000C 23JQ4U ", ZINT_ERROR_INVALID_DATA, -1, -1 }, // F N N N L L N L S bad 1st N (non-alpha otherwise matches 2nd pattern) + /* 54*/ { "41038422416563762XY1", ZINT_ERROR_INVALID_DATA, -1, -1 }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; diff --git a/backend/tests/test_maxicode.c b/backend/tests/test_maxicode.c index 32f259a6..5096b9fa 100644 --- a/backend/tests/test_maxicode.c +++ b/backend/tests/test_maxicode.c @@ -38,7 +38,7 @@ static void test_large(int index, int debug) { int option_2; char *pattern; int length; - char* primary; + char *primary; int ret; int expected_rows; int expected_width; @@ -225,7 +225,7 @@ static void test_encode(int index, int generate, int debug) { int option_2; char *data; int length; - char* primary; + char *primary; int ret; int expected_rows; diff --git a/backend/tests/test_plessey.c b/backend/tests/test_plessey.c index b48991d7..264e49e4 100644 --- a/backend/tests/test_plessey.c +++ b/backend/tests/test_plessey.c @@ -180,8 +180,10 @@ static void test_input(int index, int debug) { struct item data[] = { /* 0*/ { BARCODE_MSI_PLESSEY, -1, "1", 0, 1, 19 }, /* 1*/ { BARCODE_MSI_PLESSEY, -1, "A", ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 2*/ { BARCODE_PLESSEY, -1, "A", 0, 1, 83 }, - /* 3*/ { BARCODE_PLESSEY, -1, "G", ZINT_ERROR_INVALID_DATA, -1, -1 }, + /* 2*/ { BARCODE_MSI_PLESSEY, -2, "1", 0, 1, 19 }, // < 0 ignored + /* 3*/ { BARCODE_MSI_PLESSEY, 7, "1", 0, 1, 19 }, // > 6 ignored + /* 4*/ { BARCODE_PLESSEY, -1, "A", 0, 1, 83 }, + /* 5*/ { BARCODE_PLESSEY, -1, "G", ZINT_ERROR_INVALID_DATA, -1, -1 }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; diff --git a/backend/tests/test_ps.c b/backend/tests/test_ps.c index fd8992e8..0b3a788a 100644 --- a/backend/tests/test_ps.c +++ b/backend/tests/test_ps.c @@ -87,6 +87,7 @@ static void test_print(int index, int generate, int debug) { /* 32*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, -1, 5, 1.7, "", "", 0, "12", "dotcode_5.0_ds1.7.eps" }, /* 33*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, -1, 0, 0, "FF0000", "0000FF00", 0, "12", "dotcode_no_bg.eps" }, /* 34*/ { BARCODE_MAXICODE, -1, -1, CMYK_COLOUR, -1, -1, -1, -1, 0, 0, "", "", 270, "12", "maxicode_rotate_270_cmyk.eps" }, + /* 35*/ { BARCODE_MAXICODE, -1, -1, -1, 3, -1, -1, -1, 0, 0, "", "0000FF00", 180, "12", "maxicode_no_bg_hwsp3_rotate_180.eps" }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; diff --git a/backend/tests/test_qr.c b/backend/tests/test_qr.c index 91cdfeb8..b2d6c4e7 100644 --- a/backend/tests/test_qr.c +++ b/backend/tests/test_qr.c @@ -76,6 +76,8 @@ static void test_qr_options(int index, int debug) { /* 29*/ { 4, 34, "貫やぐ識禁ぱい再2間変字全ノレ没無8裁花ほゃ過法ひなご札17能つーびれ投覧マ勝動エヨ額界よみ作皇ナヲニ打題ヌルヲ掲布益フが。入35能ト権話しこを断兆モヘ細情おじ名4減エヘイハ側機はょが意見想ハ業独案ユヲウ患職ヲ平美さ毎放どぽたけ家没べお化富べ町大シ情魚ッでれ一冬すぼめり。社ト可化モマ試音ばじご育青康演ぴぎ権型固スで能麩ぜらもほ河都しちほラ収90作の年要とだむ部動ま者断チ第41一1米索焦茂げむしれ。測フ物使だて目月国スリカハ夏検にいへ児72告物ゆは載核ロアメヱ登輸どべゃ催行アフエハ議歌ワ河倫剖だ。記タケウ因載ヒイホヤ禁3輩彦関トえび肝区勝ワリロ成禁ぼよ界白ウヒキレ中島べせぜい各安うしぽリ覧生テ基一でむしゃ中新トヒキソ声碁スしび起田ア信大未ゅもばち。", 0, 0, 153, 0 }, /* 30*/ { 4, -1, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 0, 0, 177, -1 }, // 1852 alphanumerics max for ECC 4 (H) /* 31*/ { 1, -1, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 0, 0, 177, -1 }, // 4296 alphanumerics max for ECC 1 (L) + /* 32*/ { 4, -1, "貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫", 0, -1, 0, -1 }, // 424 Kanji, ECC 4 (Q), version 1 + /* 33*/ { 4, -1, "貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫", ZINT_ERROR_TOO_LONG, -1, 0, -1 }, // 425 Kanji, ECC 4 (Q), version 1 }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -88,7 +90,7 @@ static void test_qr_options(int index, int debug) { for (i = 0; i < data_size; i++) { if (index != -1 && i != index) continue; - if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d\n", i); + if ((debug & ZINT_DEBUG_TEST_PRINT) && !(debug & ZINT_DEBUG_TEST_LESS_NOISY)) printf("i:%d\n", i); symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); @@ -282,7 +284,7 @@ static void test_qr_input(int index, int generate, int debug) { for (i = 0; i < data_size; i++) { if (index != -1 && i != index) continue; - if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d\n", i); + if ((debug & ZINT_DEBUG_TEST_PRINT) && !(debug & ZINT_DEBUG_TEST_LESS_NOISY)) printf("i:%d\n", i); symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); @@ -347,7 +349,7 @@ static void test_qr_gs1(int index, int generate, int debug) { for (i = 0; i < data_size; i++) { if (index != -1 && i != index) continue; - if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d\n", i); + if ((debug & ZINT_DEBUG_TEST_PRINT) && !(debug & ZINT_DEBUG_TEST_LESS_NOISY)) printf("i:%d\n", i); symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); @@ -425,7 +427,7 @@ static void test_qr_optimize(int index, int generate, int debug) { for (i = 0; i < data_size; i++) { if (index != -1 && i != index) continue; - if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d\n", i); + if ((debug & ZINT_DEBUG_TEST_PRINT) && !(debug & ZINT_DEBUG_TEST_LESS_NOISY)) printf("i:%d\n", i); symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); @@ -1271,7 +1273,7 @@ static void test_qr_encode(int index, int generate, int debug) { for (i = 0; i < data_size; i++) { if (index != -1 && i != index) continue; - if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d\n", i); + if ((debug & ZINT_DEBUG_TEST_PRINT) && !(debug & ZINT_DEBUG_TEST_LESS_NOISY)) printf("i:%d\n", i); symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); @@ -1290,14 +1292,12 @@ static void test_qr_encode(int index, int generate, int debug) { printf(" },\n"); } else { if (ret < ZINT_ERROR) { + int width, row; 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); - } + 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); } } @@ -1453,6 +1453,8 @@ static void test_microqr_options(int index, int debug) { /* 47*/ { "ABCDEFGHIJABCDEFGH", 3, 4, ZINT_ERROR_TOO_LONG, -1, 0, -1 }, /* 48*/ { "ABCDEFGHIJABC", 3, 4, 0, 0, 17, -1 }, // 13 alphanumerics, ECC 3 (Q), version 4 /* 49*/ { "123456789012345678901234567890123456", -1, -1, ZINT_ERROR_TOO_LONG, -1, 0, -1 }, // 35 absolute max + /* 50*/ { "貫貫貫貫貫", -1, -1, 0, 0, 17, -1 }, // 5 Kanji max + /* 51*/ { "貫貫貫貫貫貫", -1, -1, ZINT_ERROR_TOO_LONG, -1, 0, -1 }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -1610,26 +1612,36 @@ static void test_microqr_padding(int index, int generate, int debug) { /* 2*/ { "123", -1, 0, "63 D8 00", "M1, bits left 7" }, /* 3*/ { "1234", -1, 0, "83 DA 00", "M1, bits left 3" }, /* 4*/ { "12345", -1, 0, "A3 DA D0", "M1, bits left 0" }, - /* 5*/ { "12345678", 1, 0, "40 F6 E4 4E 00", "M2-L, bits left 8" }, - /* 6*/ { "123456789", 1, 0, "48 F6 E4 62 A0", "M2-L, bits left 5" }, - /* 7*/ { "1234567890", 1, 0, "50 F6 E4 62 A0", "M2-L, bits left 1" }, - /* 8*/ { "12345678", 2, 0, "40 F6 E4 4E", "M2-M, bits left 0" }, - /* 9*/ { "ABCDEF", 1, 0, "E3 9A 8A 54 28", "M2-L, bits left 3" }, - /* 10*/ { "ABCDE", 2, 0, "D3 9A 8A 4E", "M2-M, bits left 0" }, - /* 11*/ { "123456789012345678901", 1, 0, "2A 3D B9 18 A8 18 AC D4 DC 28 00", "M3-L, bits left 7" }, - /* 12*/ { "1234567890123456789012", 1, 0, "2C 3D B9 18 A8 18 AC D4 DC 29 00", "M3-L, bits left 3" }, - /* 13*/ { "12345678901234567890123", 1, 0, "2E 3D B9 18 A8 18 AC D4 DC 29 70", "M3-L, bits left 0" }, - /* 14*/ { "123456789012345678", 2, 0, "24 3D B9 18 A8 18 AC D4 C0", "M3-M, bits left 1" }, - /* 15*/ { "ABCDEFGHIJKLMN", 1, 0, "78 E6 A2 95 0A B8 59 EB 99 7E A0", "M3-L, bits left 1" }, - /* 16*/ { "ABCDEFGHIJK", 2, 0, "6C E6 A2 95 0A B8 59 EA 80", "M3-M, bits left 1" }, - /* 17*/ { "1234567890123456789012345678901234", 1, 0, "11 0F 6E 46 2A 06 2B 35 37 0A 75 46 FB D0 F6 80", "M4-L, bits left 5" }, - /* 18*/ { "12345678901234567890123456789012345", 1, 0, "11 8F 6E 46 2A 06 2B 35 37 0A 75 46 FB D0 F6 B4", "M4-L, bits left 1" }, - /* 19*/ { "123456789012345ABCDEFGHIJK", 1, 0, "07 8F 6E 46 2A 06 2B 25 67 35 14 A8 55 C2 CF 54", "M4-L, bits left 0" }, - /* 20*/ { "123456789012345678901234567890", 2, 0, "0F 0F 6E 46 2A 06 2B 35 37 0A 75 46 FB D0", "M4-M, bits left 3" }, - /* 21*/ { "123456789012345678901", 3, 0, "0A 8F 6E 46 2A 06 2B 35 37 0A", "M4-Q, bits left 1" }, - /* 22*/ { "ABCDEFGHIJKLMNOPQRSTU", 1, 0, "35 39 A8 A5 42 AE 16 7A E6 5F AC 51 95 B4 25 E0", "M4-L, bits left 4" }, - /* 23*/ { "ABCDEFGHIJKLMNOPQR", 2, 0, "32 39 A8 A5 42 AE 16 7A E6 5F AC 51 95 A0", "M4-M, bits left 5" }, - /* 24*/ { "ABCDEFGHIJKLM", 3, 0, "2D 39 A8 A5 42 AE 16 7A E6 56", "M4-Q, bits left 0" }, + /* 5*/ { "123456", 1, 0, "30 F6 E4 00 EC", "M2-L, bits left 15" }, + /* 6*/ { "1234567", 1, 0, "38 F6 E4 38 00", "M2-L, bits left 11" }, + /* 7*/ { "12345678", 1, 0, "40 F6 E4 4E 00", "M2-L, bits left 8" }, + /* 8*/ { "123456789", 1, 0, "48 F6 E4 62 A0", "M2-L, bits left 5" }, + /* 9*/ { "1234567890", 1, 0, "50 F6 E4 62 A0", "M2-L, bits left 1" }, + /* 10*/ { "1234", 2, 0, "20 F6 80 EC", "M2-M, bits left 13" }, + /* 11*/ { "123456", 2, 0, "30 F6 E4 00", "M2-M, bits left 7" }, + /* 12*/ { "1234567", 2, 0, "38 F6 E4 38", "M2-M, bits left 3" }, + /* 13*/ { "12345678", 2, 0, "40 F6 E4 4E", "M2-M, bits left 0" }, + /* 14*/ { "ABCDEF", 1, 0, "E3 9A 8A 54 28", "M2-L, bits left 3" }, + /* 15*/ { "ABCDE", 2, 0, "D3 9A 8A 4E", "M2-M, bits left 0" }, + /* 16*/ { "1234567890123456789", 1, 0, "26 3D B9 18 A8 18 AC D4 D2 00 00", "M3-L, bits left 13" }, + /* 17*/ { "12345678901234567890", 1, 0, "28 3D B9 18 A8 18 AC D4 D6 80 00", "M3-L, bits left 10" }, + /* 18*/ { "123456789012345678901", 1, 0, "2A 3D B9 18 A8 18 AC D4 DC 28 00", "M3-L, bits left 7" }, + /* 19*/ { "1234567890123456789012", 1, 0, "2C 3D B9 18 A8 18 AC D4 DC 29 00", "M3-L, bits left 3" }, + /* 20*/ { "12345678901234567890123", 1, 0, "2E 3D B9 18 A8 18 AC D4 DC 29 70", "M3-L, bits left 0" }, + /* 21*/ { "1234567890", 2, 0, "14 3D B9 18 A8 00 EC 11 00", "M3-M, bits left 27" }, + /* 22*/ { "123456789012345678", 2, 0, "24 3D B9 18 A8 18 AC D4 C0", "M3-M, bits left 1" }, + /* 23*/ { "ABCDEFGHIJKLMN", 1, 0, "78 E6 A2 95 0A B8 59 EB 99 7E A0", "M3-L, bits left 1" }, + /* 24*/ { "ABCDEFGHIJK", 2, 0, "6C E6 A2 95 0A B8 59 EA 80", "M3-M, bits left 1" }, + /* 25*/ { "1234567890123456789012345678", 1, 0, "0E 0F 6E 46 2A 06 2B 35 37 0A 75 46 F0 00 EC 11", "M4-L, bits left 25" }, + /* 26*/ { "123456789012345678901234567890", 1, 0, "0F 0F 6E 46 2A 06 2B 35 37 0A 75 46 FB D0 00 EC", "M4-L, bits left 19" }, + /* 27*/ { "1234567890123456789012345678901234", 1, 0, "11 0F 6E 46 2A 06 2B 35 37 0A 75 46 FB D0 F6 80", "M4-L, bits left 5" }, + /* 28*/ { "12345678901234567890123456789012345", 1, 0, "11 8F 6E 46 2A 06 2B 35 37 0A 75 46 FB D0 F6 B4", "M4-L, bits left 1" }, + /* 29*/ { "123456789012345ABCDEFGHIJK", 1, 0, "07 8F 6E 46 2A 06 2B 25 67 35 14 A8 55 C2 CF 54", "M4-L, bits left 0" }, + /* 30*/ { "123456789012345678901234567890", 2, 0, "0F 0F 6E 46 2A 06 2B 35 37 0A 75 46 FB D0", "M4-M, bits left 3" }, + /* 31*/ { "123456789012345678901", 3, 0, "0A 8F 6E 46 2A 06 2B 35 37 0A", "M4-Q, bits left 1" }, + /* 32*/ { "ABCDEFGHIJKLMNOPQRSTU", 1, 0, "35 39 A8 A5 42 AE 16 7A E6 5F AC 51 95 B4 25 E0", "M4-L, bits left 4" }, + /* 33*/ { "ABCDEFGHIJKLMNOPQR", 2, 0, "32 39 A8 A5 42 AE 16 7A E6 5F AC 51 95 A0", "M4-M, bits left 5" }, + /* 34*/ { "ABCDEFGHIJKLM", 3, 0, "2D 39 A8 A5 42 AE 16 7A E6 56", "M4-Q, bits left 0" }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -1642,6 +1654,7 @@ static void test_microqr_padding(int index, int generate, int debug) { for (i = 0; i < data_size; i++) { if (index != -1 && i != index) continue; + if ((debug & ZINT_DEBUG_TEST_PRINT) && !(debug & ZINT_DEBUG_TEST_LESS_NOISY)) printf("i:%d\n", i); symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); @@ -1749,11 +1762,12 @@ static void test_microqr_encode(int index, int generate, int debug) { int expected_rows; int expected_width; + int bwipp_cmp; char *comment; char *expected; }; struct item data[] = { - /* 0*/ { UNICODE_MODE, 1, -1, -1, "01234567", 0, 13, 13, "ISO 18004 Figure 2 (and I.2) (mask 01)", + /* 0*/ { UNICODE_MODE, 1, -1, -1, "01234567", 0, 13, 13, 1, "ISO 18004 Figure 2 (and I.2) (mask 01)", "1111111010101" "1000001011101" "1011101001101" @@ -1768,7 +1782,7 @@ static void test_microqr_encode(int index, int generate, int debug) { "0001010000110" "1110100110111" }, - /* 1*/ { UNICODE_MODE, 2, -1, -1, "12345", 0, 13, 13, "ISO 18004 Figure 38 (mask 00)", + /* 1*/ { UNICODE_MODE, 2, -1, -1, "12345", 0, 13, 13, 1, "ISO 18004 Figure 38 (mask 00)", "1111111010101" "1000001010000" "1011101011101" @@ -1783,7 +1797,7 @@ static void test_microqr_encode(int index, int generate, int debug) { "0100100010101" "1111111010011" }, - /* 2*/ { UNICODE_MODE, 2, -1, 1 << 8, "12345", 0, 13, 13, "ISO 18004 Figure 38, explicit mask 00", + /* 2*/ { UNICODE_MODE, 2, -1, 1 << 8, "12345", 0, 13, 13, 1, "ISO 18004 Figure 38, explicit mask 00", "1111111010101" "1000001010000" "1011101011101" @@ -1798,7 +1812,7 @@ static void test_microqr_encode(int index, int generate, int debug) { "0100100010101" "1111111010011" }, - /* 3*/ { UNICODE_MODE, 2, -1, ZINT_FULL_MULTIBYTE | 2 << 8, "12345", 0, 13, 13, "Explicit mask 01", + /* 3*/ { UNICODE_MODE, 2, -1, ZINT_FULL_MULTIBYTE | 2 << 8, "12345", 0, 13, 13, 1, "Explicit mask 01", "1111111010101" "1000001000001" "1011101001100" @@ -1813,7 +1827,7 @@ static void test_microqr_encode(int index, int generate, int debug) { "0101010011011" "1110001011101" }, - /* 4*/ { UNICODE_MODE, 2, -1, 3 << 8, "12345", 0, 13, 13, "Explicit mask 10", + /* 4*/ { UNICODE_MODE, 2, -1, 3 << 8, "12345", 0, 13, 13, 1, "Explicit mask 10", "1111111010101" "1000001010001" "1011101001111" @@ -1828,7 +1842,7 @@ static void test_microqr_encode(int index, int generate, int debug) { "0100011010010" "1111111010011" }, - /* 5*/ { UNICODE_MODE, 2, -1, ZINT_FULL_MULTIBYTE | 4 << 8, "12345", 0, 13, 13, "Explicit mask 11", + /* 5*/ { UNICODE_MODE, 2, -1, ZINT_FULL_MULTIBYTE | 4 << 8, "12345", 0, 13, 13, 1, "Explicit mask 11", "1111111010101" "1000001001110" "1011101010101" @@ -1843,7 +1857,7 @@ static void test_microqr_encode(int index, int generate, int debug) { "0011100101101" "1010101111001" }, - /* 6*/ { UNICODE_MODE, 2, -1, 5 << 8, "12345", 0, 13, 13, "Mask > 4 ignored", + /* 6*/ { UNICODE_MODE, 2, -1, 5 << 8, "12345", 0, 13, 13, 1, "Mask > 4 ignored", "1111111010101" "1000001010000" "1011101011101" @@ -1858,7 +1872,7 @@ static void test_microqr_encode(int index, int generate, int debug) { "0100100010101" "1111111010011" }, - /* 7*/ { UNICODE_MODE, -1, -1, -1, "12345", 0, 11, 11, "Max capacity M1 5 numbers", + /* 7*/ { UNICODE_MODE, -1, -1, -1, "12345", 0, 11, 11, 1, "Max capacity M1 5 numbers", "11111110101" "10000010110" "10111010100" @@ -1871,7 +1885,7 @@ static void test_microqr_encode(int index, int generate, int debug) { "01010001100" "11110000011" }, - /* 8*/ { UNICODE_MODE, -1, -1, -1, "1234567890", 0, 13, 13, "Max capacity M2-L 10 numbers", + /* 8*/ { UNICODE_MODE, -1, -1, -1, "1234567890", 0, 13, 13, 1, "Max capacity M2-L 10 numbers", "1111111010101" "1000001010110" "1011101010001" @@ -1886,7 +1900,7 @@ static void test_microqr_encode(int index, int generate, int debug) { "0110010100110" "1001101111111" }, - /* 9*/ { UNICODE_MODE, 2, -1, -1, "12345678", 0, 13, 13, "Max capacity M2-M 8 numbers", + /* 9*/ { UNICODE_MODE, 2, -1, -1, "12345678", 0, 13, 13, 1, "Max capacity M2-M 8 numbers", "1111111010101" "1000001011000" "1011101011101" @@ -1901,7 +1915,7 @@ static void test_microqr_encode(int index, int generate, int debug) { "0101011001100" "1100110101001" }, - /* 10*/ { UNICODE_MODE, -1, -1, -1, "12345678901234567890123", 0, 15, 15, "Max capacity M3-L 23 numbers", + /* 10*/ { UNICODE_MODE, -1, -1, -1, "12345678901234567890123", 0, 15, 15, 1, "Max capacity M3-L 23 numbers", "111111101010101" "100000100110110" "101110100011111" @@ -1918,7 +1932,7 @@ static void test_microqr_encode(int index, int generate, int debug) { "010011000101101" "100111010001111" }, - /* 11*/ { UNICODE_MODE, 2, -1, -1, "123456789012345678", 0, 15, 15, "Max capacity M3-L 18 numbers", + /* 11*/ { UNICODE_MODE, 2, -1, -1, "123456789012345678", 0, 15, 15, 1, "Max capacity M3-L 18 numbers", "111111101010101" "100000100010110" "101110101101111" @@ -1935,7 +1949,7 @@ static void test_microqr_encode(int index, int generate, int debug) { "001110000101101" "110011111001111" }, - /* 12*/ { UNICODE_MODE, -1, -1, -1, "12345678901234567890123456789012345", 0, 17, 17, "Max capacity M4-L 35 numbers", + /* 12*/ { UNICODE_MODE, -1, -1, -1, "12345678901234567890123456789012345", 0, 17, 17, 1, "Max capacity M4-L 35 numbers", "11111110101010101" "10000010111010001" "10111010000011001" @@ -1954,7 +1968,7 @@ static void test_microqr_encode(int index, int generate, int debug) { "01110010010111010" "11001001111110111" }, - /* 13*/ { UNICODE_MODE, 2, -1, -1, "123456789012345678901234567890", 0, 17, 17, "Max capacity M4-M 30 numbers", + /* 13*/ { UNICODE_MODE, 2, -1, -1, "123456789012345678901234567890", 0, 17, 17, 1, "Max capacity M4-M 30 numbers", "11111110101010101" "10000010011010001" "10111010000011001" @@ -1973,7 +1987,7 @@ static void test_microqr_encode(int index, int generate, int debug) { "00001111000111000" "11100110111110111" }, - /* 14*/ { UNICODE_MODE, 3, -1, -1, "123456789012345678901", 0, 17, 17, "Max capacity M4-Q 21 numbers", + /* 14*/ { UNICODE_MODE, 3, -1, -1, "123456789012345678901", 0, 17, 17, 1, "Max capacity M4-Q 21 numbers", "11111110101010101" "10000010010101101" "10111010010010101" @@ -1992,7 +2006,7 @@ static void test_microqr_encode(int index, int generate, int debug) { "00000001110011011" "11011110011010100" }, - /* 15*/ { UNICODE_MODE, -1, -1, -1, "点茗テ点茗テ点茗テ", 0, 17, 17, "Max capacity M4-L 9 Kanji", + /* 15*/ { UNICODE_MODE, -1, -1, -1, "点茗テ点茗テ点茗テ", 0, 17, 17, 0, "Max capacity M4-L 9 Kanji; BWIPP doesn't seem to deal with Kanji correctly", "11111110101010101" "10000010111110010" "10111010000011101" @@ -2016,6 +2030,12 @@ static void test_microqr_encode(int index, int generate, int debug) { int i, length, ret; struct zint_symbol *symbol; + char escaped[1024]; + char bwipp_buf[32768]; + char bwipp_msg[1024]; + + int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise + testStart("test_microqr_encode"); for (i = 0; i < data_size; i++) { @@ -2031,21 +2051,32 @@ static void test_microqr_encode(int index, int generate, int debug) { 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, %d, %d, %s, \"%s\", %s, %d, %d, \"%s\",\n", + printf(" /*%3d*/ { %s, %d, %d, %s, \"%s\", %s, %d, %d, %d, \"%s\",\n", i, testUtilInputModeName(data[i].input_mode), data[i].option_1, data[i].option_2, testUtilOption3Name(data[i].option_3), - data[i].data, testUtilErrorName(data[i].ret), - symbol->rows, symbol->width, data[i].comment); + testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), testUtilErrorName(data[i].ret), + symbol->rows, symbol->width, data[i].bwipp_cmp, data[i].comment); testUtilModulesPrint(symbol, " ", "\n"); printf(" },\n"); } else { if (ret < ZINT_ERROR) { + int width, row; 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); + 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, data[i].option_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, data[i].option_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); + 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); + } } } } @@ -2144,6 +2175,8 @@ static void test_upnqr_input(int index, int generate, int debug) { /* 2*/ { UNICODE_MODE, "β", ZINT_ERROR_INVALID_DATA, "Error 572: Invalid character in input data for ECI 4", "β not in ISO 8859-2" }, /* 3*/ { DATA_MODE, "\300\241", 0, "(415) 70 44 00 02 C0 A1 00 EC 11 EC 11 EC 11 EC 11 EC 11 EC 11 EC 11 EC 11 EC 11 EC 11 EC", "ŔĄ" }, /* 4*/ { GS1_MODE, "[20]12", ZINT_ERROR_INVALID_OPTION, "Error 220: Selected symbology does not support GS1 mode", "" }, + /* 5*/ { UNICODE_MODE, "ĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄ", 0, "(415) 70 44 01 9B A1 A1 A1 A1 A1 A1 A1 A1 A1 A1 A1 A1 A1 A1 A1 A1 A1 A1 A1 A1 A1 A1 A1 A1", "" }, + /* 6*/ { UNICODE_MODE, "ĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄ", ZINT_ERROR_TOO_LONG, "Error 573: Input too long for selected symbol", "" }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -2306,14 +2339,12 @@ static void test_upnqr_encode(int index, int generate, int debug) { printf(" },\n"); } else { if (ret < ZINT_ERROR) { + int width, row; 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); - } + 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); } } @@ -2382,26 +2413,29 @@ static void test_rmqr_options(int index, int debug) { /* 43*/ { "点茗点茗点茗点茗点", 4, 13, ZINT_ERROR_TOO_LONG, -1, 0, 0 }, /* 44*/ { "点茗点茗点茗点茗点茗点茗点茗点茗点", 4, 20, 0, 0, 13, 77 }, // Max capacity ECC H, version 20 (R13x77), 17 kanji /* 45*/ { "点茗点茗点茗点茗点茗点茗点茗点茗点茗", 4, 20, ZINT_ERROR_TOO_LONG, -1, 0, 0 }, - /* 46*/ { "点茗点茗点茗点茗点茗点茗点茗点茗点点茗点茗点茗点", 4, 26, 0, 0, 15, 99 }, // Max capacity ECC H, version 26 (R15x99), 24 kanji - /* 47*/ { "点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点点茗", 4, 26, ZINT_ERROR_TOO_LONG, -1, 0, 0 }, + /* 46*/ { "点茗点茗点茗点茗点茗点茗点茗点茗点点茗点茗点茗点点茗点茗", 4, 26, 0, 0, 15, 99 }, // Max capacity ECC H, version 26 (R15x99), 28 kanji + /* 47*/ { "点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点", 4, 26, ZINT_ERROR_TOO_LONG, -1, 0, 0 }, /* 48*/ { "点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗", 4, 32, 0, 0, 17, 139 }, // Max capacity ECC H, version 32 (R17x139), 46 kanji /* 49*/ { "点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点", 4, 32, ZINT_ERROR_TOO_LONG, -1, 0, 0 }, - /* 50*/ { "点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗", -1, 32, 0, 0, 17, 139 }, // ECC auto-set to M, version 32 - /* 51*/ { "点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗", -1, 32, 0, 0, 17, 139 }, // Max capacity ECC M, version 32, 92 kanji - /* 52*/ { "点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点", 4, 32, ZINT_ERROR_TOO_LONG, -1, 0, 0 }, - /* 53*/ { "点茗点", -1, 33, 0, 0, 7, 43 }, // ECC auto-set to M, version 33 (R7xAuto-width) auto-sets R7x43 - /* 54*/ { "点茗点", 4, 33, 0, 0, 7, 59 }, // ECC set to H, version 33 (R7xAuto-width) auto-sets R7x59 - /* 55*/ { "点茗点", -1, 34, 0, 0, 9, 43 }, // ECC auto-set to H, version 34 (R9xAuto-width) auto-sets R9x43 - /* 56*/ { "点茗点", -1, 35, 0, 0, 11, 27 }, // ECC auto-set to M, version 35 (R11xAuto-width) auto-sets R11x27 - /* 57*/ { "点茗点茗点茗点", 4, 35, 0, 0, 11, 59 }, // ECC set to H, version 35 (R11xAuto-width) auto-sets R11x59 - /* 58*/ { "点茗点茗点茗点", -1, 35, 0, 0, 11, 43 }, // ECC auto-set to M, version 35 (R11xAuto-width) auto-sets R11x43 - /* 59*/ { "点茗点茗点茗点茗", -1, 36, 0, 0, 13, 43 }, // ECC auto-set to M, version 36 (R13xAuto-width) auto-sets R13x43 - /* 60*/ { "点茗点茗点茗点茗", 4, 36, 0, 0, 13, 59 }, // ECC set to H, version 36 (R13xAuto-width) auto-sets R13x59 - /* 61*/ { "点茗点茗点茗点茗点", -1, 37, 0, 0, 15, 43 }, // ECC auto-set to M, version 37 (R15xAuto-width) auto-sets R15x43 - /* 62*/ { "点茗点茗点茗点茗点", 4, 37, 0, 0, 15, 59 }, // ECC set to H, version 37 (R15xAuto-width) auto-sets R15x59 - /* 63*/ { "点茗点茗点茗点茗点茗点茗点茗点茗点茗", -1, 38, 0, 0, 17, 43 }, // ECC auto-set to M, version 38 (R17xAuto-width) auto-sets R17x43 - /* 64*/ { "点茗点茗点茗点茗点茗点茗点茗点茗点茗", 4, 38, 0, 0, 17, 77 }, // ECC set to H, version 38 (R17xAuto-width) auto-sets R17x77 - /* 65*/ { "点茗点", -1, 39, ZINT_ERROR_INVALID_OPTION, -1, 0, 0 }, + /* 50*/ { "点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗", -1, 32, 0, 0, 17, 139 }, // Max capacity ECC M, version 32, 92 kanji + /* 51*/ { "点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点", 4, 32, ZINT_ERROR_TOO_LONG, -1, 0, 0 }, + /* 52*/ { "点茗点", -1, 33, 0, 0, 7, 43 }, // ECC auto-set to M, version 33 (R7xAuto-width) auto-sets R7x43 + /* 53*/ { "点茗点", 4, 33, 0, 0, 7, 59 }, // ECC set to H, version 33 (R7xAuto-width) auto-sets R7x59 + /* 54*/ { "点茗点", -1, 34, 0, 0, 9, 43 }, // ECC auto-set to H, version 34 (R9xAuto-width) auto-sets R9x43 + /* 55*/ { "点茗点", -1, 35, 0, 0, 11, 27 }, // ECC auto-set to M, version 35 (R11xAuto-width) auto-sets R11x27 + /* 56*/ { "点茗点茗点茗点", 4, 35, 0, 0, 11, 59 }, // ECC set to H, version 35 (R11xAuto-width) auto-sets R11x59 + /* 57*/ { "点茗点茗点茗点", -1, 35, 0, 0, 11, 43 }, // ECC auto-set to M, version 35 (R11xAuto-width) auto-sets R11x43 + /* 58*/ { "点茗点茗点茗点茗", -1, 36, 0, 0, 13, 43 }, // ECC auto-set to M, version 36 (R13xAuto-width) auto-sets R13x43 + /* 59*/ { "点茗点茗点茗点茗", 4, 36, 0, 0, 13, 59 }, // ECC set to H, version 36 (R13xAuto-width) auto-sets R13x59 + /* 60*/ { "点茗点茗点茗点茗点", -1, 37, 0, 0, 15, 43 }, // ECC auto-set to M, version 37 (R15xAuto-width) auto-sets R15x43 + /* 61*/ { "点茗点茗点茗点茗点", 4, 37, 0, 0, 15, 59 }, // ECC set to H, version 37 (R15xAuto-width) auto-sets R15x59 + /* 62*/ { "点茗点茗点茗点茗点茗点茗点茗点茗点茗", -1, 38, 0, 0, 17, 43 }, // ECC auto-set to M, version 38 (R17xAuto-width) auto-sets R17x43 + /* 63*/ { "点茗点茗点茗点茗点茗点茗点茗点茗点茗", 4, 38, 0, 0, 17, 77 }, // ECC set to H, version 38 (R17xAuto-width) auto-sets R17x77 + /* 64*/ { "点茗点", -1, 39, ZINT_ERROR_INVALID_OPTION, -1, 0, 0 }, + /* 65*/ { "点茗点", 4, -1, 0, 0, 13, 27 }, // ECC set to H, auto-sets R13x27 + /* 66*/ { "点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗", 4, -1, 0, 0, 15, 99 }, // ECC set to H, auto-sets R15x99 (max capacity) + /* 67*/ { "点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点", 4, -1, 0, 0, 17, 99 }, // ECC set to H, auto-sets R17x99 + /* 68*/ { "点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗", 4, -1, 0, 0, 17, 139 }, // ECC set to H, auto-sets R17x139 (max capacity) }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -2573,16 +2607,16 @@ static void test_rmqr_optimize(int index, int generate, int debug) { char *comment; }; struct item data[] = { - /* 0*/ { UNICODE_MODE, "1", -1, 0, "21 10 EC 11 EC", "N1" }, + /* 0*/ { UNICODE_MODE, "1", -1, 0, "22 20 EC 11 EC", "N1" }, /* 1*/ { UNICODE_MODE, "AAA", -1, 0, "46 73 0A 00 EC", "A3" }, - /* 2*/ { UNICODE_MODE, "0123456789", -1, 0, "2A 03 15 9A 9A 40 EC", " N10 (nayuki.io - pure numeric)" }, + /* 2*/ { UNICODE_MODE, "0123456789", -1, 0, "34 06 2B 35 34 80 EC", "N10 (nayuki.io - pure numeric)" }, /* 3*/ { UNICODE_MODE, "ABCDEF", -1, 0, "4C 73 51 4A 85 00 EC", "A6 (nayuki.io - pure alphanumeric)" }, /* 4*/ { UNICODE_MODE, "wxyz", -1, 0, "71 DD E1 E5 E8", "B4 (nayuki.io - pure byte)" }, /* 5*/ { UNICODE_MODE, "「魔法少女まどか☆マギカ」って、 ИАИ desu κα?", -1, 0, "(53) 8E 80 D6 00 4F C0 57 6A B5 C2 B8 14 70 94 81 64 37 A1 8D 0C 50 0D 82 82 14 40 00 80", "K29 (nayuki.io - pure kanji)" }, /* 6*/ { UNICODE_MODE, "012A", -1, 0, "48 00 43 20 EC", "A4" }, - /* 7*/ { UNICODE_MODE, "0123A", -1, 0, "24 03 0D 09 40", "N4 A1 (nayuki.io - alpha/numeric)" }, + /* 7*/ { UNICODE_MODE, "0123A", -1, 0, "28 06 1A 12 80", "N4 A1 (nayuki.io - alpha/numeric)" }, /* 8*/ { UNICODE_MODE, "0a", -1, 0, "68 C1 84 00 EC", "B2 (nayuki.io - numeric/byte)" }, - /* 9*/ { UNICODE_MODE, "01a", -1, 0, "22 02 CB 08 EC", "N2 B1 (nayuki.io - numeric/byte)" }, + /* 9*/ { UNICODE_MODE, "01a", -1, 0, "24 05 96 10 EC", "N2 B1 (nayuki.io - numeric/byte)" }, /* 10*/ { UNICODE_MODE, "ABCa", -1, 0, "71 05 09 0D 84", "B4 (nayuki.io - alphanumeric/byte)" }, /* 11*/ { UNICODE_MODE, "ABCDa", -1, 0, "48 73 51 4B 2C 20 EC", "A4 B1 (same bits as B5)" }, /* 12*/ { UNICODE_MODE, "THE SQUARE ROOT OF 2 IS 1.41421356237309504880168872420969807856967187537694807317667973799", -1, 0, "(48) 46 A9 52 9A A0 D5 42 66 E6 F8 A1 4F 62 3E 56 CC D4 40 2B 98 2C F1 AB 19 2E A2 F8 61", " A26 N65 (nayuki.io - alpha/numeric)" }, @@ -2636,113 +2670,383 @@ static void test_rmqr_encode(int index, int generate, int debug) { struct item { int input_mode; - char *data; int option_1; int option_2; + char *data; int ret; int expected_rows; int expected_width; + int bwipp_cmp; char *comment; char *expected; }; - // Note very little available to compare these to (BWIPP gives very different results TODO: investigate) so should be considered "unproven" + // ISO/IEC JTC1/SC31N000 (Draft 2019-6-24) struct item data[] = { - /* 0*/ { UNICODE_MODE, "0123456", 4, 11, 0, 11, 27, "Draft ISO 2018-6-8 Annex H I.2, currently no image to compare to", + /* 0*/ { UNICODE_MODE, 4, 11, "0123456", 0, 11, 27, 1, "Draft ISO 2019-6-24 Annex I Figure I.2, R11x27-H, same", "111111101010101010101010111" - "100000100110111010101101101" - "101110100001100000010110101" - "101110101111100000001001010" - "101110100100011000101000111" - "100000101110011000111110010" - "111111100110100101001011111" - "000000001101001111010010001" - "111000011011111000011110101" - "100100100010000011111010001" + "100000100110100001110100101" + "101110100001001111010011111" + "101110101111011011110001100" + "101110100101110111111001011" + "100000101110000100111110010" + "111111101111111110001011111" + "000000001111101011010010001" + "111100000010010100111110101" + "101010100110010100111010001" "111010101010101010101011111" - }, - /* 1*/ { UNICODE_MODE, "1234567890123456", 2, 17, 0, 13, 27, "Draft ISO 2018-6-8 6.2 Figure 1 **NOT SAME**", + }, + /* 1*/ { UNICODE_MODE, 2, 17, "12345678901234567890123456", 0, 13, 27, 1, "Draft ISO 2019-6-24 6.2 Figure 1, R13x27-M, same (note data as here not as given in draft)", "111111101010101010101010111" - "100000100001111000111110101" - "101110101100010111110111001" - "101110100110001110010100000" - "101110101111001001101001001" - "100000100010001110011110000" - "111111100000001100000010101" - "000000001111100000010001100" - "111001101110000001110011111" - "011111011101010000100010001" - "100000101000011010101010101" - "101101101100110111000010001" + "100000100001001100010011001" + "101110101100000011001110001" + "101110100110101100000100000" + "101110101110100110110110011" + "100000100011100011001011000" + "111111100100111111000011101" + "000000001010010101010001100" + "110101101011010110010011111" + "011001101010101111100010001" + "100000100111000111101010101" + "100011010010010100000010001" "111010101010101010101011111" - }, - /* 2*/ { UNICODE_MODE, "123456789012", -1, 1, 0, 7, 43, "R7x34 M max numeric 12 digits", + }, + /* 2*/ { UNICODE_MODE, 2, 2, "0123456789012345", 0, 7, 59, 1, "Draft ISO 2019-6-24 7.4.2 Numeric mode Example, R7x59-M, same codewords", + "11111110101010101011101010101010101010111010101010101010111" + "10000010101111011110100001100001100001101100100101100100101" + "10111010100100001011110010110000011110111110111100011011111" + "10111010110001100010010100111010101101101011111000110110001" + "10111010011001000011100111100000110010111011010111011010101" + "10000010101010110110100010111110010010101111101111110010001" + "11111110101010101011101010101010101010111010101010101011111" + }, + /* 3*/ { UNICODE_MODE, 2, 2, "AC-42", 0, 7, 59, 0, "Draft ISO 2019-6-24 7.4.3 Alphanumeric mode Example, R7x59-M, same codewords; BWIPP different encodation", + "11111110101010101011101010101010101010111010101010101010111" + "10000010101111010010110011010101100000101011001111100100101" + "10111010100100100011100100111100011101111100011011111011111" + "10111010110001110110100001101110100111101110000010010110001" + "10111010011000110111111101110000110001111000100110111010101" + "10000010101010111110100011101110011011101101011010110010001" + "11111110101010101011101010101010101010111010101010101011111" + }, + /* 4*/ { UNICODE_MODE, -1, 1, "123456789012", 0, 7, 43, 1, "R7x34-M max numeric 12 digits", "1111111010101010101011101010101010101010111" - "1000001001011011001110111100000000011000101" - "1011101010110010101111101001000111111111111" - "1011101001101000000100111011010101000010001" - "1011101000111001001111110010111101110010101" - "1000001011111101000110100110000000011010001" + "1000001001010111111010100000100011011000101" + "1011101010111000100111101101011010111111111" + "1011101001100110111000000001111111000010001" + "1011101000101100011111100110111110110010101" + "1000001011110111111110101101001010111010001" "1111111010101010101011101010101010101011111" }, - /* 3*/ { UNICODE_MODE, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678", 4, 32, 0, 17, 139, "R17x139 H max numeric 178 digits", + /* 5*/ { UNICODE_MODE, 4, 32, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678", 0, 17, 139, 1, "R17x139-H max numeric 178 digits", "1111111010101010101010101011101010101010101010101010101110101010101010101010101010111010101010101010101010101011101010101010101010101010111" - "1000001011001000110010100110111110011010111100010111001010001011000101011111010101101010110111011011111110010110100110010111101000100111001" - "1011101010000000000011101111110000111110100010101011001111101110111000000101100010111111010110100111111010000011100001110011001100010010001" - "1011101010010001001011011110110110001011110111000001111000011010111010001110100001001101110010000101111110100110111111101000000001000010000" - "1011101001001111000111101011001111001111010001011011011110111000111001000100111001110111001001011000101011111111111111001101010011111000111" - "1000001010001010101111010110110110101110111110111100010001000011101011101010001111001001100101001010001001011000111000011111101001010010010" - "1111111010000101010101110011100101000111101010101110100111101111100000110100110101110101010011100011001100010001100000100110111011111110011" - "0000000000011101001101111000100110010011011001110000111000111101011000111111101010000101001011110001000101101110100100100000010010111100100" - "1111010111011011000110010101111110011000010100000011011110010011100001111101000010010101001111111010000111101101111011011000010100010001101" - "0111101110101010001010101110000111000110011011010110100001111100111100101100100001000010101101100010101000010100001111011111101110110001010" - "1111111110011100100100000111000011110101110100011000110100011110000100111000110110111001101100001110111000100011001000110011101101000110011" - "0110110101110001110100000110101010100000011001011000000001001111111001010101001110000111101100000100011110100010110111100101000001001011010" - "1010010110011001000100010001000111111110101001001111001101010001000111010101001101011111111000111111001011001111110111101010010010111011111" - "0011110011110100101011001000001010100011101111100100001000011000111100011011110010001101000111101011100001010100101010001110111001111110001" - "1011101000011100110000101111100101100011010011000110011110101101000101011010001011111010000101000100110100010111110000110111101010111110101" - "1000101001111010100011010110111110101000110110000000101011110010110010010000110110101111110010110100110111101010110000100000011110010110001" + "1000001011001111001111010110101111111110001100100101011011010101100000011101000010101101000110111100000111101010111011011000011100010001001" + "1011101010001001010100111011111010110101010101000101101110001111010001011001101110111001010011010101010100101011100001100100000011101011111" + "1011101010010100010101100110101001110011110111011110111001011000100100110010111101000101000111100010011000100100101000110111100110001010000" + "1011101001010110110010110101011110011101110111001011011100110010101111101110000011010000110001011011001001011001011000011110111101111100111" + "1000001010001101001110011100001111111000001001101011001011011101110100010001111100001111001000011001100011101000001111001000010010101001110" + "1111111011110001000111011111010111111010101011110111110111001111100011001110111101110110110010110100110111100101000111111001011100000010101" + "0000000010010000011010101010101101001101111011101100000001101001101101110100101011101100011111100100101111010100110001110111001000010110000" + "1110101110111001111110100101000010011011111000110111001110001001001101101111011001111000111111001011111010010111111110010111100000111001101" + "0101000110010110111000000000001111011000011111111100101011001010101111111000110100100001101111111011001111101000001110011100010101010000100" + "1001000000100010100001101111110100011001110001011010001111101010010110110101101110010011111100011100011010101001000001101000000111101010011" + "0011010010110011011010100010101010011000100010100101100010111110001110111010100110100101110010000100010000100110101000010001101110001011010" + "1000110001111011101101101101110110011110110110111110111110110001000111110010000110110000000011100010000101010111011010010111101001011011111" + "0010000000111010001110110110011000011010011101100010000011101001011101001011001011001011100010111101010111011000010111001001000010111110001" + "1100101100110100100101000011111110111000010001101001001111001110110100000111101011111001100101001000000011101011110100101001010100111110101" + "1010111110110100011001111010100011101111001101100101111011100101011100011011011000101010010000000100111000011010100000100111101001110110001" "1110101010101010101010101011101010101010101010101010101110101010101010101010101010111010101010101010101010101011101010101010101010101011111" }, - /* 4*/ { UNICODE_MODE, "123456789012345678901234567890123456789012345678901234", 4, 33, 0, 7, 139, "R7xauto H max numeric 54 digits", + /* 6*/ { UNICODE_MODE, 4, 33, "123456789012345678901234567890123456789012345678901234", 0, 7, 139, 1, "R7xauto-H max numeric 54 digits", "1111111010101010101010101011101010101010101010101010101110101010101010101010101010111010101010101010101010101011101010101010101010101010111" - "1000001011011110100001110010100100001111000111011101011011001100000111111010011111101110111011101001010011101110111011000110000001001000001" - "1011101000010001001110011111100000100110110101101011101110101000100001001100001110111010100000110100100001111011101000110111011110101011111" - "1011101001111010110000111110101111100001011110010111010010111110100110011111111111101101010101000111101010011000110111101010001100000010001" - "1011101011110100001010000011101111100111101100000011011110100010111101101100100111111011101000110101101000000111101110111001010100101010101" - "1000001010001000001011100010101001100011000011000010011011011011011111110010010011101000011010011110010110111010101010010011111110010110001" + "1000001011010011001111100110101000111000110001101010101011100001010000000000011001101000110010111100010100100110101000010111100011001000001" + "1011101000011001010110011111111001010000100001011100101110111001110001011101010011111000110100100000100100111011100000000010010010101011111" + "1011101001110011010110011110000111010000111100110001101000100000110000000101101100000011000100100101101000000010100100101000110010000010001" + "1011101011101101111101010011101111111011101110010111101110110111111000111001010000111011011001100000111000001111111111101001100011001010101" + "1000001010001100101101000010110110010110000111100001011011001001011001111000100111101011001110101000010111101110101110000101110011110110001" "1111111010101010101010101011101010101010101010101010101110101010101010101010101010111010101010101010101010101011101010101010101010101011111" }, - /* 5*/ { UNICODE_MODE, "123456789012345678901234567890123", 4, 35, 0, 11, 59, "R11xauto H with max numeric 33 digits for width 59", + /* 7*/ { UNICODE_MODE, 4, 35, "123456789012345678901234567890123", 0, 11, 59, 1, "R11xauto-H with max numeric 33 digits for width 59", "11111110101010101011101010101010101010111010101010101010111" - "10000010101010010010100111111011011110101001100110110011001" - "10111010000110110111101001001010100001111010000100000000011" - "10111010101111011100110000010110100101100001111110110110100" - "10111010001110111011111110110011010100011010101010010000101" - "10000010000110100110000001000110110100100000001100100110000" - "11111110111000101111111010001011010011111111101101101011111" - "00000000010001110000100101111101101110100011001010111010001" - "11010101101011100011100001110011000010111111110000010010101" - "10011110000011110010101110111110000100101110100001000110001" + "10000010101001100110111000100110101100101100010101111110101" + "10111010000110100111101001001111110010111101000100110110011" + "10111010101110011100110101010011111101101001110010001101110" + "10111010001000101111000010010101001010011011101010011010001" + "10000010000110110010111111111010010110001110100010000110000" + "11111110011110011111011101001001101111010001001100001011111" + "00000000001111111110100100110100101111101111111000111010001" + "11011000100010010111110110111001011100111000100100010010101" + "10011101110110100010100011000110110010101001001100100110001" "11101010101010101011101010101010101010111010101010101011111" }, - /* 6*/ { UNICODE_MODE, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", -1, 38, 0, 17, 139, "R17xauto M max numeric 361 digits", + /* 8*/ { UNICODE_MODE, -1, 38, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", 0, 17, 139, 1, "R17xauto-M max numeric 361 digits", "1111111010101010101010101011101010101010101010101010101110101010101010101010101010111010101010101010101010101011101010101010101010101010111" - "1000001001000101001111000010110100001000101100110001101010100000111110001000100011101011111000001110011001110010100111000101001100000001101" - "1011101011100100000111001011101001110010101001100000001111010010111111101001111110111000101000010010110101111111111101111101101000001011001" - "1011101001000111010101101000100010100110111111000010001010000111000001110010101101101100011111010001000111001110011101000011110011100111010" - "1011101000011011001010110111000101101000011001111111100110101100100010000110011000110010001110111101000010010001000111100010001111110010101" - "1000001000010011010111011100110011101001111000011100111001111010111111001101001001101010001000000100111100000100000000111100001000011110110" - "1111111011000011001100001011100101010100001110100100010101100010100001111000000110011101001100000011111010101111101010011101110001001101101" - "0000000010101010011100011110100011110101111000010000000010110101000000110111010110100101100101111001001000101010011001000010010111110000110" - "1111000101000101010110010101111001011001110001111100101110110101011111010111100011110000110011101111100001010011010011000010011110110010011" - "0111110010111110100111011100100110100111011110110111111000100100111111001000100001001010111010000110011001110110001110100011101010000101010" - "1000110110001000011011011001101111100101110100110000000101010010110110101100011100011111101000011010110100011101100100111101100100001010011" - "0010111001011000101010100000011101100011011000111100001000000111001000110110111111100101010111010001000111001000011101011100100101111011110" - "1000000110001011100000011101011000110101100001100011100110101100100000011011110100110101010110111101000010000011100110100011011011110111111" - "0010111110101011111010111110000101111100111101001010111001111010111111111001011100001111101000100100111100010010000010111111011011000110001" - "1101011001000100011101010111100001001010100010010110011111100011000101100010001111111011100101000011111110101111101000011110100000010110101" - "1001100101010101001010100010100011011100111001110111011010110101000100100111100110101011100101111011001010100110111111000010110110100110001" + "1000001001000101011111010110101000111111101000111100111011110101001110010101100011101100101011101111100000110010101010100000011111110110001" + "1011101011100111011000001111111010110000100000100110001111110101001001010011000110111101110100011101010101001111100001010000010111111111011" + "1011101001001100001001111100010100100011000110010110010001110110110101101000001110000111011000110010111111011010010110011101110100001001010" + "1011101000010101010111011001110010111100100101101001111100011100100111001101000001011010001000000010111001110001001000101111001000010000101" + "1000001000010001001011010010000000011001010001001001111000001000101010010111010101001001010111111101000011100010101111000011001010111001110" + "1111111001101010000100101101010011000001101011110111001111100011000000100110111000110100000111110001001010001011110100000000110111011100001" + "0000000010110010001111111010101001000000110001110110001011100011110111101000111110001101100100000011111100101100011001111000101001000100110" + "1110101100000110000111010011111100101011100100000000101100000010111010011000101011011100111000001100010101010001100011110101001000100000111" + "0111101111100011010010111110111010100101011100100101110001010101001010010101100000001000011011101100000000010010100110100000011111110110010" + "1000000010110100110011010001111100011111010101100000011111011101000101010011000101110101010111011011100001101101011101000000010111110011011" + "0001011000101100111101110000000000001111001110001000000010001010111101101000001110000111011011010011111111111000011010011101110100011011110" + "1110010100011011010101000111110001000000010100011111000100100000110111001101000001111010001000100110111110100001110100101111001000110111111" + "0111111000011110110011110000010100000010011111010011011011111101011010010111010101001001010111100100001011100110101101000011001010000110001" + "1010111000111001011010111011111111010100010000000001111111011111100000100110111000111000000111101001000000001111100111000000110111110110101" + "1010100110101011001011101010100000110111001110010011101011010011100100101000111010101110101100010001011100100010101010111100100001000110001" + "1110101010101010101010101011101010101010101010101010101110101010101010101010101010111010101010101010101010101011101010101010101010101011111" + }, + /* 9*/ { UNICODE_MODE, 2, 1, "\001\002\003\004\005", 0, 7, 43, 1, "R7x43-M with max 5 binary", + "1111111010101010101011101010101010101010111" + "1000001001010001101010101011001111011000101" + "1011101010111101100111100101110001011111111" + "1011101001101111011110011001101001000010001" + "1011101000100000100111110110101110110010101" + "1000001011110000000010101011001111011010001" + "1111111010101010101011101010101010101011111" + }, + /* 10*/ { UNICODE_MODE, 4, 1, "\001\002", 0, 7, 43, 1, "R7x43-H with max 2 binary", + "1111111010101010101011101010101010101010111" + "1000001011010010110010111001001111001000001" + "1011101011010011101011110001000001010011111" + "1011101010111101110110001010001001011010001" + "1011101001111011011011111111001110011010101" + "1000001001111110100010111110110110101010001" + "1111111010101010101011101010101010101011111" + }, + /* 11*/ { UNICODE_MODE, 2, 1, "ABCDEFG", 0, 7, 43, 1, "R7x43-M with max 7 alphanumerics", + "1111111010101010101011101010101010101010111" + "1000001001011100111110111000000101011000101" + "1011101010111010101011110111101001011111111" + "1011101001100001111100011111100010100010001" + "1011101000110011100011111110010100110010101" + "1000001011111011101110111110000111111010001" + "1111111010101010101011101010101010101011111" + }, + /* 12*/ { UNICODE_MODE, 2, 1, "点茗点", 0, 7, 43, 0, "R7x43-M with max 3 Kanji; BWIPP different encodation", + "1111111010101010101011101010101010101010111" + "1000001001011000100010101001010001111000101" + "1011101010110101110111111001011101111111111" + "1011101001100001101010100110100110100010001" + "1011101000100010000011101101011011110010101" + "1000001011111100010110101111011000111010001" + "1111111010101010101011101010101010101011111" + }, + /* 13*/ { UNICODE_MODE, 2, 4, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLM", 0, 7, 99, 1, "R7x99-M with max 39 alphanumerics", + "111111101010101010101011101010101010101010101010111010101010101010101010101110101010101010101010111" + "100000100111110010010010101010100110101001000011101100101101000010101110001011100000010001111100101" + "101110100101000000101011100100010000001000001111111111011111000000110101111111101111100000100011111" + "101110100100011111000100010111001001100101111011100001000001001111101010111010110110100011000110001" + "101110101000101011110111101110010000110011110101111110100111100010101000101111101101101111000110101" + "100000101010111010111010111110101001111001101011101010101010001100101101111011100101101010110010001" + "111111101010101010101011101010101010101010101010111010101010101010101010101110101010101010101011111" + }, + /* 14*/ { UNICODE_MODE, 4, 5, "\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026", 0, 7, 139, 1, "R7x139-H with max 22 binary", + "1111111010101010101010101011101010101010101010101010101110101010101010101010101010111010101010101010101010101011101010101010101010101010111" + "1000001011010100100110110110100110111000001010100110101010111101000011111010001000101100000100001011011110111110100110011110001101001000001" + "1011101000010011101011000111111011101001111011110101011110111001000010011111001110111001100001010101110110100011110011110001010001001011111" + "1011101001111010000010110010111010001000101110001010101000101110001111011000010111001101000001010101101001110100110011110010000001000010001" + "1011101011110101001101101111100101000110001011010111101111110111111011101010001110111100001101011100001010011111111110111010001101001010101" + "1000001010000100011110111110111000111001100010111001111011001011011111000110010101101111111111001110101110101010101110110010001100110110001" + "1111111010101010101010101011101010101010101010101010101110101010101010101010101010111010101010101010101010101011101010101010101010101011111" + }, + /* 15*/ { UNICODE_MODE, 2, 7, "\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024", 0, 9, 59, 1, "R9x59-M with max 20 binary", + "11111110101010101011101010101010101010111010101010101010111" + "10000010100110111010110111101111000011101110010011100001001" + "10111010101100001011111100111100011111111100011001111100101" + "10111010001011110100100111110100100000000110011110000000110" + "10111010010001101101111101100001011011110011100011111111111" + "10000010000100101110010110010111100000100111010011101010001" + "11111110010100010111110011111110011101111100011000011110101" + "00000000000011111010111011010100000000101110011010000110001" + "11101010101010101011101010101010101010111010101010101011111" + }, + /* 16*/ { UNICODE_MODE, 2, 9, "12345678901234567890123456789012345678901234567", 0, 9, 99, 1, "R9x99-M with max 47 numerics", + "111111101010101010101011101010101010101010101010111010101010101010101010101110101010101010101010111" + "100000100010000101001110111001101000101110111000101110001100111010100000001011110010011100011001101" + "101110101011011101000011110000001000010010010000111011001001111111000001001110101111110010111000101" + "101110101010111000000000001110110110111110001100000001001111011011101101011011011100000001110110100" + "101110101111101010100111111010001100011000000110010100011010001111100010110100000110001000111111111" + "100000100110100000000110100110010010111001000101101000110011010101110000001010000011101010011010001" + "111111100100110111110011110010000010111111100111111100100110000100000111101110010011011110101010101" + "000000000111000111011010100110011010111011010011101110110100100111001011111010110011000000001010001" + "111010101010101010101011101010101010101010101010111010101010101010101010101110101010101010101011111" + }, + /* 17*/ { UNICODE_MODE, 2, 11, "\001\002\003\004\005\006", 0, 11, 27, 1, "R11x27-M with max 6 binary", + "111111101010101010101010111" + "100000101110010000111000101" + "101110100111010000000011001" + "101110100010000111110101110" + "101110100001011100111000001" + "100000100110111001101110110" + "111111100100001110000111111" + "000000000101011011001010001" + "111100001110011000010110101" + "101001111010101000101010001" + "111010101010101010101011111" + }, + /* 18*/ { UNICODE_MODE, 4, 11, "\001\002\003\004", 0, 11, 27, 1, "R11x27-H with max 4 binary", + "111111101010101010101010111" + "100000100110100100111000101" + "101110100001011000000011001" + "101110101111011111110101010" + "101110100100000010111000001" + "100000101110011001111110010" + "111111101101110100001011111" + "000000001011111100010010001" + "111011000110110000011110101" + "101000000010100100111010001" + "111010101010101010101011111" + }, + /* 19*/ { UNICODE_MODE, 2, 13, "12345678901234567890123456789012345678901234567890123456789012345678901", 0, 11, 59, 1, "R11x59-M with max 71 numerics", + "11111110101010101011101010101010101010111010101010101010111" + "10000010001010111110110110010100101111101111001110101100001" + "10111010011100010011110111110001111100111010111101000100011" + "10111010011001001000001110100101110100101001110000010010000" + "10111010011011101111111010100010101001111000011010010100001" + "10000010100111001000111011110110111001101100001001110110100" + "11111110010111010111001000011000101010110001001100000111111" + "00000000011100100100100000100011000100001111000000000010001" + "11111100110000101111110101101001000100111000101010011010101" + "10011100001011001110100101001100110111101001101110110110001" + "11101010101010101011101010101010101010111010101010101011111" + }, + /* 20*/ { UNICODE_MODE, 2, 18, "1234567890123456789012345678901234567890123456789012345678901", 0, 13, 43, 1, "R13x43-M with max 61 numerics", + "1111111010101010101011101010101010101010111" + "1000001011111001100110111000110110011001001" + "1011101011100001110011110110101000100010111" + "1011101011000100101010011001000010110111010" + "1011101010100100111011011011100011000111111" + "1000001001101001000000110110001000101101110" + "1111111010011101101101101010100100101000011" + "0000000011110010100110111001100100101101110" + "1111100101001011000001101100111011010111111" + "0011110001100101000000100000101100110110001" + "1011101111000010101011110011001100100010101" + "1000110000010111110010110001001011001010001" + "1110101010101010101011101010101010101011111" + }, + /* 21*/ { UNICODE_MODE, 4, 20, "\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033", 0, 13, 77, 1, "R13x77-H with max 27 binary", + "11111110101010101010101011101010101010101010101010111010101010101010101010111" + "10000010101100000001000010111011001111101101111101101110100010001011100001101" + "10111010010010101011110111100110000111101101101101111110000000011110111011011" + "10111010100101111101110100000000010011011010000000001100100110011010000001100" + "10111010000111001111011101001110010010110101111000110001101001100011101011111" + "10000010111010000011101000001111101111001010101001101100000001000011110011000" + "11111110110111111101110011101010100110011011111111011100001100110110011100101" + "00000000110110101010001000000000010111001011110110001100011000011100000101010" + "11111101010111111111100011100111100011111001111110111001100010010001100011111" + "01000111110100101000101100110111101100000100100001100110100001001011111110001" + "10001110011100111011101011110000110011101000011011111010001000011101010110101" + "10001001000010011011101110100010010001101111111101101000000110010000011010001" + "11101010101010101010101011101010101010101010101010111010101010101010101011111" + }, + /* 22*/ { UNICODE_MODE, 2, 20, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123", 0, 13, 77, 1, "R13x77-M with max 123 numerics (note 8 bit cci in draft 2019-6-24 when 7 suffices)", + "11111110101010101010101011101010101010101010101010111010101010101010101010111" + "10000010001111011110000010110000001101001111110110101010010010110011111011101" + "10111010001010000001000011100001010010100110011011111001000001111110100011001" + "10111010010011101110100110011001011011110110011101100011001010000010000010000" + "10111010010010111110100011010101011101110000000101110101111110010001000110011" + "10000010011110000011110100011001011101111111110110000100110010110011101011000" + "11111110111010011010000011010010110010010111011011111111010101111110110011111" + "00000000111011110111001110010000001000110001011101100110000110000010110101110" + "11111111010011101000010001110101101101110010000101011101110010000001101111111" + "01101010101001000000100000100000111110111111111011100100110100001011100110001" + "10110000001110100010011011100001011011010111011110111011010101110111111110101" + "10101101110110111100111010111111000100010001001101101110100100010100001010001" + "11101010101010101010101011101010101010101010101010111010101010101010101011111" + }, + /* 23*/ { UNICODE_MODE, 2, 23, "\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037", 0, 15, 43, 1, "R15x43-M with max 31 binary", + "1111111010101010101011101010101010101010111" + "1000001011010010111010101000000011011011001" + "1011101011000000000011111001010001110001111" + "1011101000101100100010110000110001110001110" + "1011101010001110100001100010100011111100001" + "1000001011000001101010010100001111001010110" + "1111111011100000010101011001110001110001001" + "0000000010010111110000110010110001110001010" + "1100111001111100110001101010100000111000111" + "0100100011111110010000010100000111101001100" + "1010101010110000110001101011000001110011111" + "0110000110000110110010110001000001101010001" + "1100010010011100000011100110000010000110101" + "1001011111001000010010110100001011011110001" + "1110101010101010101011101010101010101011111" + }, + /* 24*/ { UNICODE_MODE, 4, 27, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRST", 0, 15, 139, 1, "R15x139-H with max 98 alphanumerics", + "1111111010101010101010101011101010101010101010101010101110101010101010101010101010111010101010101010101010101011101010101010101010101010111" + "1000001000101010110111000110101110111011110000110111111011010110110101010100010000101101000101101000000110101010110111000011111101010011001" + "1011101001100101001100010011101100000011101101100110011111100111110110101101110101111001000011000100010000110111111101101011100000111011001" + "1011101011111100000110000100011011111010011111100001000000110111001010010001011010000100100101100001011110110010011011101000100100010011100" + "1011101010000010010111110001010010000101111011010110100110011101001100001111010101110001110100100011101010101111100110010011001001000101101" + "1000001000100000010010001000110011100110010001011011101011111000000010111001010010101101011110101111011010110000100111110010111111110100100" + "1111111010100000110011001001111101001101011011110010001100000100000101011011001110110110000000111000011101001011000111111011101000100111101" + "0000000011000010100010110000111000010011101010111100100010001001010011000110010101000000001100101001010001011010100010111011011111101111010" + "1100110111000001101100101011110001111111000010100000110110101001010011100001110100111010001100000100000000011001110111111000111010111101011" + "0100110000100000100100010000001011001010001000111001000001101101100100100011011110100111001111001000110000010100100110011000010010010111000" + "1100011110010111111010011001011101100001001001001111100101111011111011111110011000110100101110000110011010010101100001111001111011100111111" + "0001111000000010100011001000110111101111101111101010001010001000101100101101000001000010100000101111101000011100010010011111100011110010001" + "1100111110100000010000111011110010011100101001110010101110011110110110001100001101111001001110011000111010111011110011001010011001000110101" + "1011010110101111010001000110110100010001001001100010101011001000110010111101000000101111001000110110011001111010100011110110001000100010001" + "1110101010101010101010101011101010101010101010101010101110101010101010101010101010111010101010101010101010101011101010101010101010101011111" + }, + /* 25*/ { UNICODE_MODE, 2, 28, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, 17, 43, 1, "R17x43-M with max 90 numerics", + "1111111010101010101011101010101010101010111" + "1000001001000101001010111110000001010100101" + "1011101000101110110011110100001001100110011" + "1011101010001111111010101000010101101001000" + "1011101010001001010101011100110000100111111" + "1000001011111110111110000101001001010110000" + "1111111001111100101111110111011010000010111" + "0000000010011101100110011111010000101101010" + "1100111101010110111011011000110101001100111" + "0111000100100100011010000110001001101100010" + "1110110010011101000111101111000000010011011" + "0011001001011100110000101100100111111011110" + "1110111010101010010001111101011010001111111" + "0011110000011011010110001101001000111110001" + "1010000001001101001111101000100011000110101" + "1010110110101010011110101110010011011010001" + "1110101010101010101011101010101010101011111" + }, + /* 26*/ { UNICODE_MODE, 4, 29, "\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032", 0, 17, 59, 1, "R17x59-H with max 26 binary", + "11111110101010101011101010101010101010111010101010101010111" + "10000010111010100010101100011001100000101011110011110011101" + "10111010011000111011101011101011010010111000110100011100011" + "10111010101100010010101010011000101000000100011010000100000" + "10111010111100100101101000101000101000110110010001100011011" + "10000010110011101100010010111000101111100010111011100001100" + "11111110111111001101001001000101011110111100010111001111011" + "00000000100101101110101100000000101101101110010110001101100" + "11111011001011101111100001011101011101110010010011100111111" + "01111100111111000000111000001001010100000001000011110011000" + "11000001111111001011000010001010001011010000111011111010101" + "01100000111110100010100111100111001101101100010100001111010" + "11100011100001100111001001110100011101110000100001100111111" + "00111000001010001100000100010100100101100101111011111010001" + "11001011110100101111111000101000111011111100010100001010101" + "10001000111011111010100011010111101101101010011010011110001" + "11101010101010101011101010101010101010111010101010101011111" + }, + /* 27*/ { UNICODE_MODE, 2, 32, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCD", 0, 17, 139, 1, "R17x139-M with max 108 alphanumerics", + "1111111010101010101010101011101010101010101010101010101110101010101010101010101010111010101010101010101010101011101010101010101010101010111" + "1000001001001010010000011110111001001010110101010100011010100010100111011001101000101010101100000100100110001010101000100111011010000101001" + "1011101011101001000100010111100111100100100101100010111110100010110000000011101010111111111001010011110000010011101011000101000000010001001" + "1011101001001010011011111000100110001100100000001101000001000100101101001100011111001001100011101000011011111100011000101100010110111010010" + "1011101000010011111100010001011011011101010000111000011111011101000101100100100101010000110110001101001010111101111100000110011111111111011" + "1000001000010100010000011000101101000110011001100110110010101011010011010101111010101010010100100110100000110110101111011011011011100101010" + "1111111010110001111001010111010110101110100000000000110100000011111001011111111010110111100111000011110101100001100011111001100001010001101" + "0000000011111011001111110010100100001100101010101101000011010110100100001100000010100111010100101010011111001000010110100100101100100100000" + "1100110101110001011110010111111000100011110010001010011111101100000110101100100011011100011011011000001010001101111100000110000111011110011" + "0101010100000101010000011010101100001001010100000000110001111111010011011010110010000010010111010001010000110110101011010001010110000100100" + "1001011101000001111001110101010101001100110111010001010100010111111001110000110001010101110010110000000001100011010011111000010001011010101" + "0011011000000111000111000100101000100110010001010111110010101110110100110110100110101101110001001110111111001000010110100101000000011011110" + "1110111001100101010110010111110100010000101110101010101110101100101110011111000010011100111000011110001011001101011100010100101100110111111" + "0100010111111011011100011000111100111111001001111000101010111111010010011011010011000000010010111101010000011000110001110010010101100110001" + "1001111110101110110000100111110101011101100010011001101111010111011000010000110101111000000110110100010011000111111100101110011011110110101" + "1011101011001101111111100110101100110110111011010111001011101011000100010101100000101110111100000010011100011010100100011000001100000110001" "1110101010101010101010101011101010101010101010101010101110101010101010101010101010111010101010101010101010101011101010101010101010101011111" }, }; @@ -2750,6 +3054,12 @@ static void test_rmqr_encode(int index, int generate, int debug) { int i, length, ret; struct zint_symbol *symbol; + char escaped[1024]; + char bwipp_buf[32768]; + char bwipp_msg[1024]; + + int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise + testStart("test_rmqr_encode"); for (i = 0; i < data_size; i++) { @@ -2759,26 +3069,38 @@ static void test_rmqr_encode(int index, int generate, int debug) { symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); - length = testUtilSetSymbol(symbol, BARCODE_RMQR, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug); + length = testUtilSetSymbol(symbol, BARCODE_RMQR, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, ZINT_FULL_MULTIBYTE, -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\", %d, %d, %s, %d, %d, \"%s\",\n", - i, testUtilInputModeName(data[i].input_mode), data[i].data, data[i].option_1, data[i].option_2, testUtilErrorName(data[i].ret), - symbol->rows, symbol->width, data[i].comment); + printf(" /*%3d*/ { %s, %d, %d, \"%s\", %s, %d, %d, %d, \"%s\",\n", + i, testUtilInputModeName(data[i].input_mode), data[i].option_1, data[i].option_2, + testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), testUtilErrorName(data[i].ret), + symbol->rows, symbol->width, data[i].bwipp_cmp, data[i].comment); testUtilModulesPrint(symbol, " ", "\n"); printf(" },\n"); } else { if (ret < ZINT_ERROR) { + int width, row; 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); + 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, data[i].option_1, data[i].option_2, -1, 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, data[i].option_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(symbol->symbology), ret, bwipp_msg, bwipp_buf, data[i].expected); + } } } } diff --git a/backend/tests/test_raster.c b/backend/tests/test_raster.c index e2853d50..2430dfb7 100644 --- a/backend/tests/test_raster.c +++ b/backend/tests/test_raster.c @@ -782,7 +782,7 @@ static void test_draw_string_wrap(int index, int debug) { int symbology; int output_options; char *data; - char* text; + char *text; float expected_height; int expected_rows; @@ -931,6 +931,7 @@ static void test_scale(int index, int debug) { char *data; char *composite; + int ret_raster; float expected_height; int expected_rows; int expected_width; @@ -943,30 +944,32 @@ static void test_scale(int index, int debug) { }; // s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<")) struct item data[] = { - /* 0*/ { BARCODE_PDF417, -1, -1, -1, 0, "1", "", 18, 6, 103, 206, 36, 0, 36, 170, 14 }, // With no scaling - /* 1*/ { BARCODE_PDF417, -1, -1, -1, 0.6, "1", "", 18, 6, 103, 206 * 0.6, 36 * 0.6, 0 /*set_row*/, 36 * 0.6, 170 * 0.6 + 1, 14 * 0.6 }, // +1 set_col due to some scaling inversion difference - /* 2*/ { BARCODE_PDF417, -1, -1, -1, 1.2, "1", "", 18, 6, 103, 206 * 1.2, 36 * 1.2, 0 /*set_row*/, 36 * 1.2, 170 * 1.2 + 1, 14 * 1.2 }, // +1 set_col due to some scaling inversion difference - /* 3*/ { BARCODE_PDF417, -1, -1, -1, 0.5, "1", "", 18, 6, 103, 206 * 0.5, 36 * 0.5, 0 /*set_row*/, 36 * 0.5, 170 * 0.5, 14 * 0.5 }, - /* 4*/ { BARCODE_PDF417, -1, -1, -1, 1.0, "1", "", 18, 6, 103, 206 * 1.0, 36 * 1.0, 0 /*set_row*/, 36 * 1.0, 170 * 1.0, 14 * 1.0 }, - /* 5*/ { BARCODE_PDF417, -1, -1, -1, 1.5, "1", "", 18, 6, 103, 206 * 1.5, 36 * 1.5, 0 /*set_row*/, 36 * 1.5, 170 * 1.5, 14 * 1.5 }, - /* 6*/ { BARCODE_PDF417, -1, -1, -1, 2.0, "1", "", 18, 6, 103, 206 * 2.0, 36 * 2.0, 0 /*set_row*/, 36 * 2.0, 170 * 2.0, 14 * 2.0 }, - /* 7*/ { BARCODE_PDF417, -1, -1, -1, 2.5, "1", "", 18, 6, 103, 206 * 2.5, 36 * 2.5, 0 /*set_row*/, 36 * 2.5, 170 * 2.5, 14 * 2.5 }, - /* 8*/ { BARCODE_PDF417, -1, -1, -1, 3.0, "1", "", 18, 6, 103, 206 * 3.0, 36 * 3.0, 0 /*set_row*/, 36 * 3.0, 170 * 3.0, 14 * 3.0 }, - /* 9*/ { BARCODE_PDF417, -1, 3, BARCODE_BOX, 0, "1", "", 18, 6, 103, 218, 48, 0 /*set_row*/, 48, 176, 14 }, // With no scaling - /* 10*/ { BARCODE_PDF417, -1, 3, BARCODE_BOX, 0.6, "1", "", 18, 6, 103, 218 * 0.6, 48 * 0.6, 0 /*set_row*/, 48 * 0.6, 176 * 0.6 + 1, 14 * 0.6 }, // +1 set_col due to some scaling inversion difference - /* 11*/ { BARCODE_PDF417, -1, 3, BARCODE_BOX, 1.6, "1", "", 18, 6, 103, 218 * 1.6, 48 * 1.6, 0 /*set_row*/, 48 * 1.6, 176 * 1.6 + 1, 14 * 1.6 }, // +1 set_col due to some scaling inversion difference - /* 12*/ { BARCODE_PDF417, -1, 3, BARCODE_BOX, 1.5, "1", "", 18, 6, 103, 218 * 1.5, 48 * 1.5, 0 /*set_row*/, 48 * 1.5, 176 * 1.5, 14 * 1.5 }, - /* 13*/ { BARCODE_PDF417, -1, 3, BARCODE_BOX, 2.5, "1", "", 18, 6, 103, 218 * 2.5, 48 * 2.5, 0 /*set_row*/, 48 * 2.5, 176 * 2.5, 14 * 2.5 }, - /* 14*/ { BARCODE_PDF417, -1, 3, OUT_BUFFER_INTERMEDIATE, 1.3, "1", "", 18, 6, 103, 206 * 1.3, 36 * 1.3, 0 /*set_row*/, 36 * 1.3, 170 * 1.3 + 1, 14 * 1.3 }, // +1 set_col due to some scaling inversion difference - /* 15*/ { BARCODE_DBAR_LTD, -1, -1, BOLD_TEXT, 0, "123456789012", "", 50, 1, 79, 158, 116, 104 /*set_row*/, 114, 20, 2 }, // With no scaling - /* 16*/ { BARCODE_DBAR_LTD, -1, -1, BOLD_TEXT, 1.5, "123456789012", "", 50, 1, 79, 158 * 1.5, 116 * 1.5, 104 * 1.5 /*set_row*/, 114 * 1.5, 20 * 1.5, 1 * 1.5 }, - /* 17*/ { BARCODE_DBAR_LTD, -1, -1, BOLD_TEXT, 2.0, "123456789012", "", 50, 1, 79, 158 * 2.0, 116 * 2.0, 104 * 2.0 /*set_row*/, 114 * 2.0, 20 * 2.0, 1 * 2.0 }, - /* 18*/ { BARCODE_DBAR_LTD, -1, -1, BOLD_TEXT, 3.5, "123456789012", "", 50, 1, 79, 158 * 3.5, 116 * 3.5, 104 * 3.5 /*set_row*/, 114 * 3.5, 20 * 3.5, 1 * 3.5 }, - /* 19*/ { BARCODE_UPCA, -1, -1, -1, 0, "12345678904", "", 50, 1, 95, 226, 116, 104 /*set_row*/, 114, 5, 2 }, // With no scaling - /* 20*/ { BARCODE_UPCA, -1, -1, -1, 2.5, "12345678904", "", 50, 1, 95, 226 * 2.5, 116 * 2.5, 104 * 2.5 /*set_row*/, 114 * 2.5, 5 * 2.5, 2 * 2.5 }, - /* 21*/ { BARCODE_UPCA, -1, -1, -1, 4.5, "12345678904", "", 50, 1, 95, 226 * 4.5, 116 * 4.5, 104 * 4.5 /*set_row*/, 114 * 4.5, 5 * 4.5, 2 * 4.5 }, - /* 22*/ { BARCODE_UPCE_CC, -1, -1, -1, 0, "1234567", "[17]010615[10]A123456\"", 50, 10, 55, 142, 116, 104 /*set_row*/, 115, 11, 2 }, // With no scaling - /* 23*/ { BARCODE_UPCE_CC, -1, -1, -1, 2.0, "1234567", "[17]010615[10]A123456\"", 50, 10, 55, 142 * 2, 116 * 2, 104 * 2 + 1 /*set_row*/, 115 * 2, 11 * 2, 2 * 2 }, // +1 set_row + /* 0*/ { BARCODE_PDF417, -1, -1, -1, 0, "1", "", 0, 18, 6, 103, 206, 36, 0, 36, 170, 14 }, // With no scaling + /* 1*/ { BARCODE_PDF417, -1, -1, -1, 0.6, "1", "", 0, 18, 6, 103, 206 * 0.6, 36 * 0.6, 0 /*set_row*/, 36 * 0.6, 170 * 0.6 + 1, 14 * 0.6 }, // +1 set_col due to some scaling inversion difference + /* 2*/ { BARCODE_PDF417, -1, -1, -1, 1.2, "1", "", 0, 18, 6, 103, 206 * 1.2, 36 * 1.2, 0 /*set_row*/, 36 * 1.2, 170 * 1.2 + 1, 14 * 1.2 }, // +1 set_col due to some scaling inversion difference + /* 3*/ { BARCODE_PDF417, -1, -1, -1, 0.5, "1", "", 0, 18, 6, 103, 206 * 0.5, 36 * 0.5, 0 /*set_row*/, 36 * 0.5, 170 * 0.5, 14 * 0.5 }, + /* 4*/ { BARCODE_PDF417, -1, -1, -1, 1.0, "1", "", 0, 18, 6, 103, 206 * 1.0, 36 * 1.0, 0 /*set_row*/, 36 * 1.0, 170 * 1.0, 14 * 1.0 }, + /* 5*/ { BARCODE_PDF417, -1, -1, -1, 1.5, "1", "", 0, 18, 6, 103, 206 * 1.5, 36 * 1.5, 0 /*set_row*/, 36 * 1.5, 170 * 1.5, 14 * 1.5 }, + /* 6*/ { BARCODE_PDF417, -1, -1, -1, 2.0, "1", "", 0, 18, 6, 103, 206 * 2.0, 36 * 2.0, 0 /*set_row*/, 36 * 2.0, 170 * 2.0, 14 * 2.0 }, + /* 7*/ { BARCODE_PDF417, -1, -1, -1, 2.5, "1", "", 0, 18, 6, 103, 206 * 2.5, 36 * 2.5, 0 /*set_row*/, 36 * 2.5, 170 * 2.5, 14 * 2.5 }, + /* 8*/ { BARCODE_PDF417, -1, -1, -1, 3.0, "1", "", 0, 18, 6, 103, 206 * 3.0, 36 * 3.0, 0 /*set_row*/, 36 * 3.0, 170 * 3.0, 14 * 3.0 }, + /* 9*/ { BARCODE_PDF417, -1, 3, BARCODE_BOX, 0, "1", "", 0, 18, 6, 103, 218, 48, 0 /*set_row*/, 48, 176, 14 }, // With no scaling + /* 10*/ { BARCODE_PDF417, -1, 3, BARCODE_BOX, 0.6, "1", "", 0, 18, 6, 103, 218 * 0.6, 48 * 0.6, 0 /*set_row*/, 48 * 0.6, 176 * 0.6 + 1, 14 * 0.6 }, // +1 set_col due to some scaling inversion difference + /* 11*/ { BARCODE_PDF417, -1, 3, BARCODE_BOX, 1.6, "1", "", 0, 18, 6, 103, 218 * 1.6, 48 * 1.6, 0 /*set_row*/, 48 * 1.6, 176 * 1.6 + 1, 14 * 1.6 }, // +1 set_col due to some scaling inversion difference + /* 12*/ { BARCODE_PDF417, -1, 3, BARCODE_BOX, 1.5, "1", "", 0, 18, 6, 103, 218 * 1.5, 48 * 1.5, 0 /*set_row*/, 48 * 1.5, 176 * 1.5, 14 * 1.5 }, + /* 13*/ { BARCODE_PDF417, -1, 3, BARCODE_BOX, 2.5, "1", "", 0, 18, 6, 103, 218 * 2.5, 48 * 2.5, 0 /*set_row*/, 48 * 2.5, 176 * 2.5, 14 * 2.5 }, + /* 14*/ { BARCODE_PDF417, -1, 3, OUT_BUFFER_INTERMEDIATE, 1.3, "1", "", 0, 18, 6, 103, 206 * 1.3, 36 * 1.3, 0 /*set_row*/, 36 * 1.3, 170 * 1.3 + 1, 14 * 1.3 }, // +1 set_col due to some scaling inversion difference + /* 15*/ { BARCODE_DBAR_LTD, -1, -1, BOLD_TEXT, 0, "123456789012", "", 0, 50, 1, 79, 158, 116, 104 /*set_row*/, 114, 20, 2 }, // With no scaling + /* 16*/ { BARCODE_DBAR_LTD, -1, -1, BOLD_TEXT, 1.5, "123456789012", "", 0, 50, 1, 79, 158 * 1.5, 116 * 1.5, 104 * 1.5 /*set_row*/, 114 * 1.5, 20 * 1.5, 1 * 1.5 }, + /* 17*/ { BARCODE_DBAR_LTD, -1, -1, BOLD_TEXT, 2.0, "123456789012", "", 0, 50, 1, 79, 158 * 2.0, 116 * 2.0, 104 * 2.0 /*set_row*/, 114 * 2.0, 20 * 2.0, 1 * 2.0 }, + /* 18*/ { BARCODE_DBAR_LTD, -1, -1, BOLD_TEXT, 3.5, "123456789012", "", 0, 50, 1, 79, 158 * 3.5, 116 * 3.5, 104 * 3.5 /*set_row*/, 114 * 3.5, 20 * 3.5, 1 * 3.5 }, + /* 19*/ { BARCODE_UPCA, -1, -1, -1, 0, "12345678904", "", 0, 50, 1, 95, 226, 116, 104 /*set_row*/, 114, 5, 2 }, // With no scaling + /* 20*/ { BARCODE_UPCA, -1, -1, -1, 2.5, "12345678904", "", 0, 50, 1, 95, 226 * 2.5, 116 * 2.5, 104 * 2.5 /*set_row*/, 114 * 2.5, 5 * 2.5, 2 * 2.5 }, + /* 21*/ { BARCODE_UPCA, -1, -1, -1, 4.5, "12345678904", "", 0, 50, 1, 95, 226 * 4.5, 116 * 4.5, 104 * 4.5 /*set_row*/, 114 * 4.5, 5 * 4.5, 2 * 4.5 }, + /* 22*/ { BARCODE_UPCE_CC, -1, -1, -1, 0, "1234567", "[17]010615[10]A123456\"", 0, 50, 10, 55, 142, 116, 104 /*set_row*/, 115, 11, 2 }, // With no scaling + /* 23*/ { BARCODE_UPCE_CC, -1, -1, -1, 2.0, "1234567", "[17]010615[10]A123456\"", 0, 50, 10, 55, 142 * 2, 116 * 2, 104 * 2 + 1 /*set_row*/, 115 * 2, 11 * 2, 2 * 2 }, // +1 set_row + /* 24*/ { BARCODE_MAXICODE, -1, -1, -1, 0, "1234567890", "", 0, 165, 33, 30, 299, 298, 3 /*set_row*/, 7, 10, 9 }, // With no scaling + /* 25*/ { BARCODE_MAXICODE, -1, -1, -1, 0.1, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 165, 33, 30, 60, 65, 0 /*set_row*/, 1, 3, 1 }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -1000,10 +1003,10 @@ static void test_scale(int index, int debug) { length = (int) strlen(text); ret = ZBarcode_Encode(symbol, (unsigned char *) text, length); - assert_zero(ret, "i:%d ZBarcode_Encode(%d) ret %d != 0 %s\n", i, data[i].symbology, ret, symbol->errtxt); + assert_zero(ret, "i:%d ZBarcode_Encode(%d) ret %d != 0 (%s)\n", i, data[i].symbology, ret, symbol->errtxt); ret = ZBarcode_Buffer(symbol, 0); - assert_zero(ret, "i:%d ZBarcode_Buffer(%d) ret %d != 0\n", i, data[i].symbology, ret); + assert_equal(ret, data[i].ret_raster, "i:%d ZBarcode_Buffer(%d) ret %d != %d (%s)\n", i, data[i].symbology, ret, data[i].ret_raster, symbol->errtxt); assert_nonnull(symbol->bitmap, "i:%d (%d) symbol->bitmap NULL\n", i, data[i].symbology); if (index != -1 && (debug & ZINT_DEBUG_TEST_PRINT)) testUtilBitmapPrint(symbol, NULL, NULL); // ZINT_DEBUG_TEST_PRINT 16 @@ -1015,7 +1018,7 @@ static void test_scale(int index, int debug) { assert_equal(symbol->bitmap_height, data[i].expected_bitmap_height, "i:%d (%d) symbol->bitmap_height %d != %d\n", i, data[i].symbology, symbol->bitmap_height, data[i].expected_bitmap_height); ret = ZBarcode_Print(symbol, 0); - assert_zero(ret, "i:%d ZBarcode_Print(%d) ret %d != 0\n", i, data[i].symbology, ret); + assert_equal(ret, data[i].ret_raster, "i:%d ZBarcode_Print(%d) ret %d != %d (%s)\n", i, data[i].symbology, ret, data[i].ret_raster, symbol->errtxt); assert_zero(remove(symbol->outfile), "i:%d remove(%s) != 0\n", i, symbol->outfile); assert_nonzero(symbol->bitmap_height >= data[i].expected_set_rows, "i:%d (%d) symbol->bitmap_height %d < expected_set_rows %d\n", diff --git a/backend/tests/test_svg.c b/backend/tests/test_svg.c index 43a42850..506bcfe0 100644 --- a/backend/tests/test_svg.c +++ b/backend/tests/test_svg.c @@ -103,6 +103,7 @@ static void test_print(int index, int generate, int debug) { /* 46*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, -1, -1, 5, "", "", 0, "Your Data Here!", "", ZINT_WARN_NONCOMPLIANT, "pdf417_height5.svg" }, /* 47*/ { BARCODE_USPS_IMAIL, -1, -1, -1, -1, -1, -1, -1, -1, 7.75, "", "", 0, "12345678901234567890", "", 0, "imail_height7.75.svg" }, /* 48*/ { BARCODE_ULTRA, -1, 3, BARCODE_BOX, 2, 2, -1, -1, -1, 0, "FF0000", "0000FF", 0, "12345678901234567890", "", 0, "ultra_fgbg_hvwsp2_box3.svg" }, + /* 49*/ { BARCODE_TELEPEN, -1, -1, -1, -1, -1, -1, -1, -1, 0.4, "", "", 180, "A", "", 0, "telepen_height0.4_rotate_180.svg" }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; diff --git a/backend/tests/test_tif.c b/backend/tests/test_tif.c index bcfdcd7d..4058e340 100644 --- a/backend/tests/test_tif.c +++ b/backend/tests/test_tif.c @@ -75,6 +75,16 @@ static void test_pixel_plot(int index, int debug) { /* 25*/ { 3, 2048, "10", 1, 0, 0 }, // Strip Count 4, Rows Per Strip 682 ((3 * 682 + 2) * 4 == 8192) /* 26*/ { 2049, 4, "10", 1, 1, 0 }, // Strip Count 4, Rows Per Strip 1 (2049 * 1 * 4 == 8196) - large rows in 1 strip, even if > 8192 /* 27*/ { 4, 2049, "10", 1, 0, 0 }, // Strip Count 5, Rows Per Strip 512 ((4 * 512 + 1) * 4 == 8196) + /* 28*/ { 4096, 1, "10", 1, 1, 0 }, // Strip Count 1, Rows Per Strip 1 + /* 29*/ { 1, 4096, "10", 1, 0, 0 }, // Strip Count 2, Rows Per Strip 2048 + /* 30*/ { 4096, 2, "10", 1, 1, 0 }, // Strip Count 2, Rows Per Strip 1 + /* 31*/ { 2, 4096, "10", 1, 0, 0 }, // Strip Count 4, Rows Per Strip 1024 + /* 32*/ { 8192, 2, "10", 1, 1, 0 }, // Strip Count 2, Rows Per Strip 1 + /* 33*/ { 2, 8192, "10", 1, 0, 0 }, // Strip Count 8, Rows Per Strip 1024 + /* 34*/ { ZINT_MAX_DATA_LEN, 1, "10", 1, 1, 0 }, // Strip Count 1, Rows Per Strip 1 + /* 35*/ { 1, ZINT_MAX_DATA_LEN, "10", 1, 0, 0 }, // Strip Count 9, Rows Per Strip 2048 + /* 36*/ { ZINT_MAX_DATA_LEN, 2, "10", 1, 1, 0 }, // Strip Count 2, Rows Per Strip 1 + /* 37*/ { 2, ZINT_MAX_DATA_LEN, "10", 1, 0, 0 }, // Strip Count 17, Rows Per Strip 1024 }; int data_size = ARRAY_SIZE(data); int i, ret; diff --git a/backend/tests/test_ultra.c b/backend/tests/test_ultra.c index 42f08f9b..6ddbec5a 100644 --- a/backend/tests/test_ultra.c +++ b/backend/tests/test_ultra.c @@ -31,6 +31,83 @@ #include "testcommon.h" +static void test_large(int index, int debug) { + + struct item { + int option_1; + int option_3; + char *pattern; + int length; + int ret; + int expected_rows; + int expected_width; + }; + // s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<")) + struct item data[] = { + /* 0*/ { -1, -1, "1", 252, 0, 31, 66 }, // Default EC2 + /* 1*/ { -1, -1, "1", 253, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 2*/ { -1, -1, "1", ZINT_MAX_DATA_LEN, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 3*/ { -1, -1, "A", 252, 0, 31, 66 }, + /* 4*/ { -1, -1, "A", 253, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 5*/ { -1, -1, "\200", 252, 0, 31, 66 }, + /* 6*/ { -1, -1, "\200", 253, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 7*/ { -1, -1, "\001", 252, 0, 31, 66 }, + /* 8*/ { -1, -1, "\001", 253, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 9*/ { -1, ULTRA_COMPRESSION, "1", 504, 0, 31, 66 }, + /* 10*/ { -1, ULTRA_COMPRESSION, "1", 505, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 11*/ { -1, ULTRA_COMPRESSION, "A", 375, 0, 31, 66 }, + /* 12*/ { -1, ULTRA_COMPRESSION, "A", 376, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 13*/ { -1, ULTRA_COMPRESSION, "\200", 252, 0, 31, 66 }, + /* 14*/ { -1, ULTRA_COMPRESSION, "\200", 253, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 15*/ { -1, ULTRA_COMPRESSION, "\001", 252, 0, 31, 66 }, + /* 16*/ { -1, ULTRA_COMPRESSION, "\001", 253, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 17*/ { 1, -1, "1", 276, 0, 31, 66 }, + /* 18*/ { 1, -1, "1", 277, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 19*/ { 2, -1, "1", 263, 0, 31, 66 }, + /* 20*/ { 2, -1, "1", 264, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 21*/ { 3, -1, "1", 252, 0, 31, 66 }, + /* 22*/ { 3, -1, "1", 253, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 23*/ { 4, -1, "1", 234, 0, 31, 66 }, + /* 24*/ { 4, -1, "1", 235, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 25*/ { 5, -1, "1", 220, 0, 31, 66 }, + /* 26*/ { 5, -1, "1", 221, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 27*/ { 6, -1, "1", 202, 0, 31, 66 }, + /* 28*/ { 6, -1, "1", 203, ZINT_ERROR_TOO_LONG, -1, -1 }, + }; + int data_size = ARRAY_SIZE(data); + int i, length, ret; + struct zint_symbol *symbol; + + char data_buf[ZINT_MAX_DATA_LEN + 1]; + + testStart("test_large"); + + for (i = 0; i < data_size; i++) { + + if (index != -1 && i != index) continue; + + symbol = ZBarcode_Create(); + assert_nonnull(symbol, "Symbol not created\n"); + + testUtilStrCpyRepeat(data_buf, data[i].pattern, data[i].length); + assert_equal(data[i].length, (int) strlen(data_buf), "i:%d length %d != strlen(data_buf) %d\n", i, data[i].length, (int) strlen(data_buf)); + + length = testUtilSetSymbol(symbol, BARCODE_ULTRA, -1 /*input_mode*/, -1 /*eci*/, data[i].option_1, -1, data[i].option_3, -1 /*output_options*/, data_buf, data[i].length, debug); + + ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length); + assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->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->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width); + } + + ZBarcode_Delete(symbol); + } + + testFinish(); +} + static void test_reader_init(int index, int generate, int debug) { struct item { @@ -59,6 +136,7 @@ static void test_reader_init(int index, int generate, int debug) { for (i = 0; i < data_size; i++) { if (index != -1 && i != index) continue; + if ((debug & ZINT_DEBUG_TEST_PRINT) && !(debug & ZINT_DEBUG_TEST_LESS_NOISY)) printf("i:%d\n", i); symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); @@ -111,14 +189,14 @@ static void test_input(int index, int generate, int debug) { /* 6*/ { UNICODE_MODE, 0, -1, -1, "ABC", 0, "(4) 257 65 66 67", "" }, /* 7*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "ABC", 0, "(4) 272 65 66 67", "" }, /* 8*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "ULTRACODE_123456789!", 0, "(17) 272 85 76 84 82 65 67 79 68 69 95 140 162 184 206 57 33", "" }, - /* 9*/ { UNICODE_MODE, 0, -1, -1, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 0, "(250) 257 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65", "249 chars EC2" }, - /* 10*/ { UNICODE_MODE, 0, -1, -1, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", ZINT_ERROR_TOO_LONG, "Error 591: Data too long for selected error correction capacity", "250 chars EC2" }, - /* 11*/ { UNICODE_MODE, 0, 1, -1, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 0, "(274) 257 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65", "273 chars EC0" }, - /* 12*/ { UNICODE_MODE, 0, 1, -1, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", ZINT_ERROR_TOO_LONG, "Error 591: Data too long for selected error correction capacity", "274 chars EC0" }, + /* 9*/ { UNICODE_MODE, 0, -1, -1, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 0, "(253) 257 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65", "252 chars EC2" }, + /* 10*/ { UNICODE_MODE, 0, -1, -1, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", ZINT_ERROR_TOO_LONG, "Error 591: Data too long for selected error correction capacity", "253 chars EC2" }, + /* 11*/ { UNICODE_MODE, 0, 1, -1, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 0, "(277) 257 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65", "276 chars EC0" }, + /* 12*/ { UNICODE_MODE, 0, 1, -1, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", ZINT_ERROR_TOO_LONG, "Error 591: Data too long for selected error correction capacity", "277 chars EC0" }, /* 13*/ { UNICODE_MODE, 0, -1, -1, "é", 0, "(2) 257 233", "" }, /* 14*/ { UNICODE_MODE, 0, -1, -1, "β", ZINT_WARN_USES_ECI, "Warning (2) 263 226", "" }, /* 15*/ { UNICODE_MODE, 9, -1, -1, "β", 0, "(2) 263 226", "" }, - /* 16*/ { UNICODE_MODE, 9, -1, -1, "βAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 0, "(250) 263 226 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65", "249 chars EC2" }, + /* 16*/ { UNICODE_MODE, 9, -1, -1, "βAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 0, "(253) 263 226 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65", "249 chars EC2" }, /* 17*/ { UNICODE_MODE, 9, -1, ULTRA_COMPRESSION, "A", 0, "(2) 272 65", "Note ECI ignored and not outputted if ULTRA_COMPRESSION and all ASCII" }, /* 18*/ { UNICODE_MODE, 15, -1, -1, "Ŗ", 0, "(2) 268 170", "" }, /* 19*/ { DATA_MODE, 898, -1, -1, "\001\002\003\004\377", 0, "(7) 278 130 1 2 3 4 255", "" }, @@ -148,6 +226,14 @@ static void test_input(int index, int generate, int debug) { /* 43*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "Atel:aAa", 0, "(8) 272 275 6 89 275 148 0 42", "Mode: c (8)" }, /* 44*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "tel:AAaa", 0, "(8) 272 275 271 161 6 28 262 118", "Mode: c (8)" }, /* 45*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "AAaatel:aA", 0, "(10) 272 276 0 42 0 41 118 46 6 156", "Mode: c (10)" }, + /* 46*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "émailto:étel:éfile:éhttp://éhttps://éftp://", 0, "(18) 257 233 276 282 233 277 282 233 278 282 233 279 282 233 280 282 233 281", "Mode: 8ccccccc8cccc8ccccc8ccccccc8cccccccc8cccccc (43)" }, + /* 47*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "éhttp://www.url.com", 0, "(9) 257 233 279 269 186 113 81 45 252", "Mode: 8cccccccccccccccccc (19)" }, + /* 48*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "éhttps://www.url.com", 0, "(9) 257 233 280 269 186 113 81 45 252", "Mode: 8ccccccccccccccccccc (20)" }, + /* 49*/ { UNICODE_MODE, 0, -1, -1, "http://url.com", 0, "(8) 281 117 114 108 46 99 111 109", "Mode: 8888888 (7)" }, + /* 50*/ { UNICODE_MODE, 0, -1, -1, "https://url.com", 0, "(8) 282 117 114 108 46 99 111 109", "Mode: 8888888 (7)" }, + /* 51*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "http://url.com", 0, "(6) 281 262 133 216 269 251", "Mode: ccccccc (7)" }, + /* 52*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "https://url.com", 0, "(6) 282 262 133 216 269 251", "Mode: ccccccc (7)" }, + /* 53*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "{", 0, "(2) 272 123", "Mode: a (1)" }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -160,6 +246,7 @@ static void test_input(int index, int generate, int debug) { for (i = 0; i < data_size; i++) { if (index != -1 && i != index) continue; + if ((debug & ZINT_DEBUG_TEST_PRINT) && !(debug & ZINT_DEBUG_TEST_LESS_NOISY)) printf("i:%d\n", i); symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); @@ -197,11 +284,14 @@ static void test_encode(int index, int generate, int debug) { int expected_rows; int expected_width; + int bwipp_cmp; char *comment; char *expected; }; + // Based on AIMD/TSC15032-43 (v 0.99c), with values updated from BWIPP update 2021-07-14 + // https://github.com/bwipp/postscriptbarcode/commit/4255810845fa8d45c6192dd30aee1fdad1aaf0cc struct item data[] = { - /* 0*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "ULTRACODE_123456789!", 0, 13, 22, "AIMD/TSC15032-43 Figure G.1 **NOT SAME** different compression", + /* 0*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "ULTRACODE_123456789!", 0, 13, 22, 1, "AIMD/TSC15032-43 Figure G.1 **NOT SAME** different compression", "7777777777777777777777" "7857865353533131551857" "7767853515611616136717" @@ -216,7 +306,7 @@ static void test_encode(int index, int generate, int debug) { "7817851653331136333857" "7777777777777777777777" }, - /* 1*/ { UNICODE_MODE, 0, -1, -1, "ULTRACODE_123456789!", 0, 13, 24, "AIMD/TSC15032-43 Figure G.1 **NOT SAME** no compression; verified against bwipp", + /* 1*/ { UNICODE_MODE, 0, -1, -1, "ULTRACODE_123456789!", 0, 13, 24, 1, "AIMD/TSC15032-43 Figure G.1 **NOT SAME** no compression", "777777777777777777777777" "785786533153313111181157" "776783361661161666676617" @@ -231,7 +321,7 @@ static void test_encode(int index, int generate, int debug) { "781786166533113663683357" "777777777777777777777777" }, - /* 2*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "HEIMASÍÐA KENNARAHÁSKÓLA ÍSLANDS", 0, 19, 23, "AIMD/TSC15032-43 Figure G.2 **NOT SAME** different compression", + /* 2*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "HEIMASÍÐA KENNARAHÁSKÓLA ÍSLANDS", 0, 19, 23, 1, "AIMD/TSC15032-43 Figure G.2 **NOT SAME** different compression", "77777777777777777777777" "78878663151561555158557" "77878315565635366667617" @@ -252,7 +342,7 @@ static void test_encode(int index, int generate, int debug) { "78878333656153153368617" "77777777777777777777777" }, - /* 3*/ { DATA_MODE, 0, -1, -1, "\110\105\111\115\101\123\315\320\101\040\113\105\116\116\101\122\101\110\301\123\113\323\114\101\040\315\123\114\101\116\104\123", 0, 19, 23, "AIMD/TSC15032-43 Figure G.2 **NOT SAME** no compression; verified against bwipp", + /* 3*/ { DATA_MODE, 0, -1, -1, "\110\105\111\115\101\123\315\320\101\040\113\105\116\116\101\122\101\110\301\123\113\323\114\101\040\315\123\114\101\116\104\123", 0, 19, 23, 1, "AIMD/TSC15032-43 Figure G.2 **NOT SAME** no compression", "77777777777777777777777" "78878633151153313358137" "77878315666661161167617" @@ -273,7 +363,7 @@ static void test_encode(int index, int generate, int debug) { "78878361115516163138317" "77777777777777777777777" }, - /* 4*/ { UNICODE_MODE, 10, -1, ULTRA_COMPRESSION, "אולטרה-קוד1234", 0, 13, 19, "AIMD/TSC15032-43 Figure G.3 Same except DCC correct whereas DCC in Figure G.3 is incorrent", + /* 4*/ { UNICODE_MODE, 10, -1, ULTRA_COMPRESSION, "אולטרה-קוד1234", 0, 13, 19, 1, "AIMD/TSC15032-43 Figure G.3 Same except DCC correct whereas DCC in Figure G.3 is incorrent", "7777777777777777777" "7857865565566616657" "7737853333613351517" @@ -288,7 +378,7 @@ static void test_encode(int index, int generate, int debug) { "7817851316355311357" "7777777777777777777" }, - /* 5*/ { DATA_MODE, 0, -1, -1, "\340\345\354\350\370\344\055\367\345\343\061\062\063\064", 0, 13, 20, "AIMD/TSC15032-43 Figure G.3 **NOT SAME** no compression; verified against bwipp", + /* 5*/ { DATA_MODE, 0, -1, -1, "\340\345\354\350\370\344\055\367\345\343\061\062\063\064", 0, 13, 20, 1, "AIMD/TSC15032-43 Figure G.3 **NOT SAME** no compression", "77777777777777777777" "78578611115666161157" "77678333656133516617" @@ -303,7 +393,7 @@ static void test_encode(int index, int generate, int debug) { "78178613653553116357" "77777777777777777777" }, - /* 6*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "https://aimglobal.org/jcrv3tX", 0, 13, 20, "AIMD/TSC15032-43 Figure G.4a **NOT SAME** different compression; also DCC incorrect in figure", + /* 6*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "https://aimglobal.org/jcrv3tX", 0, 13, 20, 1, "AIMD/TSC15032-43 Figure G.4a **NOT SAME** different compression; also DCC incorrect in figure", "77777777777777777777" "78578655115631563137" "77678563356513315617" @@ -318,7 +408,7 @@ static void test_encode(int index, int generate, int debug) { "78178163363613633157" "77777777777777777777" }, - /* 7*/ { GS1_MODE, 0, -1, -1, "[01]03453120000011[17]121125[10]ABCD1234", 0, 13, 23, "AIMD/TSC15032-43 Figure G.6 **NOT SAME** different compression and ECC; also DCC incorrect in figure", + /* 7*/ { GS1_MODE, 0, -1, -1, "[01]03453120000011[17]121125[10]ABCD1234", 0, 13, 23, 1, "AIMD/TSC15032-43 Figure G.6 **NOT SAME** different compression and ECC; also DCC incorrect in figure", "77777777777777777777777" "78578616535355353318157" "77678553116631616667617" @@ -333,7 +423,7 @@ static void test_encode(int index, int generate, int debug) { "78178335533356531518357" "77777777777777777777777" }, - /* 8*/ { UNICODE_MODE, 0, -1, -1, "A", 0, 13, 13, "Verified against bwipp", + /* 8*/ { UNICODE_MODE, 0, -1, -1, "A", 0, 13, 13, 1, "", "7777777777777" "7857863335517" "7717835163667" @@ -348,7 +438,22 @@ static void test_encode(int index, int generate, int debug) { "7817833536357" "7777777777777" }, - /* 9*/ { UNICODE_MODE, 0, 2, -1, "12345678901234567890123", 0, 13, 25, "Length 23 == 26 MCC (C) with EC1 so 7 ECC by Table 12", + /* 9*/ { UNICODE_MODE, 0, 2, -1, "1234567890123456789012", 0, 13, 24, 1, "Length 22 == 25 MCC (C) with EC1 so 6 ECC by Table 12", + "777777777777777777777777" + "785786663111111111181117" + "776783555536666666676667" + "783786113311333113383117" + "776785365155115351175357" + "783781136666363663683667" + "778787878787878787878787" + "786781313511111111181117" + "775785135666666666676637" + "781781666511333113383157" + "776783531656155561575517" + "781786155535516355186337" + "777777777777777777777777" + }, + /* 10*/ { UNICODE_MODE, 0, 2, -1, "12345678901234567890123", 0, 13, 25, 1, "Length 23 == 26 MCC (C) with EC1 so 7 ECC by Table 12", "7777777777777777777777777" "7857863655511111111811117" "7767831563666666666766667" @@ -363,7 +468,7 @@ static void test_encode(int index, int generate, int debug) { "7817835653363636636836657" "7777777777777777777777777" }, - /* 10*/ { UNICODE_MODE, 0, 1, -1, "1", 0, 13, 11, "Figure 3a min 2-row, EC0; verified against bwipp", + /* 11*/ { UNICODE_MODE, 0, 1, -1, "1", 0, 13, 11, 1, "Figure 3a min 2-row, EC0", "77777777777" "78578661517" "77178355667" @@ -378,114 +483,230 @@ static void test_encode(int index, int generate, int debug) { "78178365567" "77777777777" }, - /* 11*/ { UNICODE_MODE, 0, 6, -1, "123456789012345678901", 0, 13, 27, "Figure 3a max 2-row, EC5", - "777777777777777777777777777" - "785786316551651111181111117" - "771783535313166666676666667" - "783786166556351133381133317" - "771785311313665615575615557" - "786781655165353551683551637" - "778787878787878787878787877" - "783781165561111111181111117" - "771785336136536666676666637" - "783781113655351333181333157" - "775783635331635115375115367" - "781785553563556363686363637" - "777777777777777777777777777" + /* 12*/ { UNICODE_MODE, 0, 6, -1, "1234567890123456789012", 0, 13, 28, 0, "Figure 3a max 2-row, EC5 **NOT SAME** extra col due to BWIPP update 2021-07-14; BWIPP chooses 3 rows instead", + "7777777777777777777777777777" + "7857863331131511111811111157" + "7717835613316666666766666617" + "7837866555153511333811333157" + "7757853333361656155756155517" + "7867816166656535516835516357" + "7787878787878787878787878787" + "7837816551551111111811111117" + "7717855165135366666766666637" + "7837813613616513331813331157" + "7767836165151351153751153567" + "7817863633563563636863636637" + "7777777777777777777777777777" }, - /* 12*/ { UNICODE_MODE, 0, 6, -1, "1234567890123456789012345678901234567890123456789012", 0, 19, 36, "Figure 3b max 3-row, EC5", - "777777777777777777777777777777777777" - "788786363653513111181111111111111117" - "778783511165156356676666666666666667" - "788786155316333511383133133113313317" - "775785516633156156175515515361551557" - "781781335356661335686653331656665337" - "773787878787878787878787878787878787" - "785781313116156311181111111111111117" - "776786665563633166676666666666666667" - "788783316155566513381133133133113317" - "773785165316651651573615515515361557" - "781781556535515533186566653331656667" - "773787878787878787878787878787878787" - "786781333331113511181111111111111117" - "771785161113336666676666666666666657" - "788783313565163513381331133133133137" - "778785661613551651575153615515515317" - "788783155555336565383316566653331637" - "777777777777777777777777777777777777" + /* 13*/ { UNICODE_MODE, 0, 1, -1, "12345678901234567890123456789012345", 0, 19, 22, 1, "Figure 3b min 3-row, EC0 **NOT SAME** Zint min not same as real min as chooses lower rows first (would need row option)", + "7777777777777777777777" + "7887866511111111111817" + "7787833666666666666767" + "7887861513313311331837" + "7757855651551536155717" + "7837811565333165666857" + "7717878787878787878787" + "7857811111111111111857" + "7737855366666666666717" + "7887863113313313311857" + "7767816361551551536717" + "7817831556665333165857" + "7757878787878787878787" + "7867811111111111111817" + "7717855666666666666737" + "7887816133113313313817" + "7787863515361551551757" + "7887831331656665333867" + "7777777777777777777777" }, - /* 13*/ { UNICODE_MODE, 0, 6, -1, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123", 0, 25, 49, "Figure 3c max 4-row, EC5", - "7777777777777777777777777777777777777777777777777" - "7887861565635135151811111111111111181111111111117" - "7787835151513316566766666666666666676666666666667" - "7887861536666531351831331313313133183133131331317" - "7787856653153315566755156551565515675515655156557" - "7887813366335656655813565135651356581356513565137" - "7787878787878787878787878787878787878787878787877" - "7857836636366363311811111111111111181111111111117" - "7737855565651635656766666666666666676666666666667" - "7817861653316513563831313313133131383131331313317" - "7757856561153165131755131551315513175513155131557" - "7867863135615536653836663366633666383666336663367" - "7787878787878787878787878787878787878787878787877" - "7837856156651155111811111111111111181111111111117" - "7717815565563561566766666666666666676666666666667" - "7867866631136356613831313313133131383131331313317" - "7737831365663161551756551565515655175655156551567" - "7817865156355516135865135651356513586513565135657" - "7787878787878787878787878787878787878787878787877" - "7887853555355533511811111111111111181111111111117" - "7787835616631351166766666666666666676666666666657" - "7887863363316563613813313133131331381331313313167" - "7787831111653311551731551315513155173155131551357" - "7887816565561165166863366633666336686336663366637" - "7777777777777777777777777777777777777777777777777" + /* 14*/ { UNICODE_MODE, 0, 6, -1, "1234567890123456789012345678901234567890123456789012345", 0, 19, 38, 0, "Figure 3b max 3-row, EC5 **NOT SAME** extra col due to BWIPP update 2021-07-14; BWIPP chooses 4 rows instead", + "77777777777777777777777777777777777777" + "78878611311563611118111111111111111817" + "77878366156351555667666666666666666767" + "78878633333136131138313313311331331837" + "77578551555353555617551551536155155717" + "78178136611516613568665333165666533837" + "77678787878787878787878787878787878787" + "78178111165636331118111111111111111817" + "77678663533553616667666666666666666767" + "78878336161116361338113313313311331837" + "77378611355661535157361551551536155717" + "78178166536313613318656665333165666857" + "77578787878787878787878787878787878787" + "78678313563533551118111111111111111817" + "77178535616651666667666666666666666757" + "78878153331316151338133113313313311837" + "77878611116665665157515361551551536717" + "78878166553313356538331656665333165837" + "77777777777777777777777777777777777777" }, - /* 14*/ { UNICODE_MODE, 0, 6, -1, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", 0, 31, 66, "Figure 3d max 5-row, EC5 **NOT SAME** Max columns due to 282 limit is 60 not 61 as shown", + /* 15*/ { UNICODE_MODE, 0, 1, -1, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012", 0, 25, 30, 1, "Figure 3c min 4-row, EC0 **NOT SAME** Zint min not same as real min as chooses lower rows first (would need row option)", + "777777777777777777777777777777" + "788786511111111111181111111117" + "778783166666666666676666666667" + "788786513313133131383131331317" + "778785351565515655175655156557" + "788781135651356513586513565137" + "778787878787878787878787878787" + "785783311111111111181111111117" + "771781166666666666676666666667" + "786786613133131331381331313317" + "775781351315513155173155131557" + "783783566633666336686336663367" + "778787878787878787878787878787" + "786783511111111111181111111157" + "771786666666666666676666666617" + "785785513133131331381331313357" + "773781665515655156575156551517" + "781785551356513565183565135657" + "778787878787878787878787878787" + "788781111111111111181111111117" + "778785366666666666676666666637" + "788781133131331313381313313117" + "778786315513155131575131551357" + "788785533666336663386663366667" + "777777777777777777777777777777" + }, + /* 16*/ { UNICODE_MODE, 0, 6, -1, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456", 0, 25, 50, 0, "Figure 3c max 4-row **NOT SAME** extra col due to BWIPP update 2021-07-14; BWIPP chooses 5 rows instead", + "77777777777777777777777777777777777777777777777777" + "78878631533313135518111111111111111811111111111117" + "77878315116161313667666666666666666766666666666667" + "78878656365333166518313313133131331831331313313137" + "77878561133666533667551565515655156755156551565517" + "78878156661531351558135651356513565813565135651357" + "77878787878787878787878787878787878787878787878787" + "78578313331353336118111111111111111811111111111117" + "77378661116566653567666666666666666766666666666667" + "78578136563115335638313133131331313831313313133137" + "77378311656551166317551315513155131755131551315517" + "78678653535336613538366633666336663836663366633667" + "77878787878787878787878787878787878787878787878787" + "78378336656556111118111111111111111811111111111157" + "77578153161313353667666666666666666766666666666617" + "78178566535655535138313133131331313831313313133157" + "77378635316136611517565515655156551756551565515617" + "78178551133613153358651356513565135865135651356557" + "77878787878787878787878787878787878787878787878787" + "78878655635551355118111111111111111811111111111117" + "77878313113333563667666666666666666766666666666657" + "78878161551515631138133131331313313813313133131367" + "77878316165363313517315513155131551731551315513157" + "78878633351651561668633666336663366863366633666337" + "77777777777777777777777777777777777777777777777777" + }, + /* 17*/ { UNICODE_MODE, 0, 1, -1, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", 0, 31, 42, 1, "Figure 3d min 5-row, EC0 **NOT SAME** Zint min not same as real min as chooses lower rows first (would need row option)", + "777777777777777777777777777777777777777777" + "788786511111111111181111111111111118111117" + "778783366666666666676666666666666667666667" + "788786113131313131381313131313131318313137" + "778785365656565656576565656565656567565657" + "788781553535353535385353535353535358353537" + "778787878787878787878787878787878787878787" + "788785511111111111181111111111111118111117" + "778781666666666666676666666666666667666667" + "788786533333333333383333333333333338333337" + "775785615151515151571515151515151517515157" + "783783536363636363683636363636363638636367" + "776787878787878787878787878787878787878787" + "781781111111111111181111111111111118111157" + "773785366666666666676666666666666667666617" + "788783131313131313183131313131313138131357" + "776786313131313131371313131313131317313117" + "783785556565656565685656565656565658656557" + "771787878787878787878787878787878787878787" + "785781111111111111181111111111111118111157" + "771783666666666666676666666666666667666617" + "788785131313131313183131313131313138131357" + "778781515151515151571515151515151517515117" + "788786363636363636386363636363636368363657" + "778787878787878787878787878787878787878787" + "788781111111111111181111111111111118111117" + "778786666666666666676666666666666667666637" + "788783131313131313183131313131313138131317" + "778785555555555555575555555555555557555557" + "788783616161616161681616161616161618616167" + "777777777777777777777777777777777777777777" + }, + /* 18*/ { UNICODE_MODE, 0, 6, -1, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012", 0, 31, 66, 1, "Figure 3d max 5-row, EC5 **NOT SAME** Max columns due to 282 limit is 60 not 61 as shown", "777777777777777777777777777777777777777777777777777777777777777777" - "788786655166656555386351111111111118111111111111111811111111111117" - "778783331611363336575566666666666667666666666666666766666666666667" - "788786555153116611183153333333333338333333333333333833333333333337" - "778785361635661566576361515151515157151515151515151751515151515157" - "788781513513555315383653636363636368363636363636363863636363636367" + "788786563656553165385551111111111118111111111111111811111111111117" + "778783136511335313673366666666666667666666666666666766666666666667" + "788786315633661531381153333333333338333333333333333833333333333337" + "778785666366116365673661515151515157151515151515151751515151515157" + "788781333151633111586553636363636368363636363636363863636363636367" "778787878787878787878787878787878787878787878787878787878787878787" - "788785316656355536686131111111111118111111111111111811111111111157" - "778786653365566155373316666666666667666666666666666766666666666617" - "788783361516133633685633131313131318313131313131313813131313131357" - "775785513161356156176361313131313137131313131313131731313131313117" - "786786166533165615383615656565656568565656565656565865656565656557" + "788785511663631513386131111111111118111111111111111811111111111117" + "778786665351353656571616666666666667666666666666666766666666666667" + "788783551116166363183533131313131318313131313131313813131313131317" + "775786313333613536571361313131313137131313131313131731313131313137" + "786785666615135615686615656565656568565656565656565865656565656567" "775787878787878787878787878787878787878787878787878787878787878787" - "781783651151633136586611111111111118111111111111111811111111111157" - "776786533613515615373566666666666667666666666666666766666666666617" - "788781365531653133181613131313131318313131313131313813131313131357" - "773783113156366615576151515151515157151515151515151751515151515117" - "786786351535111563385536363636363638636363636363636836363636363657" - "773787878787878787878787878787878787878787878787878787878787878787" - "785785611111515333685311111111111118111111111111111811111111111157" - "771783336366133651571166666666666667666666666666666766666666666617" - "788786513535351316183313131313131318313131313131313813131313131357" - "778783131151115535575555555555555557555555555555555755555555555517" - "788785665366536111386661616161616168161616161616161861616161616157" + "783785665636551563586511111111111118111111111111111811111111111117" + "776781516115365616671166666666666667666666666666666766666666666667" + "788785631666611363586313131313131318313131313131313813131313131317" + "773786116553355536673151515151515157151515151515151751515151515157" + "786783553131613115381536363636363638636363636363636836363636363637" + "775787878787878787878787878787878787878787878787878787878787878787" + "783786611351531316585111111111111118111111111111111811111111111117" + "771783536663313553371666666666666667666666666666666766666666666667" + "788785665115635111683313131313131318313131313131313813131313131317" + "778783133333563566376155555555555557555555555555555755555555555557" + "788785356111611131583661616161616168161616161616161861616161616167" "778787878787878787878787878787878787878787878787878787878787878787" - "788786355163151355683611111111111118111111111111111811111111111137" - "778783563615515136176566666666666667666666666666666766666666666617" - "788785655136333561585613131313131318313131313131313813131313131357" - "778781136561611613373365656565656567565656565656565765656565656517" - "788783663313553565586153535353535358353535353535353853535353535357" + "788785665536116356681611111111111118111111111111111811111111111137" + "778786511361333635576566666666666667666666666666666766666666666617" + "788783666116561361181613131313131318313131313131313813131313131357" + "778785533633353533375565656565656567565656565656565765656565656517" + "788786316551515665186353535353535358353535353535353853535353535357" "777777777777777777777777777777777777777777777777777777777777777777" }, + /* 19*/ { UNICODE_MODE | ESCAPE_MODE, 0, -1, -1, "[)>\\R06\\G17V12345\\G1P234TYU\\GS6789\\R\\E", 0, 13, 27, 0, "06 Macro; not supported by BWIPP", + "777777777777777777777777777" + "785786311655611111181311157" + "771783153516566666676156617" + "783786565165331131183633357" + "771785613316555615571311517" + "786781336155113553683636357" + "778787878787878787878787877" + "783781136511131113183331117" + "771785651653616651671116637" + "783781163535161335185653357" + "775786355661515113676165537" + "781783531133356335585331617" + "777777777777777777777777777" + }, + /* 20*/ { UNICODE_MODE | ESCAPE_MODE, 0, -1, ULTRA_COMPRESSION, "[)>\\R06\\G17V12345\\G1P234TYU\\GS6789\\R\\E", 0, 13, 23, 0, "06 Macro; not supported by BWIPP", + "77777777777777777777777" + "78578613335635131318557" + "77678536566511516157617" + "78378311615366353638157" + "77578533166515131317617" + "78378356655653353638357" + "77878787878787878787877" + "78678151311551153338617" + "77578333653116611117137" + "78178611511333155658357" + "77378555366511536167517" + "78178116153635315338657" + "77777777777777777777777" + }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol; char escaped[1024]; + char bwipp_buf[32768]; + char bwipp_msg[1024]; + + int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise testStart("test_encode"); for (i = 0; i < data_size; i++) { if (index != -1 && i != index) continue; + if ((debug & ZINT_DEBUG_TEST_PRINT) && !(debug & ZINT_DEBUG_TEST_LESS_NOISY)) printf("i:%d\n", i); symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); @@ -496,20 +717,32 @@ static void test_encode(int index, int generate, int debug) { 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, %d, %d, %s, \"%s\", %s, %d, %d, \"%s\",\n", + printf(" /*%3d*/ { %s, %d, %d, %s, \"%s\", %s, %d, %d, %d, \"%s\",\n", i, testUtilInputModeName(data[i].input_mode), data[i].eci, data[i].option_1, testUtilOption3Name(data[i].option_3), - testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].comment); + testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), testUtilErrorName(data[i].ret), + symbol->rows, symbol->width, data[i].bwipp_cmp, data[i].comment); testUtilModulesPrint(symbol, " ", "\n"); printf(" },\n"); } else { if (ret < ZINT_ERROR) { + int width, row; 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); + 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, data[i].option_1, -1, 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, data[i].option_1, -1, 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); + 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); + } } } } @@ -523,6 +756,7 @@ static void test_encode(int index, int generate, int debug) { int main(int argc, char *argv[]) { testFunction funcs[] = { /* name, func, has_index, has_generate, has_debug */ + { "test_large", test_large, 1, 0, 1 }, { "test_reader_init", test_reader_init, 1, 1, 1 }, { "test_input", test_input, 1, 1, 1 }, { "test_encode", test_encode, 1, 1, 1 }, diff --git a/backend/tests/testcommon.c b/backend/tests/testcommon.c index d232da5f..0d673e72 100644 --- a/backend/tests/testcommon.c +++ b/backend/tests/testcommon.c @@ -2115,7 +2115,7 @@ static const char *testUtilBwippName(int index, const struct zint_symbol *symbol { "", -1, 94, 0, 0, 0, 0, 0, }, { "", -1, 95, 0, 0, 0, 0, 0, }, { "", BARCODE_DPD, 96, 0, 0, 0, 0, 0, }, - { "microqrcode", BARCODE_MICROQR, 97, 0, 0, 0, 0, 0, }, + { "microqrcode", BARCODE_MICROQR, 97, 1, 1, 1, 0, 0, }, { "hibccode128", BARCODE_HIBC_128, 98, 0, 0, 0, 0, 0, }, { "hibccode39", BARCODE_HIBC_39, 99, 0, 0, 0, 0, 0, }, { "", -1, 100, 0, 0, 0, 0, 0, }, @@ -2162,8 +2162,8 @@ static const char *testUtilBwippName(int index, const struct zint_symbol *symbol { "codeone", BARCODE_CODEONE, 141, 0, 1, 0, 0, 0, }, { "", BARCODE_GRIDMATRIX, 142, 0, 0, 0, 0, 0, }, { "", BARCODE_UPNQR, 143, 0, 0, 0, 0, 0, }, - { "ultracode", BARCODE_ULTRA, 144, 0, 0, 0, 0, 0, }, - { "rectangularmicroqrcode", BARCODE_RMQR, 145, 0, 0, 0, 0, 0, }, + { "ultracode", BARCODE_ULTRA, 144, 1, 0, 0, 0, 0, }, + { "rectangularmicroqrcode", BARCODE_RMQR, 145, 1, 1, 0, 0, 0, }, }; static const int data_size = ARRAY_SIZE(data); @@ -2218,6 +2218,21 @@ static const char *testUtilBwippName(int index, const struct zint_symbol *symbol } return NULL; } + } else if (symbology == BARCODE_RMQR) { + if (option_2 < 1) { + if (debug & ZINT_DEBUG_TEST_PRINT) { + printf("i:%d %s not BWIPP compatible, version (option_2) must be specified\n", + index, testUtilBarcodeName(symbology)); + } + return NULL; + } + if (option_2 > 32) { + if (debug & ZINT_DEBUG_TEST_PRINT) { + printf("i:%d %s not BWIPP compatible, auto width (option_2 > 32) not supported\n", + index, testUtilBarcodeName(symbology)); + } + return NULL; + } } if (linear_row_height) { @@ -2232,7 +2247,7 @@ static const char *testUtilBwippName(int index, const struct zint_symbol *symbol *gs1_cvt = 1; } return "gs1datamatrix"; - } else if (symbology == BARCODE_AZTEC) { + } else if (symbology == BARCODE_AZTEC || symbology == BARCODE_ULTRA) { if (debug & ZINT_DEBUG_TEST_PRINT) { printf("i:%d %s not BWIPP compatible, GS1_MODE not supported\n", index, testUtilBarcodeName(symbology)); @@ -2883,6 +2898,46 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int bwipp_opts = bwipp_opts_buf; } } + } else if (symbology == BARCODE_MICROQR || symbology == BARCODE_RMQR) { + if (option_1 >= 1 && option_1 <= 4) { + static const char eccs[4] = { 'L', 'M', 'Q', 'H' }; + sprintf(bwipp_opts_buf + strlen(bwipp_opts_buf), "%seclevel=%c", + strlen(bwipp_opts_buf) ? " " : "", eccs[option_1 - 1]); + bwipp_opts = bwipp_opts_buf; + } + if (symbology == BARCODE_MICROQR) { + if (option_2 >= 1 && option_2 <= 4) { + sprintf(bwipp_opts_buf + strlen(bwipp_opts_buf), "%sversion=M%d", + strlen(bwipp_opts_buf) ? " " : "", option_2); + bwipp_opts = bwipp_opts_buf; + } + if (option_3 != -1) { + int mask = (symbol->option_3 >> 8) & 0x0F; + if (mask >= 1 && mask <= 4) { + sprintf(bwipp_opts_buf + strlen(bwipp_opts_buf), "%smask=%d", + strlen(bwipp_opts_buf) ? " " : "", ((symbol->option_3 >> 8) & 0x0F)); + bwipp_opts = bwipp_opts_buf; + } + } + } else if (symbology == BARCODE_RMQR) { + if (option_2 >= 1 && option_2 <= 32) { + static const char *vers[] = { + "R7x43", "R7x59", "R7x77", "R7x99", "R7x139", "R9x43", "R9x59", "R9x77", "R9x99", "R9x139", + "R11x27", "R11x43", "R11x59", "R11x77", "R11x99", "R11x139", "R13x27", "R13x43", "R13x59", "R13x77", + "R13x99", "R13x139", "R15x43", "R15x59", "R15x77", "R15x99", "R15x139", "R17x43", "R17x59", "R17x77", + "R17x99", "R17x139", + }; + sprintf(bwipp_opts_buf + strlen(bwipp_opts_buf), "%sversion=%s", + strlen(bwipp_opts_buf) ? " " : "", vers[option_2 - 1]); + bwipp_opts = bwipp_opts_buf; + } + } + } else if (symbology == BARCODE_ULTRA) { + 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; + } } } @@ -3022,7 +3077,7 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int } /* Compare bwipp_dump.ps output to test suite module dump */ -int testUtilBwippCmp(const struct zint_symbol *symbol, char *msg, const char *bwipp_buf, const char *expected) { +int testUtilBwippCmp(const struct zint_symbol *symbol, char *msg, char *bwipp_buf, const char *expected) { int bwipp_len = (int) strlen(bwipp_buf); int expected_len = (int) strlen(expected); int ret_memcmp; @@ -3035,6 +3090,14 @@ int testUtilBwippCmp(const struct zint_symbol *symbol, char *msg, const char *bw return 2; } + if (symbol->symbology == BARCODE_ULTRA) { + static const char map[] = { '8', '1', '2', '3', '4', '5', '6', '7', '8', '7' }; + for (i = 0; i < bwipp_len; i++) { + if (bwipp_buf[i] >= '0' && bwipp_buf[i] <= '9') { + bwipp_buf[i] = map[bwipp_buf[i] - '0']; + } + } + } ret_memcmp = memcmp(bwipp_buf, expected, expected_len); if (ret_memcmp != 0) { for (i = 0; i < expected_len; i++) { diff --git a/backend/tests/testcommon.h b/backend/tests/testcommon.h index 9b292228..5ea4ac0a 100644 --- a/backend/tests/testcommon.h +++ b/backend/tests/testcommon.h @@ -175,7 +175,7 @@ int testUtilCanBwipp(int index, const struct zint_symbol *symbol, int option_1, int debug); int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int option_2, int option_3, const char *data, int length, const char *primary, char *buffer, int buffer_size); -int testUtilBwippCmp(const struct zint_symbol *symbol, char *msg, const char *bwipp_buf, const char *expected); +int testUtilBwippCmp(const struct zint_symbol *symbol, char *msg, char *bwipp_buf, const char *expected); int testUtilBwippCmpRow(const struct zint_symbol *symbol, int row, char *msg, const char *bwipp_buf, const char *expected); diff --git a/backend/tests/tools/bwipp_dump-barcode.ps.diff b/backend/tests/tools/bwipp_dump-barcode.ps.diff index 0b62606b..204ab145 100644 --- a/backend/tests/tools/bwipp_dump-barcode.ps.diff +++ b/backend/tests/tools/bwipp_dump-barcode.ps.diff @@ -1,5 +1,5 @@ ---- /home/mburke/code/bwipp/postscriptbarcode/build/monolithic/barcode.ps 2021-08-05 14:58:19.638816396 +0100 -+++ backend/tests/tools/bwipp_dump.ps 2021-08-05 14:59:04.030459474 +0100 +--- /home/mburke/code/bwipp/postscriptbarcode/build/monolithic/barcode.ps 2021-08-09 14:49:02.985470860 +0100 ++++ backend/tests/tools/bwipp_dump.ps 2021-08-09 14:50:05.624957661 +0100 @@ -26289,34 +26289,80 @@ pop } ifelse diff --git a/backend/tests/tools/bwipp_dump.ps.tar.xz b/backend/tests/tools/bwipp_dump.ps.tar.xz index 00132dff..f2994f85 100644 Binary files a/backend/tests/tools/bwipp_dump.ps.tar.xz and b/backend/tests/tools/bwipp_dump.ps.tar.xz differ diff --git a/backend/tests/tools/run_bwipp_tests.sh b/backend/tests/tools/run_bwipp_tests.sh index 3e6cf762..c40fb622 100755 --- a/backend/tests/tools/run_bwipp_tests.sh +++ b/backend/tests/tools/run_bwipp_tests.sh @@ -33,6 +33,9 @@ run_bwipp_test "test_medical" "encode" run_bwipp_test "test_pdf417" "encode" run_bwipp_test "test_plessey" "encode" run_bwipp_test "test_postal" "encode" +run_bwipp_test "test_qr" "microqr_encode" +run_bwipp_test "test_qr" "rmqr_encode" run_bwipp_test "test_rss" run_bwipp_test "test_telepen" "encode" run_bwipp_test "test_upcean" "encode" +run_bwipp_test "test_ultra" "encode" diff --git a/backend/ultra.c b/backend/ultra.c index b8fa06b3..d7f29b02 100644 --- a/backend/ultra.c +++ b/backend/ultra.c @@ -57,11 +57,11 @@ static const char ultra_c43_set3[] = "{}`()\"+'<>|$;&\\^*"; static const char ultra_digit[] = "0123456789,/"; static const char ultra_colour[] = "0CBMRYGKW"; -//static const int ultra_maxsize[] = {34, 78, 158, 282}; // According to Table 1 -// Adjusted to allow 79-81 codeword range in 3-row symbols (only 1 secondary vertical clock track, not 2, so 3 extra) -static const int ultra_maxsize[] = {34, 81, 158, 282}; +// Max size and min cols adjusted to BWIPP values as updated 2021-07-14 +// https://github.com/bwipp/postscriptbarcode/commit/4255810845fa8d45c6192dd30aee1fdad1aaf0cc +static const int ultra_maxsize[] = {37, 84, 161, 282}; -static const int ultra_mincols[] = {5, 13, 23, 30}; // # Total Tile Columns from Table 1 +static const int ultra_mincols[] = {5, 13, 22, 29}; static const int kec[] = {0, 1, 2, 4, 6, 8}; // Value K(EC) from Table 12 @@ -153,7 +153,7 @@ static void ultra_initLogTables(unsigned short gfPwr[], unsigned short gfLog[]) for (j = 0; j < 283; j++) gfLog[j] = 0; i = 1; for (j = 0; j < 282; j++) { - /* j + 282 indicies save doing the modulo operation in GFMUL */ + /* j + 282 indices save doing the modulo operation in GFMUL */ gfPwr[j + 282] = gfPwr[j] = (short) i; gfLog[i] = (short) j; i = (i * 3) % 283; @@ -230,7 +230,7 @@ static int ultra_find_fragment(const unsigned char source[], int source_length, /* Encode characters in 8-bit mode */ static float look_ahead_eightbit(unsigned char source[], int in_length, int in_locn, char current_mode, int end_char, - int cw[], int* cw_len, int gs1) { + int cw[], int *cw_len, int gs1) { int codeword_count = 0; int i; int letters_encoded = 0; @@ -257,14 +257,13 @@ static float look_ahead_eightbit(unsigned char source[], int in_length, int in_l if (codeword_count == 0) { return 0.0; - } else { - return (float)letters_encoded / (float)codeword_count; } + return (float) letters_encoded / (float) codeword_count; } /* Encode character in the ASCII mode/submode (including numeric compression) */ static float look_ahead_ascii(unsigned char source[], int in_length, int in_locn, char current_mode, int symbol_mode, - int end_char, int cw[], int* cw_len, int* encoded, int gs1) { + int end_char, int cw[], int *cw_len, int *encoded, int gs1) { int codeword_count = 0; int i; int first_digit, second_digit, done; @@ -347,9 +346,8 @@ static float look_ahead_ascii(unsigned char source[], int in_length, int in_locn if (codeword_count == 0) { return 0.0; - } else { - return (float)letters_encoded / (float)codeword_count; } + return (float) letters_encoded / (float) codeword_count; } /* Returns true if should latch to subset other than given `subset` */ @@ -357,8 +355,8 @@ static int c43_should_latch_other(const unsigned char data[], const int length, const int gs1) { int i, fraglen, predict_window; int cnt, alt_cnt, fragno; - const char* set = subset == 1 ? ultra_c43_set1 : ultra_c43_set2; - const char* alt_set = subset == 2 ? ultra_c43_set1 : ultra_c43_set2; + const char *set = subset == 1 ? ultra_c43_set1 : ultra_c43_set2; + const char *alt_set = subset == 2 ? ultra_c43_set1 : ultra_c43_set2; if (locn + 3 > length) { return 0; @@ -423,7 +421,7 @@ static int get_subset(unsigned char source[], int in_length, int in_locn, int cu /* Encode characters in the C43 compaction submode */ static float look_ahead_c43(unsigned char source[], int in_length, int in_locn, char current_mode, int end_char, - int subset, int cw[], int* cw_len, int* encoded, int gs1, int debug) { + int subset, int cw[], int *cw_len, int *encoded, int gs1, int debug) { int codeword_count = 0; int subcodeword_count = 0; int i; @@ -438,7 +436,7 @@ static float look_ahead_c43(unsigned char source[], int in_length, int in_locn, #ifndef _MSC_VER int subcw[(in_length + 3) * 2]; #else - int * subcw = (int *) _alloca((in_length + 3) * 2 * sizeof(int)); + int *subcw = (int *) _alloca((in_length + 3) * 2 * sizeof(int)); #endif /* _MSC_VER */ if (current_mode == EIGHTBIT_MODE) { @@ -451,7 +449,7 @@ static float look_ahead_c43(unsigned char source[], int in_length, int in_locn, fragno -= 2; } - switch(fragno) { + switch (fragno) { case 17: // mailto: cw[codeword_count] = 276; sublocn += (int) strlen(fragment[fragno]); @@ -486,23 +484,18 @@ static float look_ahead_c43(unsigned char source[], int in_length, int in_locn, if (subset == 1) { cw[codeword_count] = 260; // C43 Compaction Submode C1 codeword_count++; - } - - if ((subset == 2) || (subset == 3)) { + } else if ((subset == 2) || (subset == 3)) { cw[codeword_count] = 266; // C43 Compaction Submode C2 codeword_count++; } break; } - } - if (current_mode == ASCII_MODE) { + } else if (current_mode == ASCII_MODE) { if (subset == 1) { cw[codeword_count] = 278; // C43 Compaction Submode C1 codeword_count++; - } - - if ((subset == 2) || (subset == 3)) { + } else if ((subset == 2) || (subset == 3)) { cw[codeword_count] = 280; // C43 Compaction Submode C2 codeword_count++; } @@ -542,33 +535,26 @@ static float look_ahead_c43(unsigned char source[], int in_length, int in_locn, subcw[subcodeword_count] = posn(ultra_c43_set1, source[sublocn]); subcodeword_count++; sublocn++; - } - - if (subset == 2) { + } else if (subset == 2) { subcw[subcodeword_count] = posn(ultra_c43_set2, source[sublocn]); subcodeword_count++; sublocn++; - } - - if (subset == 3) { + } else if (subset == 3) { subcw[subcodeword_count] = 41; // Shift to set 3 subcodeword_count++; fragno = ultra_find_fragment(source, in_length, sublocn); - if (fragno == 26) { - fragno = -1; - } - if ((fragno >= 0) && (fragno <= 18)) { - subcw[subcodeword_count] = fragno; // C43 Set 3 codewords 0 to 18 - subcodeword_count++; - sublocn += (int) strlen(fragment[fragno]); - } - if ((fragno >= 19) && (fragno <= 25)) { - subcw[subcodeword_count] = fragno + 17; // C43 Set 3 codewords 36 to 42 - subcodeword_count++; - sublocn += (int) strlen(fragment[fragno]); - } - if (fragno == -1) { + if (fragno != -1 && fragno != 26) { + if (fragno <= 18) { + subcw[subcodeword_count] = fragno; // C43 Set 3 codewords 0 to 18 + subcodeword_count++; + sublocn += (int) strlen(fragment[fragno]); + } else { + subcw[subcodeword_count] = fragno + 17; // C43 Set 3 codewords 36 to 42 + subcodeword_count++; + sublocn += (int) strlen(fragment[fragno]); + } + } else { subcw[subcodeword_count] = posn(ultra_c43_set3, source[sublocn]) + 19; // C43 Set 3 codewords 19 to 35 subcodeword_count++; sublocn++; @@ -610,9 +596,8 @@ static float look_ahead_c43(unsigned char source[], int in_length, int in_locn, if (codeword_count == 0) { return 0.0; - } else { - return (float)letters_encoded / (float)codeword_count; } + return (float) letters_encoded / (float) codeword_count; } /* Produces a set of codewords which are "somewhat" optimised - this could be improved on */ @@ -640,9 +625,9 @@ static int ultra_generate_codewords(struct zint_symbol *symbol, const unsigned c char mode[in_length + 1]; int cw_fragment[in_length * 2 + 1]; #else - unsigned char * crop_source = (unsigned char *) _alloca(in_length + 1); - char * mode = (char *) _alloca(in_length + 1); - int * cw_fragment = (int *) _alloca((in_length * 2 + 1) * sizeof(int)); + unsigned char *crop_source = (unsigned char *) _alloca(in_length + 1); + char *mode = (char *) _alloca(in_length + 1); + int *cw_fragment = (int *) _alloca((in_length * 2 + 1) * sizeof(int)); #endif /* _MSC_VER */ if ((symbol->input_mode & 0x07) == GS1_MODE) { @@ -720,18 +705,16 @@ static int ultra_generate_codewords(struct zint_symbol *symbol, const unsigned c } if ((codewords[0] == 257) || (codewords[0] == 272)) { - fragno = ultra_find_fragment((unsigned char *)source, in_length, 0); + fragno = ultra_find_fragment(source, in_length, 0); // Check for http:// at start of input if ((fragno == 0) || (fragno == 2)) { codewords[0] = 281; input_locn = 7; symbol_mode = EIGHTBIT_MODE; - } - // Check for https:// at start of input - if ((fragno == 1) || (fragno == 3)) { + } else if ((fragno == 1) || (fragno == 3)) { codewords[0] = 282; input_locn = 8; symbol_mode = EIGHTBIT_MODE; @@ -745,18 +728,18 @@ static int ultra_generate_codewords(struct zint_symbol *symbol, const unsigned c && source[4] == '0' && source[5] == '6' && source[6] == '\x1d' && source[in_length - 2] == '\x1e' && source[in_length - 1] == '\x04') { - if (symbol_mode == EIGHTBIT_MODE) { - codewords[codeword_count] = 271; // 06 Macro - } else { - codewords[codeword_count] = 273; // 06 Macro - } - codeword_count++; + if (symbol_mode == EIGHTBIT_MODE) { + codewords[codeword_count] = 271; // 06 Macro + } else { + codewords[codeword_count] = 273; // 06 Macro + } + codeword_count++; - for (i = 7; i < (in_length - 2); i++) { - crop_source[i - 7] = source[i]; - } - crop_length = in_length - 9; - crop_source[crop_length] = '\0'; + for (i = 7; i < (in_length - 2); i++) { + crop_source[i - 7] = source[i]; + } + crop_length = in_length - 9; + crop_source[crop_length] = '\0'; } else { /* Make a cropped version of input data - removes http:// and https:// if needed */ for (i = input_locn; i < in_length; i++) { @@ -786,9 +769,7 @@ static int ultra_generate_codewords(struct zint_symbol *symbol, const unsigned c if ((c43_score > ascii_score) && (c43_score > eightbit_score)) { mode[input_locn] = 'c'; current_mode = C43_MODE; - } - - if ((eightbit_score > ascii_score) && (eightbit_score > c43_score)) { + } else if ((eightbit_score > ascii_score) && (eightbit_score > c43_score)) { mode[input_locn] = '8'; current_mode = EIGHTBIT_MODE; } @@ -828,7 +809,7 @@ static int ultra_generate_codewords(struct zint_symbol *symbol, const unsigned c block_length++; } - switch(mode[input_locn]) { + switch (mode[input_locn]) { case 'a': look_ahead_ascii(crop_source, crop_length, input_locn, current_mode, symbol_mode, input_locn + block_length, cw_fragment, &fragment_length, NULL, gs1); @@ -890,8 +871,8 @@ INTERNAL int ultracode(struct zint_symbol *symbol, unsigned char source[], int l int tilex, tiley; int dcc; #ifdef _MSC_VER - int* data_codewords; - char* pattern; + int *data_codewords; + char *pattern; #endif /* _MSC_VER */ cw_memalloc = length * 2; @@ -913,7 +894,11 @@ INTERNAL int ultracode(struct zint_symbol *symbol, unsigned char source[], int l data_cw_count = ultra_generate_codewords(symbol, source, length, data_codewords); if (symbol->debug & ZINT_DEBUG_PRINT) { - printf("Codewords returned = %d\n", data_cw_count); + printf("Codewords (%d):", data_cw_count); + for (i = 0; i < data_cw_count; i++) { + printf(" %d", data_codewords[i]); + } + printf("\n"); } #ifdef ZINT_TEST if (symbol->debug & ZINT_DEBUG_TEST) { @@ -944,12 +929,12 @@ INTERNAL int ultracode(struct zint_symbol *symbol, unsigned char source[], int l acc = qcc - 3; if (symbol->debug & ZINT_DEBUG_PRINT) { - printf("ECC codewords: %d\n", qcc); + printf("EC%d codewords: %d\n", ecc_level + 1, qcc); } /* Maximum capacity is 282 codewords */ total_cws = data_cw_count + qcc + 3; // 3 == TCC pattern + RSEC pattern + QCC pattern - if (total_cws > 282) { + if (total_cws - 3 > 282) { strcpy(symbol->errtxt, "591: Data too long for selected error correction capacity"); return ZINT_ERROR_TOO_LONG; } @@ -987,6 +972,14 @@ INTERNAL int ultracode(struct zint_symbol *symbol, unsigned char source[], int l ultra_gf283((short) data_cw_count, (short) qcc, data_codewords); + if (symbol->debug & ZINT_DEBUG_PRINT) { + printf("ECCs (%d):", qcc); + for (i = 0; i < qcc; i++) { + printf(" %d", data_codewords[(282 - qcc) + i]); + } + printf("\n"); + } + /* Rearrange to make final codeword sequence */ codeword[locn++] = data_codewords[282 - (data_cw_count + qcc)]; // Start Character codeword[locn++] = data_cw_count; // MCC @@ -1070,11 +1063,9 @@ INTERNAL int ultracode(struct zint_symbol *symbol, unsigned char source[], int l if (tilex == 14) { tilex++; - } - if (tilex == 30) { + } else if (tilex == 30) { tilex++; - } - if (tilex == 46) { + } else if (tilex == 46) { tilex++; } } @@ -1122,7 +1113,7 @@ INTERNAL int ultracode(struct zint_symbol *symbol, unsigned char source[], int l for (i = 0; i < total_height; i++) { symbol->row_height[i] = 1; - for(j = 0; j < total_width; j++) { + for (j = 0; j < total_width; j++) { set_module_colour(symbol, i, j, posn(ultra_colour, pattern[(i * total_width) + j])); } } diff --git a/backend_tcl/zint_tcl.dsp b/backend_tcl/zint_tcl.dsp index aac19eff..4f14b0c5 100644 --- a/backend_tcl/zint_tcl.dsp +++ b/backend_tcl/zint_tcl.dsp @@ -43,7 +43,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZINT_TCL_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\backend" /I "C:\myprograms\tcl8.5\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZINT_TCL_EXPORTS" /D "NO_PNG" /FR /YX /FD /D ZINT_VERSION="\"2.7.1\"" /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\backend" /I "C:\Tcl\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZINT_TCL_EXPORTS" /D "NO_PNG" /FR /YX /FD /D ZINT_VERSION="\"2.9.1.9\"" /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x407 /d "NDEBUG" @@ -53,7 +53,8 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib tclstub85.lib tkstub85.lib /nologo /dll /machine:I386 /out:"zint.dll" /libpath:"C:\myprograms\tcl8.5\lib" +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib tclstub85.lib tkstub85.lib /nologo /dll /machine:I386 /out:"zint.dll" /libpath:"C:\Tcl\lib" +# SUBTRACT LINK32 /pdb:none !ELSEIF "$(CFG)" == "zint_tcl - Win32 Debug" @@ -69,7 +70,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZINT_TCL_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\backend" /I "C:\myprograms\tcl8.5\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZINT_TCL_EXPORTS" /D "NO_PNG" /FR /YX /FD /GZ /D ZINT_VERSION="\"2.7.1\"" /c +# ADD CPP /nologo /MD /W3 /Gm /GX /ZI /Od /I "..\backend" /I "C:\Tcl\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZINT_TCL_EXPORTS" /D "NO_PNG" /FR /YX /FD /GZ /D ZINT_VERSION="\"2.9.1.9\"" /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x407 /d "_DEBUG" @@ -79,7 +80,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib tclstub85.lib tkstub85.lib /nologo /dll /debug /machine:I386 /out:"Debug/zint.dll" /pdbtype:sept /libpath:"C:\myprograms\tcl8.5\lib" +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib tclstub85.lib tkstub85.lib /nologo /dll /debug /machine:I386 /out:"Debug/zint.dll" /pdbtype:sept /libpath:"C:\Tcl\lib" !ENDIF diff --git a/docs/manual.txt b/docs/manual.txt index 873ee682..926ac23b 100644 --- a/docs/manual.txt +++ b/docs/manual.txt @@ -2473,13 +2473,15 @@ ZINT_FULL_MULTIBYTE | (N + 1) << 8. 6.6.4 Rectangular Micro QR Code (rMQR) -------------------------------------- -A rectangular version of QR Code. Like QR Code, rMQR supports encoding of GS1 -data, and Latin-1 characters in the ISO/IEC 8859-1 set and Kanji characters in -the Shift JIS encoding scheme. It does not support other ISO/IEC 8859 character -sets or encodings. As with other symbologies data should be entered as UTF-8 -with the conversion to Latin-1 or Shift JIS being handled by Zint. The amount of -ECC codewords can be adjusted using the --secure= option (API option_1), however -only ECC levels M and H are valid for this type of symbol. +A rectangular version of QR Code, it is still under development, so it is +recommended it should not yet be used for a production environment. Like QR +Code, rMQR supports encoding of GS1 data, and Latin-1 characters in the ISO/IEC +8859-1 set and Kanji characters in the Shift JIS encoding scheme. It does not +support other ISO/IEC 8859 character sets or encodings. As with other +symbologies data should be entered as UTF-8 with the conversion to Latin-1 or +Shift JIS being handled by Zint. The amount of ECC codewords can be adjusted +using the --secure= option (API option_1), however only ECC levels M and H are +valid for this type of symbol. ------------------------------------------------------------------------- Input | ECC Level | Error Correction Capacity | Recovery Capacity @@ -3088,7 +3090,7 @@ international standards: capture techniques - MicroPDF417 bar code symbology specification > ISO/IEC 24778:2008 Information technology - Automatic identification and data capture techniques - Aztec Code bar code symbology specification -> ISO/IEC JTC1/SC31N000 (Draft 2018-6-8) Information technology - Automatic +> ISO/IEC JTC1/SC31N000 (Draft 2019-6-24) Information technology - Automatic identification and data capture techniques - Rectangular Micro QR Code (rMQR) bar code symbology specification > ISO/IEC 16390:2007 Information technology - Automatic identification and data diff --git a/frontend_qt/grpC128.ui b/frontend_qt/grpC128.ui index 1746b789..12bc1810 100644 --- a/frontend_qt/grpC128.ui +++ b/frontend_qt/grpC128.ui @@ -71,11 +71,6 @@ 0 - - - 9 - - Note: Composite symbols require a GS1-128 linear component. diff --git a/frontend_qt/grpDAFT.ui b/frontend_qt/grpDAFT.ui index a210fc89..ae4f7dc7 100644 --- a/frontend_qt/grpDAFT.ui +++ b/frontend_qt/grpDAFT.ui @@ -76,11 +76,6 @@ 0 - - - 9 - - Examples of tracker ratios:<table cellspacing="3"> <tr><td>Australia Post&nbsp;</td><td>26%</td></tr> diff --git a/frontend_qt/grpGrid.ui b/frontend_qt/grpGrid.ui index 6dbce5d5..ad615bf9 100644 --- a/frontend_qt/grpGrid.ui +++ b/frontend_qt/grpGrid.ui @@ -160,11 +160,6 @@ 0 - - - 9 - - Note: Error Correction is ignored if it is below the minimum available or is too high for a given size. diff --git a/frontend_qt/mainWindow.ui b/frontend_qt/mainWindow.ui index 722982ee..2446643a 100644 --- a/frontend_qt/mainWindow.ui +++ b/frontend_qt/mainWindow.ui @@ -22,7 +22,7 @@ 400 - 485 + 435 @@ -56,6 +56,9 @@ + + Type of barcode + S&ymbology: @@ -65,9 +68,6 @@ bstyle - - Type of barcode - @@ -247,28 +247,28 @@ or import from file false + + Type of 2D component + &Type: cmbCompType - - Type of 2D component - + + false + 60 - 16777215 + 0 - - false - Type of 2D component @@ -306,16 +306,16 @@ or import from file false + + Data to be encoded in 2D component +Remember to place [square brackets] around AI identifiers + 2D C&omponent Data: txtComposite - - Data to be encoded in 2D component -Remember to place [square brackets] around AI identifiers - @@ -339,16 +339,6 @@ Remember to place [square brackets] around AI identifiers Data to be encoded in 2D component Remember to place [square brackets] around AI identifiers - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:9pt;">Your Data Here!</span></p></body></html> - - - false - @@ -366,6 +356,10 @@ p, li { white-space: pre-wrap; } 16777215 + + Set the ECI (Extended Channel Interpretation) code +(ignored if disabled) + EC&I: @@ -375,10 +369,6 @@ p, li { white-space: pre-wrap; } cmbECI - - Set the ECI (Extended Channel Interpretation) code -(ignored if disabled) - @@ -386,7 +376,7 @@ p, li { white-space: pre-wrap; } 64 - 16777215 + 0 @@ -562,7 +552,7 @@ p, li { white-space: pre-wrap; } - + @@ -625,7 +615,7 @@ p, li { white-space: pre-wrap; } - Process parentheses "()" instead of square brackets "[]" + Process parentheses "()" instead of square brackets "[]" as delimiters for GS1 Application Identifiers (ignored if disabled) @@ -687,6 +677,10 @@ as delimiters for GS1 Application Identifiers false + + Overall symbol height in X-dimensions +(ignored if disabled) + &Height: @@ -696,10 +690,6 @@ as delimiters for GS1 Application Identifiers heightb - - Overall symbol height in X-dimensions -(ignored if disabled) - @@ -736,6 +726,9 @@ as delimiters for GS1 Application Identifiers + + Width of boundary bars or border in X-dimensions + Border &Width: @@ -745,9 +738,6 @@ as delimiters for GS1 Application Identifiers bwidth - - Width of boundary bars or border in X-dimensions - @@ -771,6 +761,9 @@ as delimiters for GS1 Application Identifiers + + Add border or box + Border &Type: @@ -780,9 +773,6 @@ as delimiters for GS1 Application Identifiers btype - - Add border or box - @@ -812,6 +802,9 @@ as delimiters for GS1 Application Identifiers + + Horizontal whitespace, Vertical whitespace, in X-dimensions + &Whitespace: @@ -821,9 +814,6 @@ as delimiters for GS1 Application Identifiers spnWhitespace - - Horizontal whitespace, Vertical whitespace, in X-dimensions - @@ -854,6 +844,9 @@ in X-dimensions + + Image scale when output to file + Printing Sca&le: @@ -863,9 +856,6 @@ in X-dimensions spnScale - - Image scale when output to file - @@ -895,6 +885,10 @@ in X-dimensions + + Set font characteristics +(ignored if disabled) + Fo&nt Setting: @@ -904,10 +898,6 @@ in X-dimensions cmbFontSetting - - Set font characteristics -(ignored if disabled) - @@ -957,6 +947,9 @@ in X-dimensions true + + Change colour of ink or paper + Colour: @@ -966,9 +959,6 @@ in X-dimensions fgcolor - - Change colour of ink or paper - @@ -1026,6 +1016,9 @@ in X-dimensions + + Rotate symbol by degrees + R&otate: @@ -1035,9 +1028,6 @@ in X-dimensions cmbRotate - - Rotate symbol by degrees - @@ -1086,6 +1076,10 @@ in X-dimensions false + + Size of dots +(ignored if disabled) + Dot S&ize: @@ -1095,21 +1089,17 @@ in X-dimensions spnDotSize - - Size of dots -(ignored if disabled) - + + false + Size of dots (ignored if disabled) - - false - @@ -1191,7 +1181,7 @@ in X-dimensions Output image to file (BMP/EMF/EPS/GIF/PCX/PNG/SVG/TIF) - &Save As… + &Save As… diff --git a/frontend_qt/mainwindow.cpp b/frontend_qt/mainwindow.cpp index c5427975..9e4e303e 100644 --- a/frontend_qt/mainwindow.cpp +++ b/frontend_qt/mainwindow.cpp @@ -132,6 +132,7 @@ MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags fl) scene = new QGraphicsScene(this); setupUi(this); + view->setMinimumHeight(20); view->setScene(scene); restoreGeometry(settings.value("studio/window_geometry").toByteArray()); @@ -635,6 +636,7 @@ void MainWindow::change_options() tabMain->insertTab(1, m_optionWidget, tr("Cod&e 128")); chkComposite->setText(tr("Add &2D Component (GS1-128 only)")); combobox_item_enabled(cmbCompType, 3, true); // CC-C + set_smaller_font(m_optionWidget->findChild("noteC128CompositeEAN")); connect(m_optionWidget->findChild("radC128EAN"), SIGNAL(toggled( bool )), SLOT(composite_ean_check())); connect(m_optionWidget->findChild("radC128Stand"), SIGNAL(clicked( bool )), SLOT(update_preview())); connect(m_optionWidget->findChild("radC128CSup"), SIGNAL(clicked( bool )), SLOT(update_preview())); @@ -799,6 +801,7 @@ void MainWindow::change_options() m_optionWidget = uiload.load(&file); file.close(); tabMain->insertTab(1, m_optionWidget, tr("DAFT")); + set_smaller_font(m_optionWidget->findChild("noteTrackerRatios")); connect(m_optionWidget->findChild("spnDAFTTrackerRatio"), SIGNAL(valueChanged( double )), SLOT(update_preview())); } @@ -880,6 +883,7 @@ void MainWindow::change_options() m_optionWidget = uiload.load(&file); file.close(); tabMain->insertTab(1, m_optionWidget, tr("Grid M&atrix")); + set_smaller_font(m_optionWidget->findChild("noteGridECC")); connect(m_optionWidget->findChild("cmbGridSize"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); connect(m_optionWidget->findChild("cmbGridECC"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); connect(m_optionWidget->findChild("chkGridFullMultibyte"), SIGNAL(stateChanged( int )), SLOT(update_preview())); @@ -1138,6 +1142,27 @@ void MainWindow::set_gs1_mode(bool gs1_mode) } } +void MainWindow::set_smaller_font(QLabel *label) +{ + if (label) { + const QFont &appFont = QApplication::font(); + qreal pointSize = appFont.pointSizeF(); + if (pointSize != -1.0) { + QFont font = label->font(); + pointSize *= 0.9; + font.setPointSizeF(pointSize); + label->setFont(font); + } else { + int pixelSize = appFont.pixelSize(); + if (pixelSize > 1) { + QFont font = label->font(); + font.setPixelSize(pixelSize - 1); + label->setFont(font); + } + } + } +} + void MainWindow::update_preview() { int symbology = bstyle_items[bstyle->currentIndex()].symbology; diff --git a/frontend_qt/mainwindow.h b/frontend_qt/mainwindow.h index 8f4747f7..4d65db05 100644 --- a/frontend_qt/mainwindow.h +++ b/frontend_qt/mainwindow.h @@ -57,6 +57,7 @@ protected: void combobox_item_enabled(QComboBox *comboBox, int index, bool enabled); void upcean_addon_gap(QComboBox *comboBox, QLabel *label, int base); void set_gs1_mode(bool gs1_mode); + void set_smaller_font(QLabel *note); const char *get_setting_name(int symbology); diff --git a/tools/update_version.php b/tools/update_version.php index cb8be72b..9e2a438a 100644 --- a/tools/update_version.php +++ b/tools/update_version.php @@ -262,7 +262,10 @@ version_replace(2, $data_dirname . 'win32/vs2019/libzint.vcxproj', '/ZINT_VERSIO version_replace(2, $data_dirname . 'win32/vs2019/zint.vcxproj', '/ZINT_VERSION="/', '/ZINT_VERSION="[0-9.]+"/', 'ZINT_VERSION="' . $v_str . '"'); +// backend_tcl/zint_tcl.dsp + +version_replace(2, $data_dirname . 'backend_tcl/zint_tcl.dsp', '/ZINT_VERSION="\\\\"/', '/ZINT_VERSION="\\\\"[0-9.]+\\\\""/', 'ZINT_VERSION="\\"' . $v_str . '\\""'); + // Leaving auto-generated files: // backend_tcl/configure (PACKAGE_VERSION and PACKAGE_STRING) - generated by autoconf from configure.in // frontend_qt/Inno_Setup_qtzint.iss (MyAppVersion) -// win32/zint_cmdline_vc6/zint_cmdline_vc6.dsp (2 ZINT_VERSION's)