2019-10-17 22:06:21 +13:00
/*
libzint - the open source barcode library
2023-01-15 13:22:43 +13:00
Copyright ( C ) 2019 - 2023 Robin Stuart < rstuart114 @ gmail . com >
2019-10-17 22:06:21 +13:00
Redistribution and use in source and binary forms , with or without
modification , are permitted provided that the following conditions
are met :
1. Redistributions of source code must retain the above copyright
notice , this list of conditions and the following disclaimer .
2. Redistributions in binary form must reproduce the above copyright
notice , this list of conditions and the following disclaimer in the
documentation and / or other materials provided with the distribution .
3. Neither the name of the project nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission .
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS " AS IS " AND
ANY EXPRESS OR IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED . IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT , INDIRECT , INCIDENTAL , SPECIAL , EXEMPLARY , OR CONSEQUENTIAL
DAMAGES ( INCLUDING , BUT NOT LIMITED TO , PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; OR BUSINESS INTERRUPTION )
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , WHETHER IN CONTRACT , STRICT
LIABILITY , OR TORT ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE , EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE .
*/
RMQR: update to ISO/IEC 23941:2022 - R13x77 numeric cclens change 8 -> 7
QRCODE: use stricter interpretation of ZINT_FULL_MULTIBYTE, excluding
certain trailing bytes
libzint: fix some confusing error messages introduced by segment stuff
general: new escape chars \U, \d and \o
backend_qt: fudge rendering of border rectangles due to scaling/translation
rounding errors TODO: better fudge
GUI: foreground/background colours -> text boxes and icon buttons, add swap
button, independently movable picker (NULL parent), preview colour changes,
preview Data Window changes, add clear data (del) buttons, add zap button
and Factory Reset menu option, various other fixes
libzint: remove STATIC_UNLESS_ZINT_TEST, use wrappers
CMake: add find package QtSvg, remove QtXml
manual: split symbology and general specs and sort, move DAFT to 4-state,
UPC/EAN -> EAN/UPC, DataBar -> GS1 DataBar always, expand MAILMARK info,
various other fiddlings
man page: options or -> |, expand MSI Plessey check digit options
README.linux: add packages info
license: add SPDX-License-Identifier to touched files
2022-06-10 08:52:02 +12:00
/* SPDX-License-Identifier: BSD-3-Clause */
2019-10-17 22:06:21 +13:00
- API: add new zint_symbol `dpmm` field for output resolution (BMP/
EMF/PCX/PNG/TIF only, i.e. excluding EPS, GIF & SVG)
- Add support for specifying scale by X-dimension and resolution
with new option `--scalexdimdp` for CLI/Tcl & new API function
`ZBarcode_Scale_From_XdimDp()` (+ `ZBarcode_XdimDp_From_Scale()`
& `ZBarcode_Default_Xdim()`) and new GUI popup; manual: document
- BMP/EMF/PCX/PNG/TIF: use new `dpmm` resolution field (for EMF
following Inkscape)
- backend_qt: add `dpmm()`, `vectorWidth()`, `vectorHeight()`,
`noPng()`, `getVersion()`, `takesGS1AIData()`, & `XdimDp` stuff
incl. new `QZintXdimDp` struct for passing around scale vars &
use in `getAsCLI()`; add comments
- Raise `scale` limit to 200 (from 100) to allow for large dpmm
- output: create directories & subdirectories as necessary for
output path using new function `out_fopen()` and use in BMP/EMF/
EPS/GIF/PCX/PNG/SVG/TIF
- DPLEIT/DPIDENT: format HRT according to (incomplete)
documentation, and set default height to 72X (from 50X)
- CODE128B renamed to CODE128AB as can use subsets A and/or B
- CODABAR: fix minimum height calc
- EMF: fix indexing of handles (zero-based not 1-based)
- GUI: fix symbology zap (previous technique of clearing and
re-loading settings without doing a sync no longer works);
fix UPCEAN guard descent enable
- MAILMARK: better error message if input < 14 characters
- GUI: add "Default" button for DAFT tracker ratio & enable/disable
various default buttons; use new `takesGS1AIData()` to
enable/disable GS1-specific checkboxes
- CLI: use new `validate_float()` to parse float options (7
significant digits allowed only, no scientific notation)
- DATAMATRIX/GRIDMATRIX/PDF417/QR/ULTRA: micro-optimize structapp
ID parse
- library/CLI: fiddle with static asserts (make CHAR_BIT sensitive,
supposedly)
- win32/README: update building libpng (assembly removed)
- README.linux: document incompatibility of Qt6 >= 6.3
- manual: expand Barcode Studio waffle
- test suite: change range separator to hyphen and allow multiple
excludes
2022-12-03 10:39:01 +13:00
# include <errno.h>
2020-03-27 11:17:37 +13:00
# include <fcntl.h>
- API: add new zint_symbol `dpmm` field for output resolution (BMP/
EMF/PCX/PNG/TIF only, i.e. excluding EPS, GIF & SVG)
- Add support for specifying scale by X-dimension and resolution
with new option `--scalexdimdp` for CLI/Tcl & new API function
`ZBarcode_Scale_From_XdimDp()` (+ `ZBarcode_XdimDp_From_Scale()`
& `ZBarcode_Default_Xdim()`) and new GUI popup; manual: document
- BMP/EMF/PCX/PNG/TIF: use new `dpmm` resolution field (for EMF
following Inkscape)
- backend_qt: add `dpmm()`, `vectorWidth()`, `vectorHeight()`,
`noPng()`, `getVersion()`, `takesGS1AIData()`, & `XdimDp` stuff
incl. new `QZintXdimDp` struct for passing around scale vars &
use in `getAsCLI()`; add comments
- Raise `scale` limit to 200 (from 100) to allow for large dpmm
- output: create directories & subdirectories as necessary for
output path using new function `out_fopen()` and use in BMP/EMF/
EPS/GIF/PCX/PNG/SVG/TIF
- DPLEIT/DPIDENT: format HRT according to (incomplete)
documentation, and set default height to 72X (from 50X)
- CODE128B renamed to CODE128AB as can use subsets A and/or B
- CODABAR: fix minimum height calc
- EMF: fix indexing of handles (zero-based not 1-based)
- GUI: fix symbology zap (previous technique of clearing and
re-loading settings without doing a sync no longer works);
fix UPCEAN guard descent enable
- MAILMARK: better error message if input < 14 characters
- GUI: add "Default" button for DAFT tracker ratio & enable/disable
various default buttons; use new `takesGS1AIData()` to
enable/disable GS1-specific checkboxes
- CLI: use new `validate_float()` to parse float options (7
significant digits allowed only, no scientific notation)
- DATAMATRIX/GRIDMATRIX/PDF417/QR/ULTRA: micro-optimize structapp
ID parse
- library/CLI: fiddle with static asserts (make CHAR_BIT sensitive,
supposedly)
- win32/README: update building libpng (assembly removed)
- README.linux: document incompatibility of Qt6 >= 6.3
- manual: expand Barcode Studio waffle
- test suite: change range separator to hyphen and allow multiple
excludes
2022-12-03 10:39:01 +13:00
# include <math.h>
2020-03-27 11:17:37 +13:00
# include <sys/stat.h>
- API: add new zint_symbol `dpmm` field for output resolution (BMP/
EMF/PCX/PNG/TIF only, i.e. excluding EPS, GIF & SVG)
- Add support for specifying scale by X-dimension and resolution
with new option `--scalexdimdp` for CLI/Tcl & new API function
`ZBarcode_Scale_From_XdimDp()` (+ `ZBarcode_XdimDp_From_Scale()`
& `ZBarcode_Default_Xdim()`) and new GUI popup; manual: document
- BMP/EMF/PCX/PNG/TIF: use new `dpmm` resolution field (for EMF
following Inkscape)
- backend_qt: add `dpmm()`, `vectorWidth()`, `vectorHeight()`,
`noPng()`, `getVersion()`, `takesGS1AIData()`, & `XdimDp` stuff
incl. new `QZintXdimDp` struct for passing around scale vars &
use in `getAsCLI()`; add comments
- Raise `scale` limit to 200 (from 100) to allow for large dpmm
- output: create directories & subdirectories as necessary for
output path using new function `out_fopen()` and use in BMP/EMF/
EPS/GIF/PCX/PNG/SVG/TIF
- DPLEIT/DPIDENT: format HRT according to (incomplete)
documentation, and set default height to 72X (from 50X)
- CODE128B renamed to CODE128AB as can use subsets A and/or B
- CODABAR: fix minimum height calc
- EMF: fix indexing of handles (zero-based not 1-based)
- GUI: fix symbology zap (previous technique of clearing and
re-loading settings without doing a sync no longer works);
fix UPCEAN guard descent enable
- MAILMARK: better error message if input < 14 characters
- GUI: add "Default" button for DAFT tracker ratio & enable/disable
various default buttons; use new `takesGS1AIData()` to
enable/disable GS1-specific checkboxes
- CLI: use new `validate_float()` to parse float options (7
significant digits allowed only, no scientific notation)
- DATAMATRIX/GRIDMATRIX/PDF417/QR/ULTRA: micro-optimize structapp
ID parse
- library/CLI: fiddle with static asserts (make CHAR_BIT sensitive,
supposedly)
- win32/README: update building libpng (assembly removed)
- README.linux: document incompatibility of Qt6 >= 6.3
- manual: expand Barcode Studio waffle
- test suite: change range separator to hyphen and allow multiple
excludes
2022-12-03 10:39:01 +13:00
# include "testcommon.h"
# include "../common.h"
2019-10-17 22:06:21 +13:00
2022-09-13 06:26:04 +12:00
static void test_checks ( const testCtx * const p_ctx ) {
int debug = p_ctx - > debug ;
2020-05-06 09:28:25 +12:00
2019-10-17 22:06:21 +13:00
struct item {
int symbology ;
2021-07-07 06:53:31 +12:00
int option_1 ;
2020-10-04 10:51:08 +13:00
char * data ;
2019-10-17 22:06:21 +13:00
int length ;
int input_mode ;
int eci ;
2021-09-21 01:56:27 +12:00
float height ;
int whitespace_width ;
int whitespace_height ;
int border_width ;
float scale ;
2019-10-17 22:06:21 +13:00
float dot_size ;
2023-02-11 03:44:10 +13:00
float text_gap ;
2021-09-22 11:04:15 +12:00
float guard_descent ;
2020-11-02 07:32:55 +13:00
int warn_level ;
2019-10-17 22:06:21 +13:00
int ret ;
2020-05-06 09:28:25 +12:00
char * expected ;
2021-01-13 08:51:54 +13:00
int expected_symbology ;
2019-10-17 22:06:21 +13:00
} ;
2022-07-21 23:29:53 +12:00
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
2019-10-17 22:06:21 +13:00
struct item data [ ] = {
2023-02-11 03:44:10 +13:00
/* 0*/ { BARCODE_CODE128 , - 1 , " 1234 " , - 1 , - 1 , 3 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_ERROR_INVALID_OPTION , " Error 217: Symbology does not support ECI switching " , - 1 } ,
/* 1*/ { BARCODE_CODE128 , - 1 , " 1234 " , - 1 , - 1 , 0 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , 0 , " " , - 1 } ,
/* 2*/ { BARCODE_QRCODE , - 1 , " 1234 " , - 1 , - 1 , 3 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , 0 , " " , - 1 } ,
/* 3*/ { BARCODE_QRCODE , - 1 , " 1234 " , - 1 , - 1 , 999999 + 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_ERROR_INVALID_OPTION , " Error 218: Invalid ECI code 1000000 " , - 1 } ,
/* 4*/ { BARCODE_CODE128 , - 1 , " 1234 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , 0.009 , - 1 , 0 , - 1 , - 1 , ZINT_ERROR_INVALID_OPTION , " Error 227: Scale out of range (0.01 to 200) " , - 1 } ,
/* 5*/ { BARCODE_CODE128 , - 1 , " 1234 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , 200.01 , - 1 , 0 , - 1 , - 1 , ZINT_ERROR_INVALID_OPTION , " Error 227: Scale out of range (0.01 to 200) " , - 1 } ,
/* 6*/ { BARCODE_CODE128 , - 1 , " 1234 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , 20.1 , 0 , - 1 , - 1 , ZINT_ERROR_INVALID_OPTION , " Error 221: Dot size out of range (0.01 to 20) " , - 1 } ,
/* 7*/ { BARCODE_CODE128 , - 1 , " 1234 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , 0.01 , 0.009 , 0 , - 1 , - 1 , ZINT_ERROR_INVALID_OPTION , " Error 221: Dot size out of range (0.01 to 20) " , - 1 } ,
/* 8*/ { BARCODE_CODE128 , - 1 , " 1234 " , - 1 , - 1 , - 1 , - 0.1 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_ERROR_INVALID_OPTION , " Error 765: Height out of range (0 to 2000) " , - 1 } ,
/* 9*/ { BARCODE_CODE128 , - 1 , " 1234 " , - 1 , - 1 , - 1 , 2000.01 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_ERROR_INVALID_OPTION , " Error 765: Height out of range (0 to 2000) " , - 1 } ,
/* 10*/ { BARCODE_CODE128 , - 1 , " 1234 " , - 1 , - 1 , - 1 , 0 , - 1 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_ERROR_INVALID_OPTION , " Error 766: Whitespace width out of range (0 to 100) " , - 1 } ,
/* 11*/ { BARCODE_CODE128 , - 1 , " 1234 " , - 1 , - 1 , - 1 , 0 , 101 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_ERROR_INVALID_OPTION , " Error 766: Whitespace width out of range (0 to 100) " , - 1 } ,
/* 12*/ { BARCODE_CODE128 , - 1 , " 1234 " , - 1 , - 1 , - 1 , 0 , 0 , - 1 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_ERROR_INVALID_OPTION , " Error 767: Whitespace height out of range (0 to 100) " , - 1 } ,
/* 13*/ { BARCODE_CODE128 , - 1 , " 1234 " , - 1 , - 1 , - 1 , 0 , 0 , 101 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_ERROR_INVALID_OPTION , " Error 767: Whitespace height out of range (0 to 100) " , - 1 } ,
/* 14*/ { BARCODE_CODE128 , - 1 , " 1234 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , - 1 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_ERROR_INVALID_OPTION , " Error 768: Border width out of range (0 to 100) " , - 1 } ,
/* 15*/ { BARCODE_CODE128 , - 1 , " 1234 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 101 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_ERROR_INVALID_OPTION , " Error 768: Border width out of range (0 to 100) " , - 1 } ,
/* 16*/ { BARCODE_CODE128 , - 1 , " 1234 " , - 1 , GS1_MODE , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_ERROR_INVALID_OPTION , " Error 220: Selected symbology does not support GS1 mode " , - 1 } ,
/* 17*/ { BARCODE_EANX , - 1 , " 123456789012 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 101 , - 1 , - 1 , - 0.1 , - 1 , - 1 , ZINT_ERROR_INVALID_OPTION , " Error 219: Text gap out of range (0 to 5) " , - 1 } ,
/* 18*/ { BARCODE_EANX , - 1 , " 123456789012 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 101 , - 1 , - 1 , 5.1 , - 1 , - 1 , ZINT_ERROR_INVALID_OPTION , " Error 219: Text gap out of range (0 to 5) " , - 1 } ,
/* 19*/ { BARCODE_EANX , - 1 , " 123456789012 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 101 , - 1 , - 1 , 0 , - 0.5 , - 1 , ZINT_ERROR_INVALID_OPTION , " Error 769: Guard bar descent out of range (0 to 50) " , - 1 } ,
/* 20*/ { BARCODE_EANX , - 1 , " 123456789012 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 101 , - 1 , - 1 , 0 , 50.1 , - 1 , ZINT_ERROR_INVALID_OPTION , " Error 769: Guard bar descent out of range (0 to 50) " , - 1 } ,
/* 21*/ { BARCODE_GS1_128 , - 1 , " [21]12 \000 4 " , 8 , GS1_MODE , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_ERROR_INVALID_DATA , " Error 262: NUL characters not permitted in GS1 mode " , - 1 } ,
/* 22*/ { BARCODE_GS1_128 , - 1 , " [21]12é4 " , - 1 , GS1_MODE , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_ERROR_INVALID_DATA , " Error 250: Extended ASCII characters are not supported by GS1 " , - 1 } ,
/* 23*/ { BARCODE_GS1_128 , - 1 , " [21]12 \007 4 " , - 1 , GS1_MODE , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_ERROR_INVALID_DATA , " Error 251: Control characters are not supported by GS1 " , - 1 } ,
/* 24*/ { BARCODE_GS1_128 , - 1 , " [21]1234 " , - 1 , GS1_MODE , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , 0 , " " , - 1 } ,
/* 25*/ { 0 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_WARN_INVALID_OPTION , " Warning 206: Symbology out of range " , BARCODE_CODE128 } ,
/* 26*/ { 0 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , ZINT_ERROR_INVALID_OPTION , " Error 206: Symbology out of range " , - 1 } ,
/* 27*/ { 0 , - 1 , " 1 " , - 1 , - 1 , 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_ERROR_INVALID_OPTION , " Error 217: Symbology does not support ECI switching " , BARCODE_CODE128 } , /* Not supporting beats invalid ECI */
/* 28*/ { 0 , - 1 , " 1 " , - 1 , - 1 , 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , ZINT_ERROR_INVALID_OPTION , " Error 206: Symbology out of range " , - 1 } ,
/* 29*/ { 0 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , 0.009 , 0 , - 1 , - 1 , ZINT_ERROR_INVALID_OPTION , " Error 221: Dot size out of range (0.01 to 20) " , BARCODE_CODE128 } ,
/* 30*/ { 0 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , 0.009 , 0 , - 1 , WARN_FAIL_ALL , ZINT_ERROR_INVALID_OPTION , " Error 206: Symbology out of range " , - 1 } ,
/* 31*/ { 0 , - 1 , " 1 " , - 1 , - 1 , 1 , 0 , 0 , 0 , 0 , - 1 , 0.009 , 0 , - 1 , - 1 , ZINT_ERROR_INVALID_OPTION , " Error 217: Symbology does not support ECI switching " , BARCODE_CODE128 } , /* Invalid dot size no longer beats invalid ECI */
/* 32*/ { 0 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , 0.009 , 0 , - 1 , WARN_FAIL_ALL , ZINT_ERROR_INVALID_OPTION , " Error 206: Symbology out of range " , - 1 } ,
/* 33*/ { 5 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , 0 , " " , BARCODE_C25STANDARD } ,
/* 34*/ { 5 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , 0 , " " , BARCODE_C25STANDARD } ,
/* 35*/ { 10 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , 0 , " " , BARCODE_EANX } ,
/* 36*/ { 10 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , 0 , " " , BARCODE_EANX } ,
/* 37*/ { 11 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , 0 , " " , BARCODE_EANX } ,
/* 38*/ { 11 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , 0 , " " , BARCODE_EANX } ,
/* 39*/ { 12 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , 0 , " " , BARCODE_EANX } ,
/* 40*/ { 12 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , 0 , " " , BARCODE_EANX } ,
/* 41*/ { 15 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , 0 , " " , BARCODE_EANX } ,
/* 42*/ { 15 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , 0 , " " , BARCODE_EANX } ,
/* 43*/ { 17 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , 0 , " " , BARCODE_UPCA } ,
/* 44*/ { 17 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , 0 , " " , BARCODE_UPCA } ,
/* 45*/ { 19 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_ERROR_TOO_LONG , " Error 362: Input too short (3 character minimum) " , BARCODE_CODABAR } ,
/* 46*/ { 19 , - 1 , " A1B " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_WARN_INVALID_OPTION , " Warning 207: Codabar 18 not supported " , BARCODE_CODABAR } ,
/* 47*/ { 19 , - 1 , " A1B " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , ZINT_ERROR_INVALID_OPTION , " Error 207: Codabar 18 not supported " , - 1 } ,
/* 48*/ { 26 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , 0 , " " , BARCODE_UPCA } ,
/* 49*/ { 26 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , 0 , " " , BARCODE_UPCA } ,
/* 50*/ { 27 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_ERROR_INVALID_OPTION , " Error 208: UPCD1 not supported " , 27 } ,
/* 51*/ { 33 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_ERROR_INVALID_DATA , " Error 252: Data does not start with an AI " , BARCODE_GS1_128 } ,
/* 52*/ { 33 , - 1 , " [10]23 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , 0 , " " , BARCODE_GS1_128 } ,
/* 53*/ { 33 , - 1 , " [10]23 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , 0 , " " , BARCODE_GS1_128 } ,
/* 54*/ { 36 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , 0 , " " , BARCODE_UPCA } ,
/* 55*/ { 36 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , 0 , " " , BARCODE_UPCA } ,
/* 56*/ { 39 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , 0 , " " , BARCODE_UPCE } ,
/* 57*/ { 39 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , 0 , " " , BARCODE_UPCE } ,
/* 58*/ { 41 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_WARN_NONCOMPLIANT , " Warning 479: Input length is not standard (5, 9 or 11 characters) " , BARCODE_POSTNET } ,
/* 59*/ { 41 , - 1 , " 12345 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , 0 , " " , BARCODE_POSTNET } ,
/* 60*/ { 41 , - 1 , " 12345 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , 0 , " " , BARCODE_POSTNET } ,
/* 61*/ { 42 , - 1 , " 12345 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , 0 , " " , BARCODE_POSTNET } ,
/* 62*/ { 42 , - 1 , " 12345 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , 0 , " " , BARCODE_POSTNET } ,
/* 63*/ { 43 , - 1 , " 12345 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , 0 , " " , BARCODE_POSTNET } ,
/* 64*/ { 43 , - 1 , " 12345 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , 0 , " " , BARCODE_POSTNET } ,
/* 65*/ { 44 , - 1 , " 12345 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , 0 , " " , BARCODE_POSTNET } ,
/* 66*/ { 44 , - 1 , " 12345 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , 0 , " " , BARCODE_POSTNET } ,
/* 67*/ { 45 , - 1 , " 12345 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , 0 , " " , BARCODE_POSTNET } ,
/* 68*/ { 45 , - 1 , " 12345 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , 0 , " " , BARCODE_POSTNET } ,
/* 69*/ { 46 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , 0 , " " , BARCODE_PLESSEY } ,
/* 70*/ { 46 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , 0 , " " , BARCODE_PLESSEY } ,
/* 71*/ { 48 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , 0 , " " , BARCODE_NVE18 } ,
/* 72*/ { 48 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , 0 , " " , BARCODE_NVE18 } ,
/* 73*/ { 59 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , 0 , " " , BARCODE_CODE128 } ,
/* 74*/ { 59 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , 0 , " " , BARCODE_CODE128 } ,
/* 75*/ { 61 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , 0 , " " , BARCODE_CODE128 } ,
/* 76*/ { 61 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , 0 , " " , BARCODE_CODE128 } ,
/* 77*/ { 62 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , 0 , " " , BARCODE_CODE93 } ,
/* 78*/ { 62 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , 0 , " " , BARCODE_CODE93 } ,
/* 79*/ { 64 , - 1 , " 12345678 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , 0 , " " , BARCODE_AUSPOST } ,
/* 80*/ { 64 , - 1 , " 12345678 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , 0 , " " , BARCODE_AUSPOST } ,
/* 81*/ { 65 , - 1 , " 12345678 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , 0 , " " , BARCODE_AUSPOST } ,
/* 82*/ { 65 , - 1 , " 12345678 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , 0 , " " , BARCODE_AUSPOST } ,
/* 83*/ { 78 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , 0 , " " , BARCODE_DBAR_OMN } ,
/* 84*/ { 78 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , 0 , " " , BARCODE_DBAR_OMN } ,
/* 85*/ { 83 , - 1 , " 12345678901 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , 0 , " " , BARCODE_PLANET } ,
/* 86*/ { 83 , - 1 , " 12345678901 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , 0 , " " , BARCODE_PLANET } ,
/* 87*/ { 88 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_ERROR_INVALID_DATA , " Error 252: Data does not start with an AI " , BARCODE_GS1_128 } ,
/* 88*/ { 88 , - 1 , " [10]12 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , 0 , " " , BARCODE_GS1_128 } ,
/* 89*/ { 88 , - 1 , " [10]12 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , 0 , " " , BARCODE_GS1_128 } ,
/* 90*/ { 91 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_WARN_INVALID_OPTION , " Warning 212: Symbology out of range " , BARCODE_CODE128 } ,
/* 91*/ { 91 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , ZINT_ERROR_INVALID_OPTION , " Error 212: Symbology out of range " , - 1 } ,
/* 92*/ { 94 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_WARN_INVALID_OPTION , " Warning 213: Symbology out of range " , BARCODE_CODE128 } ,
/* 93*/ { 94 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , ZINT_ERROR_INVALID_OPTION , " Error 213: Symbology out of range " , - 1 } ,
/* 94*/ { 95 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_WARN_INVALID_OPTION , " Warning 213: Symbology out of range " , BARCODE_CODE128 } ,
/* 95*/ { 95 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , ZINT_ERROR_INVALID_OPTION , " Error 213: Symbology out of range " , - 1 } ,
/* 96*/ { 100 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , 0 , " " , BARCODE_HIBC_128 } ,
/* 97*/ { 100 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , 0 , " " , BARCODE_HIBC_128 } ,
/* 98*/ { 101 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , 0 , " " , BARCODE_HIBC_39 } ,
/* 99*/ { 101 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , 0 , " " , BARCODE_HIBC_39 } ,
/*100*/ { 103 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , 0 , " " , BARCODE_HIBC_DM } ,
/*101*/ { 103 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , 0 , " " , BARCODE_HIBC_DM } ,
/*102*/ { 105 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , 0 , " " , BARCODE_HIBC_QR } ,
/*103*/ { 105 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , 0 , " " , BARCODE_HIBC_QR } ,
/*104*/ { 107 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , 0 , " " , BARCODE_HIBC_PDF } ,
/*105*/ { 107 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , 0 , " " , BARCODE_HIBC_PDF } ,
/*106*/ { 109 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , 0 , " " , BARCODE_HIBC_MICPDF } ,
/*107*/ { 109 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , 0 , " " , BARCODE_HIBC_MICPDF } ,
/*108*/ { 111 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , 0 , " " , BARCODE_HIBC_BLOCKF } ,
/*109*/ { 111 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , 0 , " " , BARCODE_HIBC_BLOCKF } ,
/*110*/ { 113 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_WARN_INVALID_OPTION , " Warning 214: Symbology out of range " , BARCODE_CODE128 } ,
/*111*/ { 113 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , ZINT_ERROR_INVALID_OPTION , " Error 214: Symbology out of range " , - 1 } ,
/*112*/ { 114 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_WARN_INVALID_OPTION , " Warning 214: Symbology out of range " , BARCODE_CODE128 } ,
/*113*/ { 114 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , ZINT_ERROR_INVALID_OPTION , " Error 214: Symbology out of range " , - 1 } ,
/*114*/ { 117 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_WARN_INVALID_OPTION , " Warning 215: Symbology out of range " , BARCODE_CODE128 } ,
/*115*/ { 117 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , ZINT_ERROR_INVALID_OPTION , " Error 215: Symbology out of range " , - 1 } ,
/*116*/ { 118 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_WARN_INVALID_OPTION , " Warning 215: Symbology out of range " , BARCODE_CODE128 } ,
/*117*/ { 118 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , ZINT_ERROR_INVALID_OPTION , " Error 215: Symbology out of range " , - 1 } ,
/*118*/ { 122 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_WARN_INVALID_OPTION , " Warning 215: Symbology out of range " , BARCODE_CODE128 } ,
/*119*/ { 122 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , ZINT_ERROR_INVALID_OPTION , " Error 215: Symbology out of range " , - 1 } ,
/*120*/ { 123 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_WARN_INVALID_OPTION , " Warning 215: Symbology out of range " , BARCODE_CODE128 } ,
/*121*/ { 123 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , ZINT_ERROR_INVALID_OPTION , " Error 215: Symbology out of range " , - 1 } ,
/*122*/ { 124 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_WARN_INVALID_OPTION , " Warning 215: Symbology out of range " , BARCODE_CODE128 } ,
/*123*/ { 124 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , ZINT_ERROR_INVALID_OPTION , " Error 215: Symbology out of range " , - 1 } ,
/*124*/ { 125 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_WARN_INVALID_OPTION , " Warning 215: Symbology out of range " , BARCODE_CODE128 } ,
/*125*/ { 125 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , ZINT_ERROR_INVALID_OPTION , " Error 215: Symbology out of range " , - 1 } ,
/*126*/ { 126 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_WARN_INVALID_OPTION , " Warning 215: Symbology out of range " , BARCODE_CODE128 } ,
/*127*/ { 126 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , ZINT_ERROR_INVALID_OPTION , " Error 215: Symbology out of range " , - 1 } ,
/*128*/ { 127 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_WARN_INVALID_OPTION , " Warning 215: Symbology out of range " , BARCODE_CODE128 } ,
/*129*/ { 127 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , ZINT_ERROR_INVALID_OPTION , " Error 215: Symbology out of range " , - 1 } ,
/*130*/ { 147 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_WARN_INVALID_OPTION , " Warning 216: Symbology out of range " , BARCODE_CODE128 } ,
/*131*/ { 147 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , ZINT_ERROR_INVALID_OPTION , " Error 216: Symbology out of range " , - 1 } ,
/*132*/ { BARCODE_LAST + 1 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_WARN_INVALID_OPTION , " Warning 216: Symbology out of range " , BARCODE_CODE128 } ,
/*133*/ { BARCODE_LAST + 1 , - 1 , " 1 " , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , ZINT_ERROR_INVALID_OPTION , " Error 216: Symbology out of range " , - 1 } ,
/*134*/ { BARCODE_CODE128 , - 1 , " \200 " , - 1 , UNICODE_MODE , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_ERROR_INVALID_DATA , " Error 245: Invalid UTF-8 in input data " , - 1 } ,
/*135*/ { BARCODE_GS1_128 , - 1 , " [01]12345678901234 " , - 1 , GS1_MODE , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_WARN_NONCOMPLIANT , " Warning 261: AI (01) position 14: Bad checksum '4', expected '1' " , - 1 } ,
/*136*/ { BARCODE_GS1_128 , - 1 , " [01]12345678901234 " , - 1 , GS1_MODE , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , ZINT_ERROR_NONCOMPLIANT , " Error 261: AI (01) position 14: Bad checksum '4', expected '1' " , - 1 } ,
/*137*/ { BARCODE_QRCODE , - 1 , " ก " , - 1 , UNICODE_MODE , 13 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , 0 , " " , - 1 } ,
/*138*/ { BARCODE_QRCODE , - 1 , " ก " , - 1 , UNICODE_MODE , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_WARN_USES_ECI , " Warning 222: Encoded data includes ECI 13 " , - 1 } ,
/*139*/ { BARCODE_QRCODE , - 1 , " ก " , - 1 , UNICODE_MODE , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , ZINT_ERROR_USES_ECI , " Error 222: Encoded data includes ECI 13 " , - 1 } ,
/*140*/ { BARCODE_CODEONE , - 1 , " [01]12345678901231 " , - 1 , GS1_MODE , 3 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_WARN_INVALID_OPTION , " Warning 512: ECI ignored for GS1 mode " , - 1 } ,
/*141*/ { BARCODE_CODEONE , - 1 , " [01]12345678901231 " , - 1 , GS1_MODE , 3 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , ZINT_ERROR_INVALID_OPTION , " Error 512: ECI ignored for GS1 mode " , - 1 } ,
/*142*/ { BARCODE_CODEONE , - 1 , " [01]12345678901234 " , - 1 , GS1_MODE , 3 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_WARN_INVALID_OPTION , " Warning 512: ECI ignored for GS1 mode " , - 1 } , /* Warning in encoder overrides library warnings */
/*143*/ { BARCODE_CODEONE , - 1 , " [01]12345678901234 " , - 1 , GS1_MODE , 3 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , ZINT_ERROR_NONCOMPLIANT , " Error 261: AI (01) position 14: Bad checksum '4', expected '1' " , - 1 } , /* But not errors */
/*144*/ { BARCODE_AZTEC , - 1 , " ก " , - 1 , UNICODE_MODE , 13 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , 0 , " " , - 1 } ,
/*145*/ { BARCODE_AZTEC , - 1 , " ก " , - 1 , UNICODE_MODE , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_WARN_USES_ECI , " Warning 222: Encoded data includes ECI 13 " , - 1 } ,
/*146*/ { BARCODE_AZTEC , - 1 , " ก " , - 1 , UNICODE_MODE , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , ZINT_ERROR_USES_ECI , " Error 222: Encoded data includes ECI 13 " , - 1 } ,
/*147*/ { BARCODE_AZTEC , 6 , " ก " , - 1 , UNICODE_MODE , 13 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_WARN_INVALID_OPTION , " Warning 503: Invalid error correction level - using default instead " , - 1 } ,
/*148*/ { BARCODE_AZTEC , 6 , " ก " , - 1 , UNICODE_MODE , 13 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , ZINT_ERROR_INVALID_OPTION , " Error 503: Invalid error correction level - using default instead " , - 1 } ,
/*149*/ { BARCODE_AZTEC , 6 , " ก " , - 1 , UNICODE_MODE , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , - 1 , ZINT_WARN_USES_ECI , " Warning 222: Encoded data includes ECI 13 " , - 1 } , /* ECI warning trumps all other warnings */
/*150*/ { BARCODE_AZTEC , 6 , " ก " , - 1 , UNICODE_MODE , - 1 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , - 1 , WARN_FAIL_ALL , ZINT_ERROR_INVALID_OPTION , " Error 503: Invalid error correction level - using default instead " , - 1 } , /* But not errors */
2019-10-17 22:06:21 +13:00
} ;
2021-01-21 10:15:03 +13:00
int data_size = ARRAY_SIZE ( data ) ;
2021-06-24 02:00:49 +12:00
int i , length , ret ;
struct zint_symbol * symbol ;
2019-10-17 22:06:21 +13:00
2021-06-24 02:00:49 +12:00
testStart ( " test_checks " ) ;
for ( i = 0 ; i < data_size ; i + + ) {
2019-10-17 22:06:21 +13:00
2022-09-13 06:26:04 +12:00
if ( testContinue ( p_ctx , i ) ) continue ;
2020-05-06 09:28:25 +12:00
2021-06-24 02:00:49 +12:00
symbol = ZBarcode_Create ( ) ;
2019-10-17 22:06:21 +13:00
assert_nonnull ( symbol , " Symbol not created \n " ) ;
2021-07-07 06:53:31 +12:00
length = testUtilSetSymbol ( symbol , data [ i ] . symbology , data [ i ] . input_mode , data [ i ] . eci , data [ i ] . option_1 , - 1 , - 1 , - 1 /*output_options*/ , data [ i ] . data , data [ i ] . length , debug ) ;
2021-09-21 01:56:27 +12:00
if ( data [ i ] . height ) {
symbol - > height = data [ i ] . height ;
}
if ( data [ i ] . whitespace_width ) {
symbol - > whitespace_width = data [ i ] . whitespace_width ;
}
if ( data [ i ] . whitespace_height ) {
symbol - > whitespace_height = data [ i ] . whitespace_height ;
}
if ( data [ i ] . border_width ) {
symbol - > border_width = data [ i ] . border_width ;
}
if ( data [ i ] . scale ! = - 1 ) {
symbol - > scale = data [ i ] . scale ;
}
2019-10-17 22:06:21 +13:00
if ( data [ i ] . dot_size ! = - 1 ) {
symbol - > dot_size = data [ i ] . dot_size ;
}
2023-02-11 03:44:10 +13:00
if ( data [ i ] . text_gap ) {
symbol - > text_gap = data [ i ] . text_gap ;
}
2021-09-22 11:04:15 +12:00
if ( data [ i ] . guard_descent ! = - 1 ) {
symbol - > guard_descent = data [ i ] . guard_descent ;
}
2020-11-02 07:32:55 +13:00
if ( data [ i ] . warn_level ! = - 1 ) {
symbol - > warn_level = data [ i ] . warn_level ;
}
2019-10-17 22:06:21 +13:00
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
ret = ZBarcode_Encode ( symbol , TU ( data [ i ] . data ) , length ) ;
2019-10-17 22:06:21 +13:00
assert_equal ( ret , data [ i ] . ret , " i:%d ZBarcode_Encode(%d) ret %d != %d (%s) \n " , i , data [ i ] . symbology , ret , data [ i ] . ret , symbol - > errtxt ) ;
ret = strcmp ( symbol - > errtxt , data [ i ] . expected ) ;
assert_zero ( ret , " i:%d (%d) strcmp(%s, %s) %d != 0 \n " , i , data [ i ] . symbology , symbol - > errtxt , data [ i ] . expected , ret ) ;
2021-01-13 08:51:54 +13:00
if ( data [ i ] . expected_symbology = = - 1 ) {
assert_equal ( symbol - > symbology , data [ i ] . symbology , " i:%d symbol->symbology %d != original %d \n " , i , symbol - > symbology , data [ i ] . symbology ) ;
} else {
assert_equal ( symbol - > symbology , data [ i ] . expected_symbology , " i:%d symbol->symbology %d != expected %d \n " , i , symbol - > symbology , data [ i ] . expected_symbology ) ;
}
2019-10-17 22:06:21 +13:00
ZBarcode_Delete ( symbol ) ;
}
testFinish ( ) ;
}
2022-09-13 06:26:04 +12:00
static void test_checks_segs ( const testCtx * const p_ctx ) {
int debug = p_ctx - > debug ;
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
struct item {
int symbology ;
int option_1 ;
struct zint_seg segs [ 2 ] ;
int seg_count ;
int input_mode ;
int eci ;
int warn_level ;
int ret ;
char * expected ;
} ;
2022-07-21 23:29:53 +12:00
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
struct item data [ ] = {
RMQR: update to ISO/IEC 23941:2022 - R13x77 numeric cclens change 8 -> 7
QRCODE: use stricter interpretation of ZINT_FULL_MULTIBYTE, excluding
certain trailing bytes
libzint: fix some confusing error messages introduced by segment stuff
general: new escape chars \U, \d and \o
backend_qt: fudge rendering of border rectangles due to scaling/translation
rounding errors TODO: better fudge
GUI: foreground/background colours -> text boxes and icon buttons, add swap
button, independently movable picker (NULL parent), preview colour changes,
preview Data Window changes, add clear data (del) buttons, add zap button
and Factory Reset menu option, various other fixes
libzint: remove STATIC_UNLESS_ZINT_TEST, use wrappers
CMake: add find package QtSvg, remove QtXml
manual: split symbology and general specs and sort, move DAFT to 4-state,
UPC/EAN -> EAN/UPC, DataBar -> GS1 DataBar always, expand MAILMARK info,
various other fiddlings
man page: options or -> |, expand MSI Plessey check digit options
README.linux: add packages info
license: add SPDX-License-Identifier to touched files
2022-06-10 08:52:02 +12:00
/* 0*/ { BARCODE_CODE128 , - 1 , { { NULL , 0 , 0 } , { NULL , 0 , 0 } } , 0 , - 1 , - 1 , - 1 , ZINT_ERROR_INVALID_DATA , " Error 205: No input data " } ,
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
/* 1*/ { BARCODE_CODE128 , - 1 , { { NULL , 0 , 0 } , { NULL , 0 , 0 } } , 257 , - 1 , - 1 , - 1 , ZINT_ERROR_INVALID_DATA , " Error 771: Too many input segments (max 256) " } ,
/* 2*/ { BARCODE_CODE128 , - 1 , { { NULL , 0 , 0 } , { NULL , 0 , 0 } } , 1 , - 1 , - 1 , - 1 , ZINT_ERROR_INVALID_DATA , " Error 772: Input segment 0 source NULL " } ,
RMQR: update to ISO/IEC 23941:2022 - R13x77 numeric cclens change 8 -> 7
QRCODE: use stricter interpretation of ZINT_FULL_MULTIBYTE, excluding
certain trailing bytes
libzint: fix some confusing error messages introduced by segment stuff
general: new escape chars \U, \d and \o
backend_qt: fudge rendering of border rectangles due to scaling/translation
rounding errors TODO: better fudge
GUI: foreground/background colours -> text boxes and icon buttons, add swap
button, independently movable picker (NULL parent), preview colour changes,
preview Data Window changes, add clear data (del) buttons, add zap button
and Factory Reset menu option, various other fixes
libzint: remove STATIC_UNLESS_ZINT_TEST, use wrappers
CMake: add find package QtSvg, remove QtXml
manual: split symbology and general specs and sort, move DAFT to 4-state,
UPC/EAN -> EAN/UPC, DataBar -> GS1 DataBar always, expand MAILMARK info,
various other fiddlings
man page: options or -> |, expand MSI Plessey check digit options
README.linux: add packages info
license: add SPDX-License-Identifier to touched files
2022-06-10 08:52:02 +12:00
/* 3*/ { BARCODE_CODE128 , - 1 , { { TU ( " " ) , 0 , 0 } , { NULL , 0 , 0 } } , 1 , - 1 , - 1 , - 1 , ZINT_ERROR_INVALID_DATA , " Error 778: No input data " } ,
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
/* 4*/ { BARCODE_CODE128 , - 1 , { { TU ( " A " ) , 0 , 0 } , { NULL , 0 , 0 } } , 2 , - 1 , - 1 , - 1 , ZINT_ERROR_INVALID_DATA , " Error 772: Input segment 1 source NULL " } ,
RMQR: update to ISO/IEC 23941:2022 - R13x77 numeric cclens change 8 -> 7
QRCODE: use stricter interpretation of ZINT_FULL_MULTIBYTE, excluding
certain trailing bytes
libzint: fix some confusing error messages introduced by segment stuff
general: new escape chars \U, \d and \o
backend_qt: fudge rendering of border rectangles due to scaling/translation
rounding errors TODO: better fudge
GUI: foreground/background colours -> text boxes and icon buttons, add swap
button, independently movable picker (NULL parent), preview colour changes,
preview Data Window changes, add clear data (del) buttons, add zap button
and Factory Reset menu option, various other fixes
libzint: remove STATIC_UNLESS_ZINT_TEST, use wrappers
CMake: add find package QtSvg, remove QtXml
manual: split symbology and general specs and sort, move DAFT to 4-state,
UPC/EAN -> EAN/UPC, DataBar -> GS1 DataBar always, expand MAILMARK info,
various other fiddlings
man page: options or -> |, expand MSI Plessey check digit options
README.linux: add packages info
license: add SPDX-License-Identifier to touched files
2022-06-10 08:52:02 +12:00
/* 4*/ { BARCODE_CODE128 , - 1 , { { TU ( " A " ) , 0 , 0 } , { TU ( " " ) , 0 , 0 } } , 2 , - 1 , - 1 , - 1 , ZINT_ERROR_INVALID_DATA , " Error 773: Input segment 1 empty " } ,
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
/* 5*/ { BARCODE_CODE128 , - 1 , { { TU ( " A " ) , 0 , 3 } , { TU ( " B " ) , 0 , 0 } } , 2 , - 1 , 4 , - 1 , ZINT_ERROR_INVALID_OPTION , " Error 774: Symbol ECI 4 must match segment zero ECI 3 " } ,
/* 6*/ { BARCODE_CODE128 , - 1 , { { TU ( " A " ) , 0 , 3 } , { TU ( " B " ) , 0 , 4 } } , 2 , - 1 , - 1 , - 1 , ZINT_ERROR_INVALID_OPTION , " Error 775: Symbology does not support multiple segments " } ,
/* 7*/ { BARCODE_CODE128 , - 1 , { { TU ( " A " ) , 0 , 3 } , { NULL , 0 , 0 } } , 1 , - 1 , - 1 , - 1 , ZINT_ERROR_INVALID_OPTION , " Error 217: Symbology does not support ECI switching " } ,
/* 8*/ { BARCODE_AZTEC , - 1 , { { TU ( " A " ) , 0 , 3 } , { TU ( " B " ) , 0 , 1 } } , 2 , - 1 , - 1 , - 1 , ZINT_ERROR_INVALID_OPTION , " Error 218: Invalid ECI code 1 " } ,
2022-06-17 03:47:34 +12:00
/* 9*/ { BARCODE_AZTEC , - 1 , { { TU ( " A " ) , 0 , 3 } , { TU ( " B " ) , 0 , 4 } } , 2 , GS1_MODE , - 1 , - 1 , ZINT_ERROR_INVALID_OPTION , " Error 776: GS1 mode not supported for multiple segments " } ,
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
/* 10*/ { BARCODE_AZTEC , - 1 , { { TU ( " A " ) , 0 , 3 } , { TU ( " \200 " ) , 0 , 4 } } , 2 , UNICODE_MODE , - 1 , - 1 , ZINT_ERROR_INVALID_DATA , " Error 245: Invalid UTF-8 in input data " } ,
/* 11*/ { BARCODE_AZTEC , - 1 , { { TU ( " A " ) , 0 , 3 } , { TU ( " B " ) , 0 , 4 } } , 2 , - 1 , - 1 , - 1 , 0 , " " } ,
/* 12*/ { BARCODE_AZTEC , - 1 , { { TU ( " A " ) , 0 , 0 } , { TU ( " B " ) , 0 , 4 } } , 2 , - 1 , 3 , - 1 , 0 , " " } ,
/* 13*/ { BARCODE_AZTEC , - 1 , { { TU ( " A " ) , ZINT_MAX_DATA_LEN , 3 } , { TU ( " B " ) , 1 , 4 } } , 2 , - 1 , - 1 , - 1 , ZINT_ERROR_TOO_LONG , " Error 243: Input data too long " } ,
} ;
int data_size = ARRAY_SIZE ( data ) ;
int i , ret ;
struct zint_symbol * symbol ;
testStart ( " test_checks_segs " ) ;
for ( i = 0 ; i < data_size ; i + + ) {
2022-09-13 06:26:04 +12:00
if ( testContinue ( p_ctx , i ) ) continue ;
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
symbol = ZBarcode_Create ( ) ;
assert_nonnull ( symbol , " Symbol not created \n " ) ;
testUtilSetSymbol ( symbol , data [ i ] . symbology , data [ i ] . input_mode , data [ i ] . eci , data [ i ] . option_1 , - 1 , - 1 , - 1 /*output_options*/ , NULL , 0 , debug ) ;
if ( data [ i ] . warn_level ! = - 1 ) {
symbol - > warn_level = data [ i ] . warn_level ;
}
ret = ZBarcode_Encode_Segs ( symbol , data [ i ] . segs , data [ i ] . seg_count ) ;
assert_equal ( ret , data [ i ] . ret , " i:%d ZBarcode_Encode_Segs(%d) ret %d != %d (%s) \n " , i , data [ i ] . symbology , ret , data [ i ] . ret , symbol - > errtxt ) ;
ret = strcmp ( symbol - > errtxt , data [ i ] . expected ) ;
assert_zero ( ret , " i:%d (%d) strcmp(%s, %s) %d != 0 \n " , i , data [ i ] . symbology , symbol - > errtxt , data [ i ] . expected , ret ) ;
ZBarcode_Delete ( symbol ) ;
}
testFinish ( ) ;
}
2022-09-13 06:26:04 +12:00
static void test_input_data ( const testCtx * const p_ctx ) {
int debug = p_ctx - > debug ;
RMQR: update to ISO/IEC 23941:2022 - R13x77 numeric cclens change 8 -> 7
QRCODE: use stricter interpretation of ZINT_FULL_MULTIBYTE, excluding
certain trailing bytes
libzint: fix some confusing error messages introduced by segment stuff
general: new escape chars \U, \d and \o
backend_qt: fudge rendering of border rectangles due to scaling/translation
rounding errors TODO: better fudge
GUI: foreground/background colours -> text boxes and icon buttons, add swap
button, independently movable picker (NULL parent), preview colour changes,
preview Data Window changes, add clear data (del) buttons, add zap button
and Factory Reset menu option, various other fixes
libzint: remove STATIC_UNLESS_ZINT_TEST, use wrappers
CMake: add find package QtSvg, remove QtXml
manual: split symbology and general specs and sort, move DAFT to 4-state,
UPC/EAN -> EAN/UPC, DataBar -> GS1 DataBar always, expand MAILMARK info,
various other fiddlings
man page: options or -> |, expand MSI Plessey check digit options
README.linux: add packages info
license: add SPDX-License-Identifier to touched files
2022-06-10 08:52:02 +12:00
struct item {
int symbology ;
int input_mode ;
char * data ;
int length ;
char * composite ;
int ret ;
char * expected ;
} ;
2022-07-21 23:29:53 +12:00
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
RMQR: update to ISO/IEC 23941:2022 - R13x77 numeric cclens change 8 -> 7
QRCODE: use stricter interpretation of ZINT_FULL_MULTIBYTE, excluding
certain trailing bytes
libzint: fix some confusing error messages introduced by segment stuff
general: new escape chars \U, \d and \o
backend_qt: fudge rendering of border rectangles due to scaling/translation
rounding errors TODO: better fudge
GUI: foreground/background colours -> text boxes and icon buttons, add swap
button, independently movable picker (NULL parent), preview colour changes,
preview Data Window changes, add clear data (del) buttons, add zap button
and Factory Reset menu option, various other fixes
libzint: remove STATIC_UNLESS_ZINT_TEST, use wrappers
CMake: add find package QtSvg, remove QtXml
manual: split symbology and general specs and sort, move DAFT to 4-state,
UPC/EAN -> EAN/UPC, DataBar -> GS1 DataBar always, expand MAILMARK info,
various other fiddlings
man page: options or -> |, expand MSI Plessey check digit options
README.linux: add packages info
license: add SPDX-License-Identifier to touched files
2022-06-10 08:52:02 +12:00
struct item data [ ] = {
/* 0*/ { BARCODE_CODE128 , - 1 , " 1234 " , - 1 , " " , 0 , " " } ,
/* 1*/ { BARCODE_GS1_128 , - 1 , " [01]12345678901231 " , - 1 , " " , 0 , " " } ,
/* 2*/ { BARCODE_GS1_128 , - 1 , " " , - 1 , " " , ZINT_ERROR_INVALID_DATA , " Error 778: No input data " } ,
/* 3*/ { BARCODE_GS1_128_CC , - 1 , " [01]12345678901231 " , - 1 , " [10]121212 " , 0 , " " } ,
/* 4*/ { BARCODE_GS1_128_CC , - 1 , " [01]12345678901231 " , - 1 , " " , ZINT_ERROR_INVALID_DATA , " Error 779: No composite data in 2D component " } ,
2022-06-11 23:28:48 +12:00
/* 5*/ { BARCODE_GS1_128_CC , - 1 , " " , - 1 , " [10]121212 " , ZINT_ERROR_INVALID_OPTION , " Error 445: No primary (linear) message " } ,
RMQR: update to ISO/IEC 23941:2022 - R13x77 numeric cclens change 8 -> 7
QRCODE: use stricter interpretation of ZINT_FULL_MULTIBYTE, excluding
certain trailing bytes
libzint: fix some confusing error messages introduced by segment stuff
general: new escape chars \U, \d and \o
backend_qt: fudge rendering of border rectangles due to scaling/translation
rounding errors TODO: better fudge
GUI: foreground/background colours -> text boxes and icon buttons, add swap
button, independently movable picker (NULL parent), preview colour changes,
preview Data Window changes, add clear data (del) buttons, add zap button
and Factory Reset menu option, various other fixes
libzint: remove STATIC_UNLESS_ZINT_TEST, use wrappers
CMake: add find package QtSvg, remove QtXml
manual: split symbology and general specs and sort, move DAFT to 4-state,
UPC/EAN -> EAN/UPC, DataBar -> GS1 DataBar always, expand MAILMARK info,
various other fiddlings
man page: options or -> |, expand MSI Plessey check digit options
README.linux: add packages info
license: add SPDX-License-Identifier to touched files
2022-06-10 08:52:02 +12:00
/* 6*/ { BARCODE_DATAMATRIX , - 1 , " " , - 1 , " " , ZINT_ERROR_INVALID_DATA , " Error 778: No input data (segment 0 empty) " } ,
} ;
int data_size = ARRAY_SIZE ( data ) ;
int i , length , ret ;
struct zint_symbol * symbol ;
char * text ;
testStart ( " test_input_data " ) ;
for ( i = 0 ; i < data_size ; i + + ) {
2022-09-13 06:26:04 +12:00
if ( testContinue ( p_ctx , i ) ) continue ;
RMQR: update to ISO/IEC 23941:2022 - R13x77 numeric cclens change 8 -> 7
QRCODE: use stricter interpretation of ZINT_FULL_MULTIBYTE, excluding
certain trailing bytes
libzint: fix some confusing error messages introduced by segment stuff
general: new escape chars \U, \d and \o
backend_qt: fudge rendering of border rectangles due to scaling/translation
rounding errors TODO: better fudge
GUI: foreground/background colours -> text boxes and icon buttons, add swap
button, independently movable picker (NULL parent), preview colour changes,
preview Data Window changes, add clear data (del) buttons, add zap button
and Factory Reset menu option, various other fixes
libzint: remove STATIC_UNLESS_ZINT_TEST, use wrappers
CMake: add find package QtSvg, remove QtXml
manual: split symbology and general specs and sort, move DAFT to 4-state,
UPC/EAN -> EAN/UPC, DataBar -> GS1 DataBar always, expand MAILMARK info,
various other fiddlings
man page: options or -> |, expand MSI Plessey check digit options
README.linux: add packages info
license: add SPDX-License-Identifier to touched files
2022-06-10 08:52:02 +12:00
symbol = ZBarcode_Create ( ) ;
assert_nonnull ( symbol , " Symbol not created \n " ) ;
if ( is_composite ( data [ i ] . symbology ) ) {
text = data [ i ] . composite ;
strcpy ( symbol - > primary , data [ i ] . data ) ;
} else {
text = data [ i ] . data ;
}
length = testUtilSetSymbol ( symbol , data [ i ] . symbology , data [ i ] . input_mode , - 1 /*eci*/ , - 1 /*option_1*/ , - 1 , - 1 , - 1 /*output_options*/ , text , - 1 , debug ) ;
ret = ZBarcode_Encode ( symbol , ( unsigned char * ) text , length ) ;
assert_equal ( ret , data [ i ] . ret , " i:%d ZBarcode_Encode(%d) ret %d != %d (%s) \n " , i , data [ i ] . symbology , ret , data [ i ] . ret , symbol - > errtxt ) ;
ret = strcmp ( symbol - > errtxt , data [ i ] . expected ) ;
assert_zero ( ret , " i:%d (%d) strcmp(%s, %s) %d != 0 \n " , i , data [ i ] . symbology , symbol - > errtxt , data [ i ] . expected , ret ) ;
ZBarcode_Delete ( symbol ) ;
}
testFinish ( ) ;
}
2022-09-13 06:26:04 +12:00
static void test_symbologies ( const testCtx * const p_ctx ) {
2021-07-07 06:53:31 +12:00
int i , ret ;
struct zint_symbol symbol = { 0 } ;
testStart ( " test_symbologies " ) ;
for ( i = - 1 ; i < 148 ; i + + ) {
2022-09-13 06:26:04 +12:00
if ( testContinue ( p_ctx , i ) ) continue ;
2021-07-07 06:53:31 +12:00
symbol . symbology = i ;
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
ret = ZBarcode_Encode ( & symbol , TU ( " 1 " ) , 0 ) ;
2021-07-07 06:53:31 +12:00
assert_notequal ( ret , ZINT_ERROR_ENCODING_PROBLEM , " i:%d Encoding problem (%s) \n " , i , symbol . errtxt ) ;
}
testFinish ( ) ;
}
2022-09-13 06:26:04 +12:00
static void test_input_mode ( const testCtx * const p_ctx ) {
int debug = p_ctx - > debug ;
2020-05-06 09:28:25 +12:00
2019-11-28 05:16:14 +13:00
struct item {
2020-10-04 10:51:08 +13:00
char * data ;
2019-11-28 05:16:14 +13:00
int input_mode ;
int ret ;
int expected_input_mode ;
} ;
2022-07-21 23:29:53 +12:00
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
2019-11-28 05:16:14 +13:00
struct item data [ ] = {
/* 0*/ { " 1234 " , DATA_MODE , 0 , DATA_MODE } ,
/* 1*/ { " 1234 " , DATA_MODE | ESCAPE_MODE , 0 , DATA_MODE | ESCAPE_MODE } ,
/* 2*/ { " 1234 " , UNICODE_MODE , 0 , UNICODE_MODE } ,
/* 3*/ { " 1234 " , UNICODE_MODE | ESCAPE_MODE , 0 , UNICODE_MODE | ESCAPE_MODE } ,
2021-01-21 10:15:03 +13:00
/* 4*/ { " [01]12345678901231 " , GS1_MODE , 0 , GS1_MODE } ,
/* 5*/ { " [01]12345678901231 " , GS1_MODE | ESCAPE_MODE , 0 , GS1_MODE | ESCAPE_MODE } ,
2022-07-21 23:29:53 +12:00
/* 6*/ { " 1234 " , 4 | ESCAPE_MODE , 0 , DATA_MODE } , /* Unknown mode reset to bare DATA_MODE */
2019-11-28 05:16:14 +13:00
/* 7*/ { " 1234 " , - 1 , 0 , DATA_MODE } ,
2022-07-21 23:29:53 +12:00
/* 8*/ { " 1234 " , DATA_MODE | 0x10 , 0 , DATA_MODE | 0x10 } , /* Unknown flags kept (but ignored) */
2019-11-28 05:16:14 +13:00
/* 9*/ { " 1234 " , UNICODE_MODE | 0x10 , 0 , UNICODE_MODE | 0x10 } ,
2021-01-19 09:10:52 +13:00
/* 10*/ { " [01]12345678901231 " , GS1_MODE | 0x20 , 0 , GS1_MODE | 0x20 } ,
2019-11-28 05:16:14 +13:00
} ;
2021-01-16 03:22:32 +13:00
int data_size = ARRAY_SIZE ( data ) ;
2021-06-24 02:00:49 +12:00
int i , length , ret ;
struct zint_symbol * symbol ;
testStart ( " test_input_mode " ) ;
2019-11-28 05:16:14 +13:00
2021-06-24 02:00:49 +12:00
for ( i = 0 ; i < data_size ; i + + ) {
2019-11-28 05:16:14 +13:00
2022-09-13 06:26:04 +12:00
if ( testContinue ( p_ctx , i ) ) continue ;
2020-05-06 09:28:25 +12:00
2021-06-24 02:00:49 +12:00
symbol = ZBarcode_Create ( ) ;
2019-11-28 05:16:14 +13:00
assert_nonnull ( symbol , " Symbol not created \n " ) ;
2021-06-24 02:00:49 +12:00
length = testUtilSetSymbol ( symbol , BARCODE_CODE49 /*Supports GS1*/ , data [ i ] . input_mode , - 1 /*eci*/ , - 1 /*option_1*/ , - 1 , - 1 , - 1 /*output_options*/ , data [ i ] . data , - 1 , debug ) ;
2019-11-28 05:16:14 +13:00
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
ret = ZBarcode_Encode ( symbol , TU ( data [ i ] . data ) , length ) ;
2019-11-28 05:16:14 +13:00
assert_equal ( ret , data [ i ] . ret , " i:%d ZBarcode_Encode ret %d != %d (%s) \n " , i , ret , data [ i ] . ret , symbol - > errtxt ) ;
assert_equal ( symbol - > input_mode , data [ i ] . expected_input_mode , " i:%d symbol->input_mode %d != %d \n " , i , symbol - > input_mode , data [ i ] . expected_input_mode ) ;
ZBarcode_Delete ( symbol ) ;
}
testFinish ( ) ;
}
2022-09-13 06:26:04 +12:00
static void test_escape_char_process ( const testCtx * const p_ctx ) {
int debug = p_ctx - > debug ;
2020-05-16 21:22:33 +12:00
struct item {
2021-06-30 02:43:42 +12:00
int symbology ;
2020-05-22 05:22:28 +12:00
int input_mode ;
2021-01-16 03:22:32 +13:00
int eci ;
2020-10-04 10:51:08 +13:00
char * data ;
2022-06-17 03:47:34 +12:00
char * composite ;
2020-05-16 21:22:33 +12:00
int ret ;
int expected_width ;
char * expected ;
2021-01-16 03:22:32 +13:00
int compare_previous ;
2020-05-16 21:22:33 +12:00
char * comment ;
} ;
struct item data [ ] = {
2022-06-17 03:47:34 +12:00
/* 0*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ 0 \\ E \\ a \\ b \\ t \\ n \\ v \\ f \\ r \\ e \\ G \\ R \\ x81 \\ \\ " , " " , 0 , 26 , " 01 05 08 09 0A 0B 0C 0D 0E 1C 1E 1F EB 02 5D 81 21 0D 92 2E 3D FD B6 9A 37 2A CD 61 FB 95 " , 0 , " " } ,
/* 1*/ { BARCODE_CODABLOCKF , DATA_MODE , - 1 , " \\ 0 \\ E \\ a \\ b \\ t \\ n \\ v \\ f \\ r \\ e \\ G \\ R \\ x81 \\ \\ " , " " , 0 , 101 , " (45) 67 62 43 40 44 47 48 29 6A 67 62 0B 49 4A 4B 4C 18 6A 67 62 0C 4D 5B 5D 5E 62 6A 67 " , 0 , " " } ,
/* 2*/ { BARCODE_CODE16K , DATA_MODE , - 1 , " \\ 0 \\ E \\ a \\ b \\ t \\ n \\ v \\ f \\ r \\ e \\ G \\ R \\ x81 \\ \\ " , " " , 0 , 70 , " (20) 14 64 68 71 72 73 74 75 76 77 91 93 94 101 65 60 103 103 45 61 " , 0 , " " } ,
/* 3*/ { BARCODE_DOTCODE , DATA_MODE , - 1 , " \\ 0 \\ E \\ a \\ b \\ t \\ n \\ v \\ f \\ r \\ e \\ G \\ R \\ x81 \\ \\ " , " " , 0 , 28 , " 65 40 44 47 48 49 4A 4B 4C 4D 5B 5D 5E 6E 41 3C 6A " , 0 , " " } ,
/* 4*/ { BARCODE_GRIDMATRIX , DATA_MODE , - 1 , " \\ 0 \\ E \\ a \\ b \\ t \\ n \\ v \\ f \\ r \\ e \\ G \\ R \\ x81 \\ \\ " , " " , 0 , 30 , " 30 1A 00 02 01 61 00 48 28 16 0C 06 46 63 51 74 05 38 00 " , 0 , " " } ,
/* 5*/ { BARCODE_HANXIN , DATA_MODE , - 1 , " \\ 0 \\ E \\ a \\ b \\ t \\ n \\ v \\ f \\ r \\ e \\ G \\ R \\ x81 \\ \\ " , " " , 0 , 23 , " 2F 80 10 72 09 28 B3 0D 6F F3 00 20 E8 F4 0A E0 00 " , 0 , " " } ,
/* 6*/ { BARCODE_MAXICODE , DATA_MODE , - 1 , " \\ 0 \\ E \\ a \\ b \\ t \\ n \\ v \\ f \\ r \\ e \\ G \\ R \\ x81 \\ \\ " , " " , 0 , 30 , " (144) 04 3E 3E 00 04 07 08 09 0A 0B 03 3D 2C 24 19 1E 23 1B 18 0E 0C 0D 1E 21 3C 1E 3C 31 " , 0 , " " } ,
/* 7*/ { BARCODE_PDF417 , DATA_MODE , - 1 , " \\ 0 \\ E \\ a \\ b \\ t \\ n \\ v \\ f \\ r \\ e \\ G \\ R \\ x81 \\ \\ " , " " , 0 , 120 , " (24) 16 901 0 23 655 318 98 18 461 639 893 122 129 92 900 900 872 438 359 646 522 773 831 " , 0 , " " } ,
/* 8*/ { BARCODE_ULTRA , DATA_MODE , - 1 , " \\ 0 \\ E \\ a \\ b \\ t \\ n \\ v \\ f \\ r \\ e \\ G \\ R \\ x81 \\ \\ " , " " , 0 , 20 , " (15) 257 0 4 7 8 9 10 11 12 13 27 29 30 129 92 " , 0 , " " } ,
/* 9*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ 0 \\ E \\ a \\ b \\ t \\ n \\ v \\ f \\ r \\ e \\ G \\ R \\ x81 \\ d129 \\ o201 \\ \\ " , " " , 0 , 18 , " (32) 01 05 08 09 0A 0B 0C 0D 0E 1C 1E 1F E7 32 45 DB 70 5D E3 16 7B 2B 44 60 E1 55 F7 08 " , 0 , " " } ,
/* 10*/ { BARCODE_HANXIN , DATA_MODE , - 1 , " \\ 0 \\ E \\ a \\ b \\ t \\ n \\ v \\ f \\ r \\ e \\ G \\ R \\ x81 \\ d129 \\ o201 \\ \\ " , " " , 0 , 23 , " 2F 80 10 72 09 28 B3 0D 6F F3 00 30 E8 F4 0C 0C 0A E0 00 00 00 " , 0 , " " } ,
/* 11*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ c " , " " , ZINT_ERROR_INVALID_DATA , 0 , " Error 234: Unrecognised escape character ' \\ c' in input data " , 0 , " " } ,
/* 12*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ " , " " , ZINT_ERROR_INVALID_DATA , 0 , " Error 236: Incomplete escape character in input data " , 0 , " " } ,
/* 13*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ x " , " " , ZINT_ERROR_INVALID_DATA , 0 , " Error 232: Incomplete ' \\ x' escape sequence in input data " , 0 , " " } ,
/* 14*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ x1 " , " " , ZINT_ERROR_INVALID_DATA , 0 , " Error 232: Incomplete ' \\ x' escape sequence in input data " , 0 , " " } ,
/* 15*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ x1g " , " " , ZINT_ERROR_INVALID_DATA , 0 , " Error 233: Invalid character for ' \\ x' escape sequence in input data (hexadecimal only) " , 0 , " " } ,
/* 16*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ d " , " " , ZINT_ERROR_INVALID_DATA , 0 , " Error 232: Incomplete ' \\ d' escape sequence in input data " , 0 , " " } ,
/* 17*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ d1 " , " " , ZINT_ERROR_INVALID_DATA , 0 , " Error 232: Incomplete ' \\ d' escape sequence in input data " , 0 , " " } ,
/* 18*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ d12 " , " " , ZINT_ERROR_INVALID_DATA , 0 , " Error 232: Incomplete ' \\ d' escape sequence in input data " , 0 , " " } ,
/* 19*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ d12a " , " " , ZINT_ERROR_INVALID_DATA , 0 , " Error 233: Invalid character for ' \\ d' escape sequence in input data (decimal only) " , 0 , " " } ,
/* 20*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ o " , " " , ZINT_ERROR_INVALID_DATA , 0 , " Error 232: Incomplete ' \\ o' escape sequence in input data " , 0 , " " } ,
/* 21*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ o1 " , " " , ZINT_ERROR_INVALID_DATA , 0 , " Error 232: Incomplete ' \\ o' escape sequence in input data " , 0 , " " } ,
/* 22*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ o12 " , " " , ZINT_ERROR_INVALID_DATA , 0 , " Error 232: Incomplete ' \\ o' escape sequence in input data " , 0 , " " } ,
/* 23*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ o128 " , " " , ZINT_ERROR_INVALID_DATA , 0 , " Error 233: Invalid character for ' \\ o' escape sequence in input data (octal only) " , 0 , " " } ,
/* 24*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ xA01 \\ xFF " , " " , 0 , 12 , " EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B " , 0 , " " } ,
/* 25*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ d1601 \\ d255 " , " " , 0 , 12 , " EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B " , 1 , " " } ,
/* 26*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ o2401 \\ o377 " , " " , 0 , 12 , " EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B " , 1 , " " } ,
/* 27*/ { BARCODE_DATAMATRIX , UNICODE_MODE , - 1 , " \\ u00A01 \\ u00FF " , " " , 0 , 12 , " EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B " , 1 , " " } ,
/* 28*/ { BARCODE_DATAMATRIX , UNICODE_MODE , - 1 , " \\ U0000A01 \\ U0000FF " , " " , 0 , 12 , " EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B " , 1 , " " } ,
/* 29*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ xc3 \\ xbF " , " " , 0 , 12 , " EB 44 EB 40 81 30 87 17 C5 68 5C 91 " , 0 , " " } ,
/* 30*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ d195 \\ d191 " , " " , 0 , 12 , " EB 44 EB 40 81 30 87 17 C5 68 5C 91 " , 1 , " " } ,
/* 31*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ o303 \\ o277 " , " " , 0 , 12 , " EB 44 EB 40 81 30 87 17 C5 68 5C 91 " , 1 , " " } ,
/* 32*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ u00fF " , " " , 0 , 12 , " EB 44 EB 40 81 30 87 17 C5 68 5C 91 " , 1 , " " } ,
/* 33*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ U0000fF " , " " , 0 , 12 , " EB 44 EB 40 81 30 87 17 C5 68 5C 91 " , 1 , " " } ,
/* 34*/ { BARCODE_DATAMATRIX , UNICODE_MODE , - 1 , " \\ xc3 \\ xbF " , " " , 0 , 10 , " EB 80 81 47 1E 45 FC 93 " , 0 , " " } ,
/* 35*/ { BARCODE_DATAMATRIX , UNICODE_MODE , - 1 , " \\ d195 \\ d191 " , " " , 0 , 10 , " EB 80 81 47 1E 45 FC 93 " , 1 , " " } ,
/* 36*/ { BARCODE_DATAMATRIX , UNICODE_MODE , - 1 , " \\ o303 \\ o277 " , " " , 0 , 10 , " EB 80 81 47 1E 45 FC 93 " , 1 , " " } ,
/* 37*/ { BARCODE_DATAMATRIX , UNICODE_MODE , - 1 , " \\ u00fF " , " " , 0 , 10 , " EB 80 81 47 1E 45 FC 93 " , 1 , " " } ,
/* 38*/ { BARCODE_DATAMATRIX , UNICODE_MODE , - 1 , " \\ U0000fF " , " " , 0 , 10 , " EB 80 81 47 1E 45 FC 93 " , 1 , " " } ,
/* 39*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ u " , " " , ZINT_ERROR_INVALID_DATA , 0 , " Error 209: Incomplete ' \\ u' escape sequence in input data " , 0 , " " } ,
/* 40*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ uF " , " " , ZINT_ERROR_INVALID_DATA , 0 , " Error 209: Incomplete ' \\ u' escape sequence in input data " , 0 , " " } ,
/* 41*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ u0F " , " " , ZINT_ERROR_INVALID_DATA , 0 , " Error 209: Incomplete ' \\ u' escape sequence in input data " , 0 , " " } ,
/* 42*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ uFG " , " " , ZINT_ERROR_INVALID_DATA , 0 , " Error 209: Incomplete ' \\ u' escape sequence in input data " , 0 , " " } ,
/* 43*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ u00F " , " " , ZINT_ERROR_INVALID_DATA , 0 , " Error 209: Incomplete ' \\ u' escape sequence in input data " , 0 , " " } ,
/* 44*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ u00FG " , " " , ZINT_ERROR_INVALID_DATA , 0 , " Error 211: Invalid character for ' \\ u' escape sequence in input data (hexadecimal only) " , 0 , " " } ,
/* 45*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ ufffe " , " " , ZINT_ERROR_INVALID_DATA , 0 , " Error 246: Invalid value for ' \\ u' escape sequence in input data " , 0 , " Reversed BOM " } ,
/* 46*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ ud800 " , " " , ZINT_ERROR_INVALID_DATA , 0 , " Error 246: Invalid value for ' \\ u' escape sequence in input data " , 0 , " Surrogate " } ,
/* 47*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ udfff " , " " , ZINT_ERROR_INVALID_DATA , 0 , " Error 246: Invalid value for ' \\ u' escape sequence in input data " , 0 , " Surrogate " } ,
/* 48*/ { BARCODE_DATAMATRIX , UNICODE_MODE , 17 , " \\ xE2 \\ x82 \\ xAC " , " " , 0 , 12 , " F1 12 EB 25 81 4A 0A 8C 31 AC E3 2E " , 0 , " Zint manual 4.10 Ex1 " } ,
/* 49*/ { BARCODE_DATAMATRIX , UNICODE_MODE , 17 , " \\ u20AC " , " " , 0 , 12 , " F1 12 EB 25 81 4A 0A 8C 31 AC E3 2E " , 1 , " " } ,
/* 50*/ { BARCODE_DATAMATRIX , UNICODE_MODE , 17 , " \\ U0020AC " , " " , 0 , 12 , " F1 12 EB 25 81 4A 0A 8C 31 AC E3 2E " , 1 , " " } ,
/* 51*/ { BARCODE_DATAMATRIX , DATA_MODE , 17 , " \\ xA4 " , " " , 0 , 12 , " F1 12 EB 25 81 4A 0A 8C 31 AC E3 2E " , 1 , " " } ,
/* 52*/ { BARCODE_DATAMATRIX , DATA_MODE , 28 , " \\ xB1 \\ x60 " , " " , 0 , 12 , " F1 1D EB 32 61 D9 1C 0C C2 46 C3 B2 " , 0 , " Zint manual 4.10 Ex2 " } ,
/* 53*/ { BARCODE_DATAMATRIX , UNICODE_MODE , 28 , " \\ u5E38 " , " " , 0 , 12 , " F1 1D EB 32 61 D9 1C 0C C2 46 C3 B2 " , 1 , " " } ,
/* 54*/ { BARCODE_DATAMATRIX , UNICODE_MODE , 28 , " \\ U005E38 " , " " , 0 , 12 , " F1 1D EB 32 61 D9 1C 0C C2 46 C3 B2 " , 1 , " " } ,
/* 55*/ { BARCODE_DATAMATRIX , UNICODE_MODE , - 1 , " \\ u007F " , " " , 0 , 10 , " 80 81 46 73 64 88 6A 84 " , 0 , " " } ,
/* 56*/ { BARCODE_DATAMATRIX , UNICODE_MODE , - 1 , " \\ U00007F " , " " , 0 , 10 , " 80 81 46 73 64 88 6A 84 " , 0 , " " } ,
/* 57*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ U " , " " , ZINT_ERROR_INVALID_DATA , 0 , " Error 209: Incomplete ' \\ U' escape sequence in input data " , 0 , " " } ,
/* 58*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ UF " , " " , ZINT_ERROR_INVALID_DATA , 0 , " Error 209: Incomplete ' \\ U' escape sequence in input data " , 0 , " " } ,
/* 59*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ U0F " , " " , ZINT_ERROR_INVALID_DATA , 0 , " Error 209: Incomplete ' \\ U' escape sequence in input data " , 0 , " " } ,
/* 60*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ UFG " , " " , ZINT_ERROR_INVALID_DATA , 0 , " Error 209: Incomplete ' \\ U' escape sequence in input data " , 0 , " " } ,
/* 61*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ U00F " , " " , ZINT_ERROR_INVALID_DATA , 0 , " Error 209: Incomplete ' \\ U' escape sequence in input data " , 0 , " " } ,
/* 62*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ U00FG " , " " , ZINT_ERROR_INVALID_DATA , 0 , " Error 209: Incomplete ' \\ U' escape sequence in input data " , 0 , " " } ,
/* 63*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ Ufffe " , " " , ZINT_ERROR_INVALID_DATA , 0 , " Error 209: Incomplete ' \\ U' escape sequence in input data " , 0 , " Reversed BOM " } ,
/* 64*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ Ud800 " , " " , ZINT_ERROR_INVALID_DATA , 0 , " Error 209: Incomplete ' \\ U' escape sequence in input data " , 0 , " Surrogate " } ,
/* 65*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ Udfff " , " " , ZINT_ERROR_INVALID_DATA , 0 , " Error 209: Incomplete ' \\ U' escape sequence in input data " , 0 , " Surrogate " } ,
/* 66*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ U000F " , " " , ZINT_ERROR_INVALID_DATA , 0 , " Error 209: Incomplete ' \\ U' escape sequence in input data " , 0 , " " } ,
/* 67*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ U0000F " , " " , ZINT_ERROR_INVALID_DATA , 0 , " Error 209: Incomplete ' \\ U' escape sequence in input data " , 0 , " " } ,
/* 68*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ U110000 " , " " , ZINT_ERROR_INVALID_DATA , 0 , " Error 246: Invalid value for ' \\ U' escape sequence in input data " , 0 , " " } ,
/* 69*/ { BARCODE_DATAMATRIX , UNICODE_MODE , 25 , " \\ U10FFFF " , " " , 0 , 14 , " F1 1A 01 01 EB 80 EB 80 3F C0 9C 0B 4B B8 DA B7 B6 1A " , 0 , " " } ,
/* 70*/ { BARCODE_DATAMATRIX , UNICODE_MODE , 26 , " \\ U10FFFF " , " " , 0 , 14 , " F1 1B 01 E7 EC 71 D7 6C 20 D6 B3 63 E2 18 B6 4C 7D 3E " , 0 , " " } ,
/* 71*/ { BARCODE_DATAMATRIX , UNICODE_MODE , 32 , " \\ U10FFFF " , " " , 0 , 32 , " F1 21 01 EB 05 32 EB 25 3A 81 7E 98 9B 50 AC 1C E0 4E 51 BA 23 " , 0 , " " } ,
/* 72*/ { BARCODE_DATAMATRIX , UNICODE_MODE , 33 , " \\ U10FFFF " , " " , 0 , 14 , " F1 22 01 01 EB 80 EB 80 A3 E5 BE FB 1A 08 94 2E C3 74 " , 0 , " " } ,
/* 73*/ { BARCODE_DATAMATRIX , UNICODE_MODE , 34 , " \\ U10FFFF " , " " , 0 , 16 , " F1 23 01 01 01 01 01 01 EB 80 EB 80 F6 F1 5D 2A D1 0A BF BC B8 22 65 0C " , 0 , " " } ,
/* 74*/ { BARCODE_DATAMATRIX , UNICODE_MODE , 35 , " \\ U10FFFF " , " " , 0 , 16 , " F1 24 01 01 01 01 EB 80 EB 80 01 01 7F 58 28 41 7F 63 0E EB A7 D8 D0 1F " , 0 , " " } ,
/* 75*/ { BARCODE_GS1_128_CC , GS1_MODE , - 1 , " [20]10 " , " [10]A " , 0 , 99 , " (7) 105 102 20 10 100 59 106 " , 0 , " " } ,
2023-01-15 13:22:43 +13:00
/* 76*/ { BARCODE_GS1_128_CC , GS1_MODE , - 1 , " [2 \\ x30]1 \\ d048 " , " [ \\ x310] \\ x41 " , 0 , 99 , " (7) 105 102 20 10 100 59 106 " , 1 , " " } ,
/* 77*/ { BARCODE_DATAMATRIX , DATA_MODE , - 1 , " \\ ^A1 " , " " , ZINT_ERROR_INVALID_DATA , 0 , " Error 798: Escape ' \\ ^' only valid for Code 128 in extra escape mode " , 0 , " " } ,
/* 78*/ { BARCODE_CODE128 , DATA_MODE | EXTRA_ESCAPE_MODE , - 1 , " \\ ^A1 " , " " , 0 , 46 , " (4) 103 17 17 106 " , 0 , " " } ,
/* 79*/ { BARCODE_CODE128 , EXTRA_ESCAPE_MODE , - 1 , " \\ ^ " , " " , 0 , 57 , " (5) 104 60 62 82 106 " , 0 , " Partial special escape ' \\ ^' at end allowed " } ,
/* 80*/ { BARCODE_CODE128 , EXTRA_ESCAPE_MODE , - 1 , " \\ ^D1 " , " " , 0 , 79 , " (7) 104 60 62 36 17 52 106 " , 0 , " Unknown special escapes passed straight thu " } ,
2020-05-16 21:22:33 +12:00
} ;
int data_size = ARRAY_SIZE ( data ) ;
2021-06-24 02:00:49 +12:00
int i , length , ret ;
struct zint_symbol * symbol ;
2020-05-16 21:22:33 +12:00
char escaped [ 1024 ] ;
2022-06-17 03:47:34 +12:00
char escaped_composite [ 1024 ] ;
2021-01-16 03:22:32 +13:00
struct zint_symbol previous_symbol ;
char * input_filename = " test_escape.txt " ;
2020-05-16 21:22:33 +12:00
2022-06-17 03:47:34 +12:00
char * text ;
2021-06-24 02:00:49 +12:00
testStart ( " test_escape_char_process " ) ;
for ( i = 0 ; i < data_size ; i + + ) {
2020-05-16 21:22:33 +12:00
2022-09-13 06:26:04 +12:00
if ( testContinue ( p_ctx , i ) ) continue ;
2020-05-16 21:22:33 +12:00
2021-06-24 02:00:49 +12:00
symbol = ZBarcode_Create ( ) ;
2020-05-16 21:22:33 +12:00
assert_nonnull ( symbol , " Symbol not created \n " ) ;
2022-06-17 03:47:34 +12:00
if ( is_composite ( data [ i ] . symbology ) ) {
text = data [ i ] . composite ;
strcpy ( symbol - > primary , data [ i ] . data ) ;
} else {
text = data [ i ] . data ;
}
2020-05-16 21:22:33 +12:00
2022-07-21 23:29:53 +12:00
debug | = ZINT_DEBUG_TEST ; /* Needed to get codeword dump in errtxt */
2020-05-16 21:22:33 +12:00
2022-06-17 03:47:34 +12:00
length = testUtilSetSymbol ( symbol , data [ i ] . symbology , data [ i ] . input_mode | ESCAPE_MODE , data [ i ] . eci , - 1 /*option_1*/ , - 1 , - 1 , - 1 /*output_options*/ , text , - 1 , debug ) ;
ret = ZBarcode_Encode ( symbol , TU ( text ) , length ) ;
2020-05-16 21:22:33 +12:00
assert_equal ( ret , data [ i ] . ret , " i:%d ZBarcode_Encode ret %d != %d (%s) \n " , i , ret , data [ i ] . ret , symbol - > errtxt ) ;
2022-09-13 06:26:04 +12:00
if ( p_ctx - > generate ) {
2022-06-17 03:47:34 +12:00
printf ( " /*%3d*/ { %s, %s, %d, \" %s \" , \" %s \" , %s, %d, \" %s \" , %d, \" %s \" }, \n " ,
2021-06-30 02:43:42 +12:00
i , testUtilBarcodeName ( data [ i ] . symbology ) , testUtilInputModeName ( data [ i ] . input_mode ) , data [ i ] . eci ,
2022-07-04 10:54:42 +12:00
testUtilEscape ( data [ i ] . data , length , escaped , ARRAY_SIZE ( escaped ) ) ,
2022-07-05 00:19:07 +12:00
testUtilEscape ( data [ i ] . composite , ( int ) strlen ( data [ i ] . composite ) , escaped_composite , ARRAY_SIZE ( escaped_composite ) ) ,
2021-01-16 03:22:32 +13:00
testUtilErrorName ( data [ i ] . ret ) , symbol - > width , symbol - > errtxt , data [ i ] . compare_previous , data [ i ] . comment ) ;
2020-05-16 21:22:33 +12:00
} else {
2021-01-16 03:22:32 +13:00
assert_zero ( strcmp ( symbol - > errtxt , data [ i ] . expected ) , " i:%d strcmp(%s, %s) != 0 \n " , i , symbol - > errtxt , data [ i ] . expected ) ;
if ( ret < ZINT_ERROR ) {
2020-05-16 21:22:33 +12:00
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 ) ;
2022-09-13 06:26:04 +12:00
if ( p_ctx - > index = = - 1 & & data [ i ] . compare_previous ) {
2021-01-16 03:22:32 +13:00
ret = testUtilSymbolCmp ( symbol , & previous_symbol ) ;
assert_zero ( ret , " i:%d testUtilSymbolCmp ret %d != 0 \n " , i , ret ) ;
}
}
memcpy ( & previous_symbol , symbol , sizeof ( previous_symbol ) ) ;
2022-06-17 03:47:34 +12:00
if ( ret < ZINT_ERROR & & ! data [ i ] . composite [ 0 ] ) {
2022-07-21 23:29:53 +12:00
/* Test from input file */
2021-01-16 03:22:32 +13:00
FILE * fp ;
2021-06-24 02:00:49 +12:00
struct zint_symbol * symbol2 ;
2021-01-16 03:22:32 +13:00
fp = fopen ( input_filename , " wb " ) ;
assert_nonnull ( fp , " i:%d fopen(%s) failed \n " , i , input_filename ) ;
2021-06-10 22:15:39 +12:00
assert_notequal ( fputs ( data [ i ] . data , fp ) , EOF , " i%d fputs(%s) failed == EOF (%d) \n " , i , data [ i ] . data , ferror ( fp ) ) ;
2021-01-16 03:22:32 +13:00
assert_zero ( fclose ( fp ) , " i%d fclose() failed \n " , i ) ;
2021-06-24 02:00:49 +12:00
symbol2 = ZBarcode_Create ( ) ;
2021-01-16 03:22:32 +13:00
assert_nonnull ( symbol , " Symbol2 not created \n " ) ;
2022-07-21 23:29:53 +12:00
symbol2 - > debug = ZINT_DEBUG_TEST ; /* Needed to get codeword dump in errtxt */
2021-01-16 03:22:32 +13:00
2021-06-30 02:43:42 +12:00
( void ) testUtilSetSymbol ( symbol2 , data [ i ] . symbology , data [ i ] . input_mode | ESCAPE_MODE , data [ i ] . eci , - 1 /*option_1*/ , - 1 , - 1 , - 1 /*output_options*/ , data [ i ] . data , - 1 , debug ) ;
2021-01-16 03:22:32 +13:00
ret = ZBarcode_Encode_File ( symbol2 , input_filename ) ;
assert_equal ( ret , data [ i ] . ret , " i:%d ZBarcode_Encode_File ret %d != %d (%s) \n " , i , ret , data [ i ] . ret , symbol2 - > errtxt ) ;
assert_zero ( strcmp ( symbol2 - > errtxt , data [ i ] . expected ) , " i:%d strcmp(%s, %s) != 0 \n " , i , symbol2 - > errtxt , data [ i ] . expected ) ;
ret = testUtilSymbolCmp ( symbol2 , symbol ) ;
assert_zero ( ret , " i:%d testUtilSymbolCmp symbol2 ret %d != 0 \n " , i , ret ) ;
2021-06-10 22:15:39 +12:00
assert_zero ( remove ( input_filename ) , " i:%d remove(%s) != 0 (%d: %s) \n " , i , input_filename , errno , strerror ( errno ) ) ;
2021-01-16 03:22:32 +13:00
ZBarcode_Delete ( symbol2 ) ;
2020-05-16 21:22:33 +12:00
}
}
ZBarcode_Delete ( symbol ) ;
}
testFinish ( ) ;
}
2022-09-13 06:26:04 +12:00
static void test_cap ( const testCtx * const p_ctx ) {
2020-10-01 00:19:12 +13:00
struct item {
int symbology ;
unsigned cap_flag ;
unsigned int expected ;
} ;
2022-07-21 23:29:53 +12:00
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
2020-10-01 00:19:12 +13:00
struct item data [ ] = {
/* 0*/ { BARCODE_CODE128 , ZINT_CAP_HRT , ZINT_CAP_HRT } ,
/* 1*/ { BARCODE_CODE128 , ZINT_CAP_HRT | ZINT_CAP_STACKABLE | ZINT_CAP_GS1 , ZINT_CAP_HRT | ZINT_CAP_STACKABLE } ,
/* 2*/ { BARCODE_PDF417 , ZINT_CAP_HRT | ZINT_CAP_ECI | ZINT_CAP_GS1 | ZINT_CAP_READER_INIT | ZINT_CAP_FULL_MULTIBYTE , ZINT_CAP_ECI | ZINT_CAP_READER_INIT } ,
Add compliant height, using ZINT_COMPLIANT_HEIGHT flag for back-compatibility
Rename barcode funcs to same as BARCODE_XXX name
library: barcode funcs array for dispatch, used for ZBarcode_ValidID() also
general: change is_sane() comparison to nonzero from ZINT_ERROR_INVALID_OPTION
MAILMARK: fuller error messages
CODABAR: add option to show check character in HRT
zint.h: use 0xNNNN for OR-able defines
GUI: add guard descent height reset button, add Zint version to window title,
static get_zint_version() method, use QStringLiteral (QSL shorthand),
use SIGNAL(toggled()), add errtxt "popup" and status bar, add icons,
add saveAs shortcut, add main menu, context menus and actions, add help,
reset_view() -> reset_colours(), add copy to clipboard as EMF/GIF/PNG/TIF,
lessen triggering of update_preview(), shorten names of getters/setters,
simplify/shorten some update_preview() logic in switch,
CODEONE disable structapp for Version S
qzint.cpp: add on_errored signal, add missing getters, add test
2021-10-09 12:13:39 +13:00
/* 3*/ { BARCODE_QRCODE , ZINT_CAP_HRT | ZINT_CAP_ECI | ZINT_CAP_GS1 | ZINT_CAP_DOTTY | ZINT_CAP_READER_INIT | ZINT_CAP_FULL_MULTIBYTE | ZINT_CAP_MASK | ZINT_CAP_STRUCTAPP | ZINT_CAP_COMPLIANT_HEIGHT , ZINT_CAP_ECI | ZINT_CAP_GS1 | ZINT_CAP_DOTTY | ZINT_CAP_FULL_MULTIBYTE | ZINT_CAP_MASK | ZINT_CAP_STRUCTAPP } ,
/* 4*/ { BARCODE_EANX_CC , ZINT_CAP_HRT | ZINT_CAP_COMPOSITE | ZINT_CAP_EXTENDABLE | ZINT_CAP_ECI | ZINT_CAP_GS1 | ZINT_CAP_QUIET_ZONES | ZINT_CAP_COMPLIANT_HEIGHT , ZINT_CAP_HRT | ZINT_CAP_COMPOSITE | ZINT_CAP_EXTENDABLE | ZINT_CAP_GS1 | ZINT_CAP_QUIET_ZONES | ZINT_CAP_COMPLIANT_HEIGHT } ,
2021-09-25 00:21:24 +12:00
/* 5*/ { BARCODE_HANXIN , ZINT_CAP_DOTTY | ZINT_CAP_QUIET_ZONES | ZINT_CAP_FIXED_RATIO | ZINT_CAP_FULL_MULTIBYTE | ZINT_CAP_MASK , ZINT_CAP_DOTTY | ZINT_CAP_FIXED_RATIO | ZINT_CAP_FULL_MULTIBYTE | ZINT_CAP_MASK } ,
Add compliant height, using ZINT_COMPLIANT_HEIGHT flag for back-compatibility
Rename barcode funcs to same as BARCODE_XXX name
library: barcode funcs array for dispatch, used for ZBarcode_ValidID() also
general: change is_sane() comparison to nonzero from ZINT_ERROR_INVALID_OPTION
MAILMARK: fuller error messages
CODABAR: add option to show check character in HRT
zint.h: use 0xNNNN for OR-able defines
GUI: add guard descent height reset button, add Zint version to window title,
static get_zint_version() method, use QStringLiteral (QSL shorthand),
use SIGNAL(toggled()), add errtxt "popup" and status bar, add icons,
add saveAs shortcut, add main menu, context menus and actions, add help,
reset_view() -> reset_colours(), add copy to clipboard as EMF/GIF/PNG/TIF,
lessen triggering of update_preview(), shorten names of getters/setters,
simplify/shorten some update_preview() logic in switch,
CODEONE disable structapp for Version S
qzint.cpp: add on_errored signal, add missing getters, add test
2021-10-09 12:13:39 +13:00
/* 6*/ { BARCODE_CODE11 , ZINT_CAP_DOTTY | ZINT_CAP_FIXED_RATIO | ZINT_CAP_FIXED_RATIO | ZINT_CAP_READER_INIT | ZINT_CAP_FULL_MULTIBYTE | ZINT_CAP_COMPLIANT_HEIGHT , 0 } ,
Add Structured Append support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, MAXICODE, MICROPDF417, PDF417, QRCODE, ULTRA
DOTCODE: use pre-calculated generator poly coeffs in Reed-Solomon for
performance improvement
PDF417/MICROPDF417: use common routine pdf417_initial()
GUI: code lines <= 118, shorthand widget_obj(),
shorten calling upcean_addon_gap(), upcean_guard_descent()
various backend: var name debug -> debug_print
2021-09-29 09:42:44 +13:00
/* 7*/ { BARCODE_POSTNET , ZINT_CAP_HRT | ZINT_CAP_STACKABLE | ZINT_CAP_EXTENDABLE | ZINT_CAP_COMPOSITE | ZINT_CAP_ECI | ZINT_CAP_GS1 | ZINT_CAP_DOTTY | ZINT_CAP_FIXED_RATIO | ZINT_CAP_READER_INIT | ZINT_CAP_FULL_MULTIBYTE | ZINT_CAP_MASK | ZINT_CAP_STRUCTAPP , 0 } ,
2020-10-01 00:19:12 +13:00
/* 8*/ { 0 , 0 , 0 } ,
} ;
int data_size = ARRAY_SIZE ( data ) ;
2021-06-24 02:00:49 +12:00
int i ;
unsigned int ret ;
testStart ( " test_cap " ) ;
2020-10-01 00:19:12 +13:00
2021-06-24 02:00:49 +12:00
for ( i = 0 ; i < data_size ; i + + ) {
2020-10-01 00:19:12 +13:00
2022-09-13 06:26:04 +12:00
if ( testContinue ( p_ctx , i ) ) continue ;
2020-10-01 00:19:12 +13:00
ret = ZBarcode_Cap ( data [ i ] . symbology , data [ i ] . cap_flag ) ;
assert_equal ( ret , data [ i ] . expected , " i:%d ZBarcode_Cap(%s, 0x%X) 0x%X != 0x%X \n " , i , testUtilBarcodeName ( data [ i ] . symbology ) , data [ i ] . cap_flag , ret , data [ i ] . expected ) ;
}
testFinish ( ) ;
}
2022-09-13 06:26:04 +12:00
static void test_cap_compliant_height ( const testCtx * const p_ctx ) {
Add compliant height, using ZINT_COMPLIANT_HEIGHT flag for back-compatibility
Rename barcode funcs to same as BARCODE_XXX name
library: barcode funcs array for dispatch, used for ZBarcode_ValidID() also
general: change is_sane() comparison to nonzero from ZINT_ERROR_INVALID_OPTION
MAILMARK: fuller error messages
CODABAR: add option to show check character in HRT
zint.h: use 0xNNNN for OR-able defines
GUI: add guard descent height reset button, add Zint version to window title,
static get_zint_version() method, use QStringLiteral (QSL shorthand),
use SIGNAL(toggled()), add errtxt "popup" and status bar, add icons,
add saveAs shortcut, add main menu, context menus and actions, add help,
reset_view() -> reset_colours(), add copy to clipboard as EMF/GIF/PNG/TIF,
lessen triggering of update_preview(), shorten names of getters/setters,
simplify/shorten some update_preview() logic in switch,
CODEONE disable structapp for Version S
qzint.cpp: add on_errored signal, add missing getters, add test
2021-10-09 12:13:39 +13:00
int symbol_id ;
int ret ;
testStart ( " test_cap_compliant_height " ) ;
2021-10-21 11:05:30 +13:00
for ( symbol_id = 1 ; symbol_id < = BARCODE_LAST ; symbol_id + + ) {
Add compliant height, using ZINT_COMPLIANT_HEIGHT flag for back-compatibility
Rename barcode funcs to same as BARCODE_XXX name
library: barcode funcs array for dispatch, used for ZBarcode_ValidID() also
general: change is_sane() comparison to nonzero from ZINT_ERROR_INVALID_OPTION
MAILMARK: fuller error messages
CODABAR: add option to show check character in HRT
zint.h: use 0xNNNN for OR-able defines
GUI: add guard descent height reset button, add Zint version to window title,
static get_zint_version() method, use QStringLiteral (QSL shorthand),
use SIGNAL(toggled()), add errtxt "popup" and status bar, add icons,
add saveAs shortcut, add main menu, context menus and actions, add help,
reset_view() -> reset_colours(), add copy to clipboard as EMF/GIF/PNG/TIF,
lessen triggering of update_preview(), shorten names of getters/setters,
simplify/shorten some update_preview() logic in switch,
CODEONE disable structapp for Version S
qzint.cpp: add on_errored signal, add missing getters, add test
2021-10-09 12:13:39 +13:00
if ( ! ZBarcode_ValidID ( symbol_id ) ) continue ;
2022-09-13 06:26:04 +12:00
if ( testContinue ( p_ctx , symbol_id ) ) continue ;
Add compliant height, using ZINT_COMPLIANT_HEIGHT flag for back-compatibility
Rename barcode funcs to same as BARCODE_XXX name
library: barcode funcs array for dispatch, used for ZBarcode_ValidID() also
general: change is_sane() comparison to nonzero from ZINT_ERROR_INVALID_OPTION
MAILMARK: fuller error messages
CODABAR: add option to show check character in HRT
zint.h: use 0xNNNN for OR-able defines
GUI: add guard descent height reset button, add Zint version to window title,
static get_zint_version() method, use QStringLiteral (QSL shorthand),
use SIGNAL(toggled()), add errtxt "popup" and status bar, add icons,
add saveAs shortcut, add main menu, context menus and actions, add help,
reset_view() -> reset_colours(), add copy to clipboard as EMF/GIF/PNG/TIF,
lessen triggering of update_preview(), shorten names of getters/setters,
simplify/shorten some update_preview() logic in switch,
CODEONE disable structapp for Version S
qzint.cpp: add on_errored signal, add missing getters, add test
2021-10-09 12:13:39 +13:00
ret = ZBarcode_Cap ( symbol_id , ZINT_CAP_COMPLIANT_HEIGHT ) ;
switch ( symbol_id ) {
2022-09-13 06:26:04 +12:00
/*case BARCODE_CODE11: TODO: Find doc */
Add compliant height, using ZINT_COMPLIANT_HEIGHT flag for back-compatibility
Rename barcode funcs to same as BARCODE_XXX name
library: barcode funcs array for dispatch, used for ZBarcode_ValidID() also
general: change is_sane() comparison to nonzero from ZINT_ERROR_INVALID_OPTION
MAILMARK: fuller error messages
CODABAR: add option to show check character in HRT
zint.h: use 0xNNNN for OR-able defines
GUI: add guard descent height reset button, add Zint version to window title,
static get_zint_version() method, use QStringLiteral (QSL shorthand),
use SIGNAL(toggled()), add errtxt "popup" and status bar, add icons,
add saveAs shortcut, add main menu, context menus and actions, add help,
reset_view() -> reset_colours(), add copy to clipboard as EMF/GIF/PNG/TIF,
lessen triggering of update_preview(), shorten names of getters/setters,
simplify/shorten some update_preview() logic in switch,
CODEONE disable structapp for Version S
qzint.cpp: add on_errored signal, add missing getters, add test
2021-10-09 12:13:39 +13:00
case BARCODE_C25INTER :
case BARCODE_CODE39 :
case BARCODE_EXCODE39 :
case BARCODE_EANX :
case BARCODE_EANX_CHK :
case BARCODE_GS1_128 :
case BARCODE_CODABAR :
2022-09-13 06:26:04 +12:00
/*case BARCODE_DPLEIT: TODO: Find doc */
/*case BARCODE_DPIDENT: TODO: Find doc */
Add compliant height, using ZINT_COMPLIANT_HEIGHT flag for back-compatibility
Rename barcode funcs to same as BARCODE_XXX name
library: barcode funcs array for dispatch, used for ZBarcode_ValidID() also
general: change is_sane() comparison to nonzero from ZINT_ERROR_INVALID_OPTION
MAILMARK: fuller error messages
CODABAR: add option to show check character in HRT
zint.h: use 0xNNNN for OR-able defines
GUI: add guard descent height reset button, add Zint version to window title,
static get_zint_version() method, use QStringLiteral (QSL shorthand),
use SIGNAL(toggled()), add errtxt "popup" and status bar, add icons,
add saveAs shortcut, add main menu, context menus and actions, add help,
reset_view() -> reset_colours(), add copy to clipboard as EMF/GIF/PNG/TIF,
lessen triggering of update_preview(), shorten names of getters/setters,
simplify/shorten some update_preview() logic in switch,
CODEONE disable structapp for Version S
qzint.cpp: add on_errored signal, add missing getters, add test
2021-10-09 12:13:39 +13:00
case BARCODE_CODE16K :
case BARCODE_CODE49 :
case BARCODE_CODE93 :
2022-09-13 06:26:04 +12:00
/*case BARCODE_FLAT: TODO: Find doc */
Add compliant height, using ZINT_COMPLIANT_HEIGHT flag for back-compatibility
Rename barcode funcs to same as BARCODE_XXX name
library: barcode funcs array for dispatch, used for ZBarcode_ValidID() also
general: change is_sane() comparison to nonzero from ZINT_ERROR_INVALID_OPTION
MAILMARK: fuller error messages
CODABAR: add option to show check character in HRT
zint.h: use 0xNNNN for OR-able defines
GUI: add guard descent height reset button, add Zint version to window title,
static get_zint_version() method, use QStringLiteral (QSL shorthand),
use SIGNAL(toggled()), add errtxt "popup" and status bar, add icons,
add saveAs shortcut, add main menu, context menus and actions, add help,
reset_view() -> reset_colours(), add copy to clipboard as EMF/GIF/PNG/TIF,
lessen triggering of update_preview(), shorten names of getters/setters,
simplify/shorten some update_preview() logic in switch,
CODEONE disable structapp for Version S
qzint.cpp: add on_errored signal, add missing getters, add test
2021-10-09 12:13:39 +13:00
case BARCODE_DBAR_OMN :
case BARCODE_DBAR_LTD :
case BARCODE_DBAR_EXP :
case BARCODE_TELEPEN :
case BARCODE_UPCA :
case BARCODE_UPCA_CHK :
case BARCODE_UPCE :
case BARCODE_UPCE_CHK :
case BARCODE_POSTNET :
2022-09-13 06:26:04 +12:00
/*case BARCODE_MSI_PLESSEY: TODO: Find doc */
Add compliant height, using ZINT_COMPLIANT_HEIGHT flag for back-compatibility
Rename barcode funcs to same as BARCODE_XXX name
library: barcode funcs array for dispatch, used for ZBarcode_ValidID() also
general: change is_sane() comparison to nonzero from ZINT_ERROR_INVALID_OPTION
MAILMARK: fuller error messages
CODABAR: add option to show check character in HRT
zint.h: use 0xNNNN for OR-able defines
GUI: add guard descent height reset button, add Zint version to window title,
static get_zint_version() method, use QStringLiteral (QSL shorthand),
use SIGNAL(toggled()), add errtxt "popup" and status bar, add icons,
add saveAs shortcut, add main menu, context menus and actions, add help,
reset_view() -> reset_colours(), add copy to clipboard as EMF/GIF/PNG/TIF,
lessen triggering of update_preview(), shorten names of getters/setters,
simplify/shorten some update_preview() logic in switch,
CODEONE disable structapp for Version S
qzint.cpp: add on_errored signal, add missing getters, add test
2021-10-09 12:13:39 +13:00
case BARCODE_FIM :
case BARCODE_LOGMARS :
case BARCODE_PHARMA :
case BARCODE_PZN :
case BARCODE_PHARMA_TWO :
2022-08-21 07:45:51 +12:00
case BARCODE_CEPNET :
Add compliant height, using ZINT_COMPLIANT_HEIGHT flag for back-compatibility
Rename barcode funcs to same as BARCODE_XXX name
library: barcode funcs array for dispatch, used for ZBarcode_ValidID() also
general: change is_sane() comparison to nonzero from ZINT_ERROR_INVALID_OPTION
MAILMARK: fuller error messages
CODABAR: add option to show check character in HRT
zint.h: use 0xNNNN for OR-able defines
GUI: add guard descent height reset button, add Zint version to window title,
static get_zint_version() method, use QStringLiteral (QSL shorthand),
use SIGNAL(toggled()), add errtxt "popup" and status bar, add icons,
add saveAs shortcut, add main menu, context menus and actions, add help,
reset_view() -> reset_colours(), add copy to clipboard as EMF/GIF/PNG/TIF,
lessen triggering of update_preview(), shorten names of getters/setters,
simplify/shorten some update_preview() logic in switch,
CODEONE disable structapp for Version S
qzint.cpp: add on_errored signal, add missing getters, add test
2021-10-09 12:13:39 +13:00
case BARCODE_AUSPOST :
case BARCODE_AUSREPLY :
case BARCODE_AUSROUTE :
case BARCODE_AUSREDIRECT :
case BARCODE_ISBNX :
case BARCODE_RM4SCC :
case BARCODE_EAN14 :
2022-09-13 06:26:04 +12:00
/*case BARCODE_VIN: Spec unlikely */
Add compliant height, using ZINT_COMPLIANT_HEIGHT flag for back-compatibility
Rename barcode funcs to same as BARCODE_XXX name
library: barcode funcs array for dispatch, used for ZBarcode_ValidID() also
general: change is_sane() comparison to nonzero from ZINT_ERROR_INVALID_OPTION
MAILMARK: fuller error messages
CODABAR: add option to show check character in HRT
zint.h: use 0xNNNN for OR-able defines
GUI: add guard descent height reset button, add Zint version to window title,
static get_zint_version() method, use QStringLiteral (QSL shorthand),
use SIGNAL(toggled()), add errtxt "popup" and status bar, add icons,
add saveAs shortcut, add main menu, context menus and actions, add help,
reset_view() -> reset_colours(), add copy to clipboard as EMF/GIF/PNG/TIF,
lessen triggering of update_preview(), shorten names of getters/setters,
simplify/shorten some update_preview() logic in switch,
CODEONE disable structapp for Version S
qzint.cpp: add on_errored signal, add missing getters, add test
2021-10-09 12:13:39 +13:00
case BARCODE_CODABLOCKF :
case BARCODE_NVE18 :
case BARCODE_JAPANPOST :
2022-09-13 06:26:04 +12:00
/*case BARCODE_KOREAPOST: TODO: Find doc */
Add compliant height, using ZINT_COMPLIANT_HEIGHT flag for back-compatibility
Rename barcode funcs to same as BARCODE_XXX name
library: barcode funcs array for dispatch, used for ZBarcode_ValidID() also
general: change is_sane() comparison to nonzero from ZINT_ERROR_INVALID_OPTION
MAILMARK: fuller error messages
CODABAR: add option to show check character in HRT
zint.h: use 0xNNNN for OR-able defines
GUI: add guard descent height reset button, add Zint version to window title,
static get_zint_version() method, use QStringLiteral (QSL shorthand),
use SIGNAL(toggled()), add errtxt "popup" and status bar, add icons,
add saveAs shortcut, add main menu, context menus and actions, add help,
reset_view() -> reset_colours(), add copy to clipboard as EMF/GIF/PNG/TIF,
lessen triggering of update_preview(), shorten names of getters/setters,
simplify/shorten some update_preview() logic in switch,
CODEONE disable structapp for Version S
qzint.cpp: add on_errored signal, add missing getters, add test
2021-10-09 12:13:39 +13:00
case BARCODE_DBAR_STK :
case BARCODE_DBAR_OMNSTK :
case BARCODE_DBAR_EXPSTK :
case BARCODE_PLANET :
case BARCODE_USPS_IMAIL :
2022-09-13 06:26:04 +12:00
/*case BARCODE_PLESSEY: TODO: Find doc */
Add compliant height, using ZINT_COMPLIANT_HEIGHT flag for back-compatibility
Rename barcode funcs to same as BARCODE_XXX name
library: barcode funcs array for dispatch, used for ZBarcode_ValidID() also
general: change is_sane() comparison to nonzero from ZINT_ERROR_INVALID_OPTION
MAILMARK: fuller error messages
CODABAR: add option to show check character in HRT
zint.h: use 0xNNNN for OR-able defines
GUI: add guard descent height reset button, add Zint version to window title,
static get_zint_version() method, use QStringLiteral (QSL shorthand),
use SIGNAL(toggled()), add errtxt "popup" and status bar, add icons,
add saveAs shortcut, add main menu, context menus and actions, add help,
reset_view() -> reset_colours(), add copy to clipboard as EMF/GIF/PNG/TIF,
lessen triggering of update_preview(), shorten names of getters/setters,
simplify/shorten some update_preview() logic in switch,
CODEONE disable structapp for Version S
qzint.cpp: add on_errored signal, add missing getters, add test
2021-10-09 12:13:39 +13:00
case BARCODE_TELEPEN_NUM :
case BARCODE_ITF14 :
case BARCODE_KIX :
case BARCODE_DPD :
case BARCODE_HIBC_39 :
case BARCODE_HIBC_BLOCKF :
2022-12-10 03:51:26 +13:00
case BARCODE_UPU_S10 :
2022-12-09 02:48:31 +13:00
case BARCODE_MAILMARK_4S :
Add compliant height, using ZINT_COMPLIANT_HEIGHT flag for back-compatibility
Rename barcode funcs to same as BARCODE_XXX name
library: barcode funcs array for dispatch, used for ZBarcode_ValidID() also
general: change is_sane() comparison to nonzero from ZINT_ERROR_INVALID_OPTION
MAILMARK: fuller error messages
CODABAR: add option to show check character in HRT
zint.h: use 0xNNNN for OR-able defines
GUI: add guard descent height reset button, add Zint version to window title,
static get_zint_version() method, use QStringLiteral (QSL shorthand),
use SIGNAL(toggled()), add errtxt "popup" and status bar, add icons,
add saveAs shortcut, add main menu, context menus and actions, add help,
reset_view() -> reset_colours(), add copy to clipboard as EMF/GIF/PNG/TIF,
lessen triggering of update_preview(), shorten names of getters/setters,
simplify/shorten some update_preview() logic in switch,
CODEONE disable structapp for Version S
qzint.cpp: add on_errored signal, add missing getters, add test
2021-10-09 12:13:39 +13:00
case BARCODE_CODE32 :
case BARCODE_EANX_CC :
case BARCODE_GS1_128_CC :
case BARCODE_DBAR_OMN_CC :
case BARCODE_DBAR_LTD_CC :
case BARCODE_DBAR_EXP_CC :
case BARCODE_UPCA_CC :
case BARCODE_UPCE_CC :
case BARCODE_DBAR_STK_CC :
case BARCODE_DBAR_OMNSTK_CC :
case BARCODE_DBAR_EXPSTK_CC :
case BARCODE_CHANNEL :
2022-07-21 23:29:53 +12:00
case BARCODE_BC412 :
Add compliant height, using ZINT_COMPLIANT_HEIGHT flag for back-compatibility
Rename barcode funcs to same as BARCODE_XXX name
library: barcode funcs array for dispatch, used for ZBarcode_ValidID() also
general: change is_sane() comparison to nonzero from ZINT_ERROR_INVALID_OPTION
MAILMARK: fuller error messages
CODABAR: add option to show check character in HRT
zint.h: use 0xNNNN for OR-able defines
GUI: add guard descent height reset button, add Zint version to window title,
static get_zint_version() method, use QStringLiteral (QSL shorthand),
use SIGNAL(toggled()), add errtxt "popup" and status bar, add icons,
add saveAs shortcut, add main menu, context menus and actions, add help,
reset_view() -> reset_colours(), add copy to clipboard as EMF/GIF/PNG/TIF,
lessen triggering of update_preview(), shorten names of getters/setters,
simplify/shorten some update_preview() logic in switch,
CODEONE disable structapp for Version S
qzint.cpp: add on_errored signal, add missing getters, add test
2021-10-09 12:13:39 +13:00
assert_equal ( ret , ZINT_CAP_COMPLIANT_HEIGHT , " symbol_id %d (%s) ret 0x%X != ZINT_CAP_COMPLIANT_HEIGHT \n " , symbol_id , testUtilBarcodeName ( symbol_id ) , ret ) ;
break ;
default :
assert_zero ( ret , " symbol_id %d (%s) ret 0x%X non-zero \n " , symbol_id , testUtilBarcodeName ( symbol_id ) , ret ) ;
break ;
}
}
testFinish ( ) ;
}
2022-09-13 06:26:04 +12:00
static void test_encode_file_empty ( const testCtx * const p_ctx ) {
2020-03-27 11:17:37 +13:00
int ret ;
2021-06-24 02:00:49 +12:00
struct zint_symbol * symbol ;
2020-03-27 11:17:37 +13:00
char filename [ ] = " in.bin " ;
2021-06-24 02:00:49 +12:00
FILE * fstream ;
2022-09-13 06:26:04 +12:00
( void ) p_ctx ;
2021-06-24 02:00:49 +12:00
testStart ( " test_encode_file_empty " ) ;
2021-06-11 03:20:14 +12:00
2021-06-24 02:00:49 +12:00
symbol = ZBarcode_Create ( ) ;
2020-03-27 11:17:37 +13:00
assert_nonnull ( symbol , " Symbol not created \n " ) ;
2022-07-21 23:29:53 +12:00
( void ) remove ( filename ) ; /* In case junk hanging around */
2021-01-12 07:11:41 +13:00
2021-06-10 21:42:36 +12:00
fstream = fopen ( filename , " w+ " ) ;
2021-06-13 03:01:16 +12:00
assert_nonnull ( fstream , " fopen(%s) failed (%d) \n " , filename , ferror ( fstream ) ) ;
ret = fclose ( fstream ) ;
assert_zero ( ret , " fclose(%s) %d != 0 \n " , filename , ret ) ;
2021-06-11 03:20:14 +12:00
2021-01-12 07:11:41 +13:00
ret = ZBarcode_Encode_File ( symbol , filename ) ;
assert_equal ( ret , ZINT_ERROR_INVALID_DATA , " ZBarcode_Encode_File empty ret %d != ZINT_ERROR_INVALID_DATA (%s) \n " , ret , symbol - > errtxt ) ;
2021-06-10 21:42:36 +12:00
ret = remove ( filename ) ;
assert_zero ( ret , " remove(%s) != 0 (%d: %s) \n " , filename , errno , strerror ( errno ) ) ;
2021-06-11 03:20:14 +12:00
2021-06-10 21:42:36 +12:00
ZBarcode_Delete ( symbol ) ;
2021-06-11 03:20:14 +12:00
2021-06-10 21:42:36 +12:00
testFinish ( ) ;
}
2022-09-13 06:26:04 +12:00
static void test_encode_file_too_large ( const testCtx * const p_ctx ) {
2021-06-24 02:00:49 +12:00
char filename [ ] = " in.bin " ;
2021-06-10 21:42:36 +12:00
FILE * fstream ;
int ret ;
2021-06-24 02:00:49 +12:00
struct zint_symbol * symbol ;
2021-06-10 21:42:36 +12:00
char buf [ ZINT_MAX_DATA_LEN + 1 ] = { 0 } ;
2021-06-11 03:20:14 +12:00
2022-09-13 06:26:04 +12:00
( void ) p_ctx ;
2021-06-24 02:00:49 +12:00
testStart ( " test_encode_file_too_large " ) ;
symbol = ZBarcode_Create ( ) ;
2021-06-10 21:42:36 +12:00
assert_nonnull ( symbol , " Symbol not created \n " ) ;
2021-01-12 07:11:41 +13:00
2022-07-21 23:29:53 +12:00
( void ) remove ( filename ) ; /* In case junk hanging around */
2021-01-12 07:11:41 +13:00
2021-06-10 21:42:36 +12:00
fstream = fopen ( filename , " w+ " ) ;
2021-06-13 03:01:16 +12:00
assert_nonnull ( fstream , " fopen(%s) failed (%d) \n " , filename , ferror ( fstream ) ) ;
2021-06-27 22:47:55 +12:00
ret = ( int ) fwrite ( buf , 1 , sizeof ( buf ) , fstream ) ;
2021-06-13 03:01:16 +12:00
assert_equal ( ret , sizeof ( buf ) , " fwrite return value: %d != %d \n " , ret , ( int ) sizeof ( buf ) ) ;
ret = fclose ( fstream ) ;
assert_zero ( ret , " fclose(%s) %d != 0 \n " , filename , ret ) ;
2021-06-11 03:20:14 +12:00
2021-01-12 07:11:41 +13:00
ret = ZBarcode_Encode_File ( symbol , filename ) ;
assert_equal ( ret , ZINT_ERROR_TOO_LONG , " ZBarcode_Encode_File too large ret %d != ZINT_ERROR_TOO_LONG (%s) \n " , ret , symbol - > errtxt ) ;
2021-06-10 21:42:36 +12:00
ret = remove ( filename ) ;
assert_zero ( ret , " remove(%s) != 0 (%d: %s) \n " , filename , errno , strerror ( errno ) ) ;
2021-06-11 03:20:14 +12:00
2021-06-10 21:42:36 +12:00
ZBarcode_Delete ( symbol ) ;
2021-06-11 03:20:14 +12:00
2021-06-10 21:42:36 +12:00
testFinish ( ) ;
}
2022-07-21 23:29:53 +12:00
/* #181 Nico Gunkel OSS-Fuzz */
2022-09-13 06:26:04 +12:00
static void test_encode_file_unreadable ( const testCtx * const p_ctx ) {
2021-06-24 02:00:49 +12:00
# ifndef _WIN32
int ret ;
struct zint_symbol * symbol ;
char filename [ ] = " in.bin " ;
2021-06-10 21:42:36 +12:00
2021-06-24 02:00:49 +12:00
char buf [ ZINT_MAX_DATA_LEN + 1 ] = { 0 } ;
int fd ;
# endif
2022-09-13 06:26:04 +12:00
( void ) p_ctx ;
2021-06-24 02:00:49 +12:00
testStart ( " test_encode_file_unreadable " ) ;
2021-06-11 03:20:14 +12:00
2021-06-10 21:42:36 +12:00
# ifdef _WIN32
testSkip ( " Test not implemented on Windows " ) ;
# else
2022-09-06 02:11:46 +12:00
if ( getuid ( ) = = 0 ) {
testSkip ( " Test not available as root " ) ;
return ;
}
2021-06-10 21:42:36 +12:00
2021-06-24 02:00:49 +12:00
symbol = ZBarcode_Create ( ) ;
2021-06-10 21:42:36 +12:00
assert_nonnull ( symbol , " Symbol not created \n " ) ;
2021-01-12 07:11:41 +13:00
2022-07-21 23:29:53 +12:00
/* Unreadable file */
2021-01-12 07:11:41 +13:00
fd = creat ( filename , S_IWUSR ) ;
2021-06-10 22:15:39 +12:00
assert_notequal ( fd , - 1 , " Unreadable input file (%s) not created == -1 (%d: %s) \n " , filename , errno , strerror ( errno ) ) ;
2021-01-12 07:11:41 +13:00
ret = write ( fd , buf , 1 ) ;
assert_equal ( ret , 1 , " Unreadable write ret %d != 1 \n " , ret ) ;
2021-06-10 21:42:36 +12:00
ret = close ( fd ) ;
assert_zero ( ret , " Unreadable close(%s) != 0(%d: %s) \n " , filename , errno , strerror ( errno ) ) ;
2020-03-27 11:17:37 +13:00
ret = ZBarcode_Encode_File ( symbol , filename ) ;
2021-01-12 07:11:41 +13:00
assert_equal ( ret , ZINT_ERROR_INVALID_DATA , " ZBarcode_Encode_File unreadable ret %d != ZINT_ERROR_INVALID_DATA (%s) \n " , ret , symbol - > errtxt ) ;
2020-03-27 11:17:37 +13:00
2021-06-10 21:42:36 +12:00
ret = remove ( filename ) ;
assert_zero ( ret , " remove(%s) != 0 (%d: %s) \n " , filename , errno , strerror ( errno ) ) ;
2020-03-27 11:17:37 +13:00
ZBarcode_Delete ( symbol ) ;
testFinish ( ) ;
2021-06-10 22:15:39 +12:00
# endif /* _WIN32 */
2020-03-27 11:17:37 +13:00
}
2022-07-21 23:29:53 +12:00
/* #181 Nico Gunkel OSS-Fuzz (buffer not freed on fread() error) Note: unable to reproduce fread() error using this method */
2022-09-13 06:26:04 +12:00
static void test_encode_file_directory ( const testCtx * const p_ctx ) {
2020-03-27 11:17:37 +13:00
int ret ;
2021-06-24 02:00:49 +12:00
struct zint_symbol * symbol ;
2020-03-27 11:17:37 +13:00
char dirname [ ] = " in_dir " ;
2022-09-13 06:26:04 +12:00
( void ) p_ctx ;
2021-06-24 02:00:49 +12:00
testStart ( " test_encode_file_directory " ) ;
symbol = ZBarcode_Create ( ) ;
2020-03-27 11:17:37 +13:00
assert_nonnull ( symbol , " Symbol not created \n " ) ;
2022-07-21 23:29:53 +12:00
( void ) testUtilRmDir ( dirname ) ; /* In case junk hanging around */
2021-06-24 02:00:49 +12:00
ret = testUtilMkDir ( dirname ) ;
assert_zero ( ret , " testUtilMkDir(%s) %d != 0 (%d: %s) \n " , dirname , ret , errno , strerror ( errno ) ) ;
2020-03-27 11:17:37 +13:00
ret = ZBarcode_Encode_File ( symbol , dirname ) ;
assert_equal ( ret , ZINT_ERROR_INVALID_DATA , " ret %d != ZINT_ERROR_INVALID_DATA (%s) \n " , ret , symbol - > errtxt ) ;
2021-06-24 02:00:49 +12:00
ret = testUtilRmDir ( dirname ) ;
assert_zero ( ret , " testUtilRmDir(%s) %d != 0 (%d: %s) \n " , dirname , ret , errno , strerror ( errno ) ) ;
2020-03-27 11:17:37 +13:00
ZBarcode_Delete ( symbol ) ;
testFinish ( ) ;
}
2022-09-13 06:26:04 +12:00
static void test_encode_file ( const testCtx * const p_ctx ) {
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
int ret ;
struct zint_symbol * symbol ;
char * data = " 1 " ;
char * filename = " test_encode_file_in.txt " ;
char * outfile = " test_encode_file_out.gif " ;
FILE * fp ;
2022-09-13 06:26:04 +12:00
( void ) p_ctx ;
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
testStart ( " test_encode_file " ) ;
2022-07-21 23:29:53 +12:00
( void ) remove ( filename ) ; /* In case junk hanging around */
( void ) remove ( outfile ) ; /* In case junk hanging around */
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
fp = fopen ( filename , " w+ " ) ;
assert_nonnull ( fp , " fopen(%s) failed (%d) \n " , filename , ferror ( fp ) ) ;
assert_notequal ( fputs ( data , fp ) , EOF , " fputs(%s) failed == EOF (%d) \n " , data , ferror ( fp ) ) ;
ret = fclose ( fp ) ;
assert_zero ( ret , " fclose(%s) %d != 0 \n " , filename , ret ) ;
{
symbol = ZBarcode_Create ( ) ;
assert_nonnull ( symbol , " Symbol not created \n " ) ;
strcpy ( symbol - > outfile , outfile ) ;
ret = ZBarcode_Encode_File_and_Print ( symbol , filename , 0 ) ;
assert_zero ( ret , " ret %d != 0 (%s) \n " , ret , symbol - > errtxt ) ;
ret = remove ( outfile ) ;
assert_zero ( ret , " remove(%s) != 0 (%d: %s) \n " , outfile , errno , strerror ( errno ) ) ;
ZBarcode_Delete ( symbol ) ;
}
{
symbol = ZBarcode_Create ( ) ;
assert_nonnull ( symbol , " Symbol not created \n " ) ;
strcpy ( symbol - > outfile , outfile ) ;
ret = ZBarcode_Encode_File_and_Buffer ( symbol , filename , 0 ) ;
assert_zero ( ret , " ret %d != 0 (%s) \n " , ret , symbol - > errtxt ) ;
assert_nonnull ( symbol - > bitmap , " symbol->bitmap NULL (%s) \n " , symbol - > errtxt ) ;
ZBarcode_Delete ( symbol ) ;
}
{
symbol = ZBarcode_Create ( ) ;
assert_nonnull ( symbol , " Symbol not created \n " ) ;
strcpy ( symbol - > outfile , outfile ) ;
ret = ZBarcode_Encode_File_and_Buffer_Vector ( symbol , filename , 0 ) ;
assert_zero ( ret , " ret %d != 0 (%s) \n " , ret , symbol - > errtxt ) ;
assert_nonnull ( symbol - > vector , " symbol->vector NULL (%s) \n " , symbol - > errtxt ) ;
ZBarcode_Delete ( symbol ) ;
}
ret = remove ( filename ) ;
assert_zero ( ret , " remove(%s) != 0 (%d: %s) \n " , filename , errno , strerror ( errno ) ) ;
testFinish ( ) ;
}
2022-09-13 06:26:04 +12:00
static void test_encode_print_outfile_directory ( const testCtx * const p_ctx ) {
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
int ret ;
struct zint_symbol * symbol ;
char dirname [ ] = " outdir.txt " ;
2022-09-13 06:26:04 +12:00
( void ) p_ctx ;
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
testStart ( " test_encode_print_outfile_directory " ) ;
symbol = ZBarcode_Create ( ) ;
assert_nonnull ( symbol , " Symbol not created \n " ) ;
2022-07-21 23:29:53 +12:00
( void ) testUtilRmDir ( dirname ) ; /* In case junk hanging around */
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
ret = testUtilMkDir ( dirname ) ;
assert_zero ( ret , " testUtilMkDir(%s) %d != 0 (%d: %s) \n " , dirname , ret , errno , strerror ( errno ) ) ;
strcpy ( symbol - > outfile , dirname ) ;
ret = ZBarcode_Encode_and_Print ( symbol , TU ( " 1 " ) , 0 , 0 ) ;
assert_equal ( ret , ZINT_ERROR_FILE_ACCESS , " ret %d != ZINT_ERROR_FILE_ACCESS (%s) \n " , ret , symbol - > errtxt ) ;
ret = testUtilRmDir ( dirname ) ;
assert_zero ( ret , " testUtilRmDir(%s) %d != 0 (%d: %s) \n " , dirname , ret , errno , strerror ( errno ) ) ;
ZBarcode_Delete ( symbol ) ;
testFinish ( ) ;
}
2022-09-13 06:26:04 +12:00
static void test_bad_args ( const testCtx * const p_ctx ) {
2020-10-01 00:19:12 +13:00
int ret ;
2021-06-24 02:00:49 +12:00
struct zint_symbol * symbol ;
2020-10-01 00:19:12 +13:00
char * data = " 1 " ;
char * filename = " 1.png " ;
char * empty = " " ;
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
struct zint_seg seg = { TU ( " 1 " ) , - 1 , 4 } ;
struct zint_seg seg_empty = { TU ( " " ) , - 1 , 4 } ;
struct zint_seg seg_too_long = { TU ( " 1 " ) , ZINT_MAX_DATA_LEN + 1 , 4 } ;
2020-10-01 00:19:12 +13:00
2022-09-13 06:26:04 +12:00
( void ) p_ctx ;
2021-06-24 02:00:49 +12:00
testStart ( " test_bad_args " ) ;
2022-07-21 23:29:53 +12:00
/* These just return, no error */
2020-10-01 00:19:12 +13:00
ZBarcode_Clear ( NULL ) ;
ZBarcode_Delete ( NULL ) ;
ret = ZBarcode_Version ( ) ;
assert_nonzero ( ret > = 20901 , " ZBarcode_Version() %d <= 20901 \n " , ret ) ;
assert_zero ( ZBarcode_ValidID ( 0 ) , " ZBarcode_ValidID(0) non-zero \n " ) ;
2022-07-21 23:29:53 +12:00
assert_zero ( ZBarcode_ValidID ( 10 ) , " ZBarcode_ValidID(10) non-zero \n " ) ; /* Note 10 remapped to BARCODE_EANX in ZBarcode_Encode() for tbarcode compat but not counted as valid */
2020-10-01 00:19:12 +13:00
ret = ZBarcode_Cap ( 0 , ~ 0 ) ;
assert_zero ( ret , " ZBarcode_Cap(0, ~0) ret 0x%X != 0 \n " , ret ) ;
ret = ZBarcode_Cap ( 10 , ~ 0 ) ;
assert_zero ( ret , " ZBarcode_Cap(10, ~0) ret 0x%X != 0 \n " , ret ) ;
2022-07-21 23:29:53 +12:00
/* NULL symbol */
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
assert_equal ( ZBarcode_Encode ( NULL , TU ( data ) , 1 ) , ZINT_ERROR_INVALID_DATA , " ZBarcode_Encode(NULL, data, 1) != ZINT_ERROR_INVALID_DATA \n " ) ;
assert_equal ( ZBarcode_Encode_Segs ( NULL , & seg , 1 ) , ZINT_ERROR_INVALID_DATA , " ZBarcode_Encode_Segs(NULL, &seg, 1) != ZINT_ERROR_INVALID_DATA \n " ) ;
2020-10-01 00:19:12 +13:00
assert_equal ( ZBarcode_Print ( NULL , 0 ) , ZINT_ERROR_INVALID_DATA , " ZBarcode_Print(NULL, 0) != ZINT_ERROR_INVALID_DATA \n " ) ;
assert_equal ( ZBarcode_Buffer ( NULL , 0 ) , ZINT_ERROR_INVALID_DATA , " ZBarcode_Buffer(NULL, 0) != ZINT_ERROR_INVALID_DATA \n " ) ;
assert_equal ( ZBarcode_Buffer_Vector ( NULL , 0 ) , ZINT_ERROR_INVALID_DATA , " ZBarcode_Buffer_Vector(NULL, 0) != ZINT_ERROR_INVALID_DATA \n " ) ;
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
assert_equal ( ZBarcode_Encode_and_Print ( NULL , TU ( data ) , 1 , 0 ) , ZINT_ERROR_INVALID_DATA , " ZBarcode_Encode_and_Print(NULL, data, 1, 0) != ZINT_ERROR_INVALID_DATA \n " ) ;
assert_equal ( ZBarcode_Encode_Segs_and_Print ( NULL , & seg , 1 , 0 ) , ZINT_ERROR_INVALID_DATA , " ZBarcode_Encode_Seg_and_Print(NULL, &seg, 1, 0) != ZINT_ERROR_INVALID_DATA \n " ) ;
assert_equal ( ZBarcode_Encode_and_Buffer ( NULL , TU ( data ) , 1 , 0 ) , ZINT_ERROR_INVALID_DATA , " ZBarcode_Encode_and_Buffer(NULL, data, 1, 0) != ZINT_ERROR_INVALID_DATA \n " ) ;
assert_equal ( ZBarcode_Encode_Segs_and_Buffer ( NULL , & seg , 1 , 0 ) , ZINT_ERROR_INVALID_DATA , " ZBarcode_Encode_Segs_and_Buffer(NULL, &seg, 1, 0) != ZINT_ERROR_INVALID_DATA \n " ) ;
assert_equal ( ZBarcode_Encode_and_Buffer_Vector ( NULL , TU ( data ) , 1 , 0 ) , ZINT_ERROR_INVALID_DATA , " ZBarcode_Encode_and_Buffer_Vector(NULL, data, 1, 0) != ZINT_ERROR_INVALID_DATA \n " ) ;
assert_equal ( ZBarcode_Encode_Segs_and_Buffer_Vector ( NULL , & seg , 1 , 0 ) , ZINT_ERROR_INVALID_DATA , " ZBarcode_Encode_Segs_and_Buffer_Vector(NULL, &seg, 1, 0) != ZINT_ERROR_INVALID_DATA \n " ) ;
2020-10-01 00:19:12 +13:00
assert_equal ( ZBarcode_Encode_File ( NULL , filename ) , ZINT_ERROR_INVALID_DATA , " ZBarcode_Encode_File(NULL, filename) != ZINT_ERROR_INVALID_DATA \n " ) ;
assert_equal ( ZBarcode_Encode_File_and_Print ( NULL , filename , 0 ) , ZINT_ERROR_INVALID_DATA , " ZBarcode_Encode_File_and_Print(NULL, filename, 0) != ZINT_ERROR_INVALID_DATA \n " ) ;
assert_equal ( ZBarcode_Encode_File_and_Buffer ( NULL , filename , 0 ) , ZINT_ERROR_INVALID_DATA , " ZBarcode_Encode_File_and_Buffer(NULL, filename, 0) != ZINT_ERROR_INVALID_DATA \n " ) ;
2021-06-24 02:00:49 +12:00
symbol = ZBarcode_Create ( ) ;
2020-10-01 00:19:12 +13:00
assert_nonnull ( symbol , " Symbol not created \n " ) ;
2022-07-21 23:29:53 +12:00
/* NULL data/segs/filename */
2020-10-01 00:19:12 +13:00
symbol - > errtxt [ 0 ] = ' \0 ' ;
assert_equal ( ZBarcode_Encode ( symbol , NULL , 1 ) , ZINT_ERROR_INVALID_DATA , " ZBarcode_Encode(symbol, NULL, 1) != ZINT_ERROR_INVALID_DATA \n " ) ;
2022-09-13 07:19:41 +12:00
assert_nonzero ( ( int ) strlen ( symbol - > errtxt ) , " ZBarcode_Encode(symbol, NULL, 1) no errtxt \n " ) ;
2020-10-01 00:19:12 +13:00
symbol - > errtxt [ 0 ] = ' \0 ' ;
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
assert_equal ( ZBarcode_Encode_Segs ( symbol , NULL , 1 ) , ZINT_ERROR_INVALID_DATA , " ZBarcode_Encode_Segs(symbol, NULL, 1) != ZINT_ERROR_INVALID_DATA \n " ) ;
2022-09-13 07:19:41 +12:00
assert_nonzero ( ( int ) strlen ( symbol - > errtxt ) , " ZBarcode_Encode_Segs(symbol, NULL, 1) no errtxt \n " ) ;
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
symbol - > errtxt [ 0 ] = ' \0 ' ;
2020-10-01 00:19:12 +13:00
assert_equal ( ZBarcode_Encode_and_Print ( symbol , NULL , 1 , 0 ) , ZINT_ERROR_INVALID_DATA , " ZBarcode_Encode_and_Print(symbol, NULL, 1, 0) != ZINT_ERROR_INVALID_DATA \n " ) ;
2022-09-13 07:19:41 +12:00
assert_nonzero ( ( int ) strlen ( symbol - > errtxt ) , " ZBarcode_Encode_and_Print(symbol, NULL, 1, 0) no errtxt \n " ) ;
2020-10-01 00:19:12 +13:00
symbol - > errtxt [ 0 ] = ' \0 ' ;
assert_equal ( ZBarcode_Encode_and_Buffer ( symbol , NULL , 1 , 0 ) , ZINT_ERROR_INVALID_DATA , " ZBarcode_Encode_and_Buffer(symbol, NULL, 1, 0) != ZINT_ERROR_INVALID_DATA \n " ) ;
2022-09-13 07:19:41 +12:00
assert_nonzero ( ( int ) strlen ( symbol - > errtxt ) , " ZBarcode_Encode_and_Buffer(symbol, NULL, 1, 0) no errtxt \n " ) ;
2020-10-01 00:19:12 +13:00
symbol - > errtxt [ 0 ] = ' \0 ' ;
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
assert_equal ( ZBarcode_Encode_Segs_and_Buffer ( symbol , NULL , 1 , 0 ) , ZINT_ERROR_INVALID_DATA , " ZBarcode_Encode_Segs_and_Buffer(symbol, NULL, 1, 0) != ZINT_ERROR_INVALID_DATA \n " ) ;
2022-09-13 07:19:41 +12:00
assert_nonzero ( ( int ) strlen ( symbol - > errtxt ) , " ZBarcode_Encode_Segs_and_Buffer(symbol, NULL, 1, 0) no errtxt \n " ) ;
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
symbol - > errtxt [ 0 ] = ' \0 ' ;
assert_equal ( ZBarcode_Encode_and_Buffer_Vector ( symbol , NULL , 1 , 0 ) , ZINT_ERROR_INVALID_DATA , " ZBarcode_Encode_and_Buffer_Vector(symbol, NULL, 1, 0) != ZINT_ERROR_INVALID_DATA \n " ) ;
2022-09-13 07:19:41 +12:00
assert_nonzero ( ( int ) strlen ( symbol - > errtxt ) , " ZBarcode_Encode_and_Buffer_Vector(symbol, NULL, 1, 0) no errtxt \n " ) ;
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
symbol - > errtxt [ 0 ] = ' \0 ' ;
assert_equal ( ZBarcode_Encode_Segs_and_Buffer_Vector ( symbol , NULL , 1 , 0 ) , ZINT_ERROR_INVALID_DATA , " ZBarcode_Encode_Segs_and_Buffer_Vector(symbol, NULL, 1, 0) != ZINT_ERROR_INVALID_DATA \n " ) ;
2022-09-13 07:19:41 +12:00
assert_nonzero ( ( int ) strlen ( symbol - > errtxt ) , " ZBarcode_Encode_Segs_and_Buffer_Vector(symbol, NULL, 1, 0) no errtxt \n " ) ;
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
symbol - > errtxt [ 0 ] = ' \0 ' ;
2020-10-01 00:19:12 +13:00
assert_equal ( ZBarcode_Encode_File ( symbol , NULL ) , ZINT_ERROR_INVALID_DATA , " ZBarcode_Encode_File(symbol, NULL) != ZINT_ERROR_INVALID_DATA \n " ) ;
2022-09-13 07:19:41 +12:00
assert_nonzero ( ( int ) strlen ( symbol - > errtxt ) , " ZBarcode_Encode_File(symbol, NULL) no errtxt \n " ) ;
2020-10-01 00:19:12 +13:00
symbol - > errtxt [ 0 ] = ' \0 ' ;
assert_equal ( ZBarcode_Encode_File_and_Print ( symbol , NULL , 0 ) , ZINT_ERROR_INVALID_DATA , " ZBarcode_Encode_File_and_Print(symbol, NULL, 0) != ZINT_ERROR_INVALID_DATA \n " ) ;
2022-09-13 07:19:41 +12:00
assert_nonzero ( ( int ) strlen ( symbol - > errtxt ) , " ZBarcode_Encode_File_and_Print(symbol, NULL, 0) no errtxt \n " ) ;
2020-10-01 00:19:12 +13:00
symbol - > errtxt [ 0 ] = ' \0 ' ;
assert_equal ( ZBarcode_Encode_File_and_Buffer ( symbol , NULL , 0 ) , ZINT_ERROR_INVALID_DATA , " ZBarcode_Encode_File_and_Buffer(symbol, NULL, 0) != ZINT_ERROR_INVALID_DATA \n " ) ;
2022-09-13 07:19:41 +12:00
assert_nonzero ( ( int ) strlen ( symbol - > errtxt ) , " ZBarcode_Encode_File_and_Buffer(symbol, NULL, 0) no errtxt \n " ) ;
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
symbol - > errtxt [ 0 ] = ' \0 ' ;
assert_equal ( ZBarcode_Encode_File_and_Buffer_Vector ( symbol , NULL , 0 ) , ZINT_ERROR_INVALID_DATA , " ZBarcode_Encode_File_and_Buffer_Vector(symbol, NULL, 0) != ZINT_ERROR_INVALID_DATA \n " ) ;
2022-09-13 07:19:41 +12:00
assert_nonzero ( ( int ) strlen ( symbol - > errtxt ) , " ZBarcode_Encode_File_and_Buffer_Vector(symbol, NULL, 0) no errtxt \n " ) ;
2020-10-01 00:19:12 +13:00
2022-07-21 23:29:53 +12:00
/* Empty data/segs/filename */
2020-10-01 00:19:12 +13:00
symbol - > errtxt [ 0 ] = ' \0 ' ;
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
assert_equal ( ZBarcode_Encode ( symbol , TU ( empty ) , 0 ) , ZINT_ERROR_INVALID_DATA , " ZBarcode_Encode(symbol, empty, 0) != ZINT_ERROR_INVALID_DATA \n " ) ;
2022-09-13 07:19:41 +12:00
assert_nonzero ( ( int ) strlen ( symbol - > errtxt ) , " ZBarcode_Encode(symbol, empty, 0) no errtxt \n " ) ;
2020-10-01 00:19:12 +13:00
symbol - > errtxt [ 0 ] = ' \0 ' ;
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
assert_equal ( ZBarcode_Encode_Segs ( symbol , & seg_empty , 1 ) , ZINT_ERROR_INVALID_DATA , " ZBarcode_Encode_Segs(symbol, &seg_empty, 1) != ZINT_ERROR_INVALID_DATA \n " ) ;
2022-09-13 07:19:41 +12:00
assert_nonzero ( ( int ) strlen ( symbol - > errtxt ) , " ZBarcode_Encode_Segs(symbol, &seg_empty, 1) no errtxt \n " ) ;
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
symbol - > errtxt [ 0 ] = ' \0 ' ;
assert_equal ( ZBarcode_Encode_and_Print ( symbol , TU ( empty ) , 0 , 0 ) , ZINT_ERROR_INVALID_DATA , " ZBarcode_Encode_and_Print(symbol, empty, 0, 0) != ZINT_ERROR_INVALID_DATA \n " ) ;
2022-09-13 07:19:41 +12:00
assert_nonzero ( ( int ) strlen ( symbol - > errtxt ) , " ZBarcode_Encode_and_Print(symbol, empty, 0, 0) no errtxt \n " ) ;
2020-10-01 00:19:12 +13:00
symbol - > errtxt [ 0 ] = ' \0 ' ;
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
assert_equal ( ZBarcode_Encode_and_Buffer ( symbol , TU ( empty ) , 0 , 0 ) , ZINT_ERROR_INVALID_DATA , " ZBarcode_Encode_and_Buffer(symbol, empty, 0, 0) != ZINT_ERROR_INVALID_DATA \n " ) ;
2022-09-13 07:19:41 +12:00
assert_nonzero ( ( int ) strlen ( symbol - > errtxt ) , " ZBarcode_Encode_and_Buffer(symbol, empty, 0, 0) no errtxt \n " ) ;
2020-10-01 00:19:12 +13:00
symbol - > errtxt [ 0 ] = ' \0 ' ;
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
assert_equal ( ZBarcode_Encode_Segs_and_Buffer ( symbol , & seg_empty , 1 , 0 ) , ZINT_ERROR_INVALID_DATA , " ZBarcode_Encode_Segs_and_Buffer(symbol, &seg_empty, 1, 0) != ZINT_ERROR_INVALID_DATA \n " ) ;
2022-09-13 07:19:41 +12:00
assert_nonzero ( ( int ) strlen ( symbol - > errtxt ) , " ZBarcode_Encode_Segs_and_Buffer(symbol, &seg_empty, 1, 0) no errtxt \n " ) ;
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
symbol - > errtxt [ 0 ] = ' \0 ' ;
assert_equal ( ZBarcode_Encode_and_Buffer_Vector ( symbol , TU ( empty ) , 0 , 0 ) , ZINT_ERROR_INVALID_DATA , " ZBarcode_Encode_and_Buffer_Vector(symbol, empty, 0, 0) != ZINT_ERROR_INVALID_DATA \n " ) ;
2022-09-13 07:19:41 +12:00
assert_nonzero ( ( int ) strlen ( symbol - > errtxt ) , " ZBarcode_Encode_and_Buffer_Vector(symbol, empty, 0, 0) no errtxt \n " ) ;
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
symbol - > errtxt [ 0 ] = ' \0 ' ;
assert_equal ( ZBarcode_Encode_Segs_and_Buffer_Vector ( symbol , & seg_empty , 1 , 0 ) , ZINT_ERROR_INVALID_DATA , " ZBarcode_Encode_Segs_and_Buffer_Vector(symbol, &seg_empty, 1, 0) != ZINT_ERROR_INVALID_DATA \n " ) ;
2022-09-13 07:19:41 +12:00
assert_nonzero ( ( int ) strlen ( symbol - > errtxt ) , " ZBarcode_Encode_Segs_and_Buffer_Vector(symbol, &seg_empty, 1, 0) no errtxt \n " ) ;
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
symbol - > errtxt [ 0 ] = ' \0 ' ;
2020-10-01 00:19:12 +13:00
assert_equal ( ZBarcode_Encode_File ( symbol , empty ) , ZINT_ERROR_INVALID_DATA , " ZBarcode_Encode_File(symbol, empty) != ZINT_ERROR_INVALID_DATA \n " ) ;
2022-09-13 07:19:41 +12:00
assert_nonzero ( ( int ) strlen ( symbol - > errtxt ) , " ZBarcode_Encode_File(symbol, empty) no errtxt \n " ) ;
2020-10-01 00:19:12 +13:00
symbol - > errtxt [ 0 ] = ' \0 ' ;
assert_equal ( ZBarcode_Encode_File_and_Print ( symbol , empty , 0 ) , ZINT_ERROR_INVALID_DATA , " ZBarcode_Encode_File_and_Print(symbol, empty, 0) != ZINT_ERROR_INVALID_DATA \n " ) ;
2022-09-13 07:19:41 +12:00
assert_nonzero ( ( int ) strlen ( symbol - > errtxt ) , " ZBarcode_Encode_File_and_Print(symbol, empty, 0) no errtxt \n " ) ;
2020-10-01 00:19:12 +13:00
symbol - > errtxt [ 0 ] = ' \0 ' ;
assert_equal ( ZBarcode_Encode_File_and_Buffer ( symbol , empty , 0 ) , ZINT_ERROR_INVALID_DATA , " ZBarcode_Encode_File_and_Buffer(symbol, empty, 0) != ZINT_ERROR_INVALID_DATA \n " ) ;
2022-09-13 07:19:41 +12:00
assert_nonzero ( ( int ) strlen ( symbol - > errtxt ) , " ZBarcode_Encode_File_and_Buffer(symbol, empty, 0) no errtxt \n " ) ;
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
symbol - > errtxt [ 0 ] = ' \0 ' ;
assert_equal ( ZBarcode_Encode_File_and_Buffer_Vector ( symbol , empty , 0 ) , ZINT_ERROR_INVALID_DATA , " ZBarcode_Encode_File_and_Buffer_Vector(symbol, empty, 0) != ZINT_ERROR_INVALID_DATA \n " ) ;
2022-09-13 07:19:41 +12:00
assert_nonzero ( ( int ) strlen ( symbol - > errtxt ) , " ZBarcode_Encode_File_and_Buffer_Vector(symbol, empty, 0) no errtxt \n " ) ;
2020-10-01 00:19:12 +13:00
2022-07-21 23:29:53 +12:00
/* Bad seg_count */
2020-12-22 08:30:07 +13:00
symbol - > errtxt [ 0 ] = ' \0 ' ;
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
assert_equal ( ZBarcode_Encode_Segs ( symbol , & seg_empty , ZINT_MAX_SEG_COUNT + 1 ) , ZINT_ERROR_INVALID_DATA , " ZBarcode_Encode_Segs(symbol, &seg_empty, ZINT_MAX_SEG_COUNT + 1) != ZINT_ERROR_INVALID_DATA \n " ) ;
assert_nonzero ( ( int ) strlen ( symbol - > errtxt ) , " ZBarcode_Encode_Segs(symbol, &seg_empty, ZINT_MAX_SEG_COUNT + 1) no errtxt \n " ) ;
symbol - > errtxt [ 0 ] = ' \0 ' ;
assert_equal ( ZBarcode_Encode_Segs ( symbol , & seg_empty , 0 ) , ZINT_ERROR_INVALID_DATA , " ZBarcode_Encode_Segs(symbol, &seg_empty, 0) != ZINT_ERROR_INVALID_DATA \n " ) ;
assert_nonzero ( ( int ) strlen ( symbol - > errtxt ) , " ZBarcode_Encode_Segs(symbol, &seg_empty, 0) no errtxt \n " ) ;
symbol - > errtxt [ 0 ] = ' \0 ' ;
assert_equal ( ZBarcode_Encode_Segs ( symbol , & seg_empty , - 1 ) , ZINT_ERROR_INVALID_DATA , " ZBarcode_Encode_Segs(symbol, &seg_empty, -1) != ZINT_ERROR_INVALID_DATA \n " ) ;
assert_nonzero ( ( int ) strlen ( symbol - > errtxt ) , " ZBarcode_Encode_Segs(symbol, &seg_empty, -1) no errtxt \n " ) ;
2022-07-21 23:29:53 +12:00
/* Data/seg too big */
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
symbol - > errtxt [ 0 ] = ' \0 ' ;
assert_equal ( ZBarcode_Encode ( symbol , TU ( empty ) , ZINT_MAX_DATA_LEN + 1 ) , ZINT_ERROR_TOO_LONG , " ZBarcode_Encode(symbol, empty, ZINT_MAX_DATA_LEN + 1) != ZINT_ERROR_TOO_LONG \n " ) ;
2021-10-19 02:05:51 +13:00
assert_nonzero ( ( int ) strlen ( symbol - > errtxt ) , " ZBarcode_Encode(symbol, empty, ZINT_MAX_DATA_LEN + 1) no errtxt \n " ) ;
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
symbol - > errtxt [ 0 ] = ' \0 ' ;
assert_equal ( ZBarcode_Encode_Segs ( symbol , & seg_too_long , 1 ) , ZINT_ERROR_TOO_LONG , " ZBarcode_Encode_Segs(symbol, &seg_too_long, 1) != ZINT_ERROR_TOO_LONG \n " ) ;
assert_nonzero ( ( int ) strlen ( symbol - > errtxt ) , " ZBarcode_Encode_Segs(symbol, &seg_too_long, 1) no errtxt \n " ) ;
2020-12-22 08:30:07 +13:00
2020-10-01 00:19:12 +13:00
ZBarcode_Delete ( symbol ) ;
testFinish ( ) ;
}
2022-09-13 06:26:04 +12:00
static void test_valid_id ( const testCtx * const p_ctx ) {
2020-11-02 07:32:55 +13:00
int ret ;
const char * name ;
2021-06-24 02:00:49 +12:00
int symbol_id ;
2020-11-02 07:32:55 +13:00
2022-09-13 06:26:04 +12:00
( void ) p_ctx ;
2021-06-24 02:00:49 +12:00
testStart ( " test_valid_id " ) ;
for ( symbol_id = - 1 ; symbol_id < 160 ; symbol_id + + ) {
2020-11-02 07:32:55 +13:00
ret = ZBarcode_ValidID ( symbol_id ) ;
name = testUtilBarcodeName ( symbol_id ) ;
2021-06-24 02:00:49 +12:00
assert_nonnull ( ( char * ) name , " testUtilBarcodeName(%d) NULL \n " , symbol_id ) ;
2020-11-02 07:32:55 +13:00
if ( ret ) {
assert_equal ( ret , 1 , " ZBarcode_Valid(%d) != 1 \n " , symbol_id ) ;
assert_nonzero ( * name ! = ' \0 ' , " testUtilBarcodeName(%d) empty when ZBarcode_Valid() true \n " , symbol_id ) ;
} else {
assert_zero ( ret , " ZBarcode_Valid(%d) != 0 \n " , symbol_id ) ;
assert_zero ( * name , " testUtilBarcodeName(%d) non-empty when ZBarcode_Valid() false \n " , symbol_id ) ;
}
}
testFinish ( ) ;
}
RMQR: update to ISO/IEC 23941:2022 - R13x77 numeric cclens change 8 -> 7
QRCODE: use stricter interpretation of ZINT_FULL_MULTIBYTE, excluding
certain trailing bytes
libzint: fix some confusing error messages introduced by segment stuff
general: new escape chars \U, \d and \o
backend_qt: fudge rendering of border rectangles due to scaling/translation
rounding errors TODO: better fudge
GUI: foreground/background colours -> text boxes and icon buttons, add swap
button, independently movable picker (NULL parent), preview colour changes,
preview Data Window changes, add clear data (del) buttons, add zap button
and Factory Reset menu option, various other fixes
libzint: remove STATIC_UNLESS_ZINT_TEST, use wrappers
CMake: add find package QtSvg, remove QtXml
manual: split symbology and general specs and sort, move DAFT to 4-state,
UPC/EAN -> EAN/UPC, DataBar -> GS1 DataBar always, expand MAILMARK info,
various other fiddlings
man page: options or -> |, expand MSI Plessey check digit options
README.linux: add packages info
license: add SPDX-License-Identifier to touched files
2022-06-10 08:52:02 +12:00
INTERNAL int error_tag_test ( struct zint_symbol * symbol , int error_number , const char * error_string ) ;
2021-01-16 03:22:32 +13:00
2022-09-13 06:26:04 +12:00
static void test_error_tag ( const testCtx * const p_ctx ) {
2021-01-13 08:51:54 +13:00
struct item {
int error_number ;
2021-07-07 06:53:31 +12:00
int warn_level ;
2021-08-10 23:04:25 +12:00
char * data ;
2021-01-13 08:51:54 +13:00
int ret ;
2021-08-10 23:04:25 +12:00
char * expected ;
2021-01-13 08:51:54 +13:00
} ;
2022-07-21 23:29:53 +12:00
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
2021-01-13 08:51:54 +13:00
struct item data [ ] = {
2021-07-07 06:53:31 +12:00
/* 0*/ { ZINT_WARN_INVALID_OPTION , - 1 , " " , ZINT_WARN_INVALID_OPTION , " Warning " } ,
/* 1*/ { ZINT_WARN_INVALID_OPTION , WARN_FAIL_ALL , " " , ZINT_ERROR_INVALID_OPTION , " Error " } ,
/* 2*/ { ZINT_WARN_USES_ECI , - 1 , " " , ZINT_WARN_USES_ECI , " Warning " } ,
/* 3*/ { ZINT_WARN_USES_ECI , WARN_FAIL_ALL , " " , ZINT_ERROR_USES_ECI , " Error " } ,
/* 4*/ { ZINT_WARN_NONCOMPLIANT , - 1 , " " , ZINT_WARN_NONCOMPLIANT , " Warning " } ,
/* 5*/ { ZINT_WARN_NONCOMPLIANT , WARN_FAIL_ALL , " " , ZINT_ERROR_NONCOMPLIANT , " Error " } ,
/* 6*/ { ZINT_ERROR_TOO_LONG , WARN_DEFAULT , " " , ZINT_ERROR_TOO_LONG , " Error " } ,
2021-09-01 05:34:29 +12:00
/* 7*/ { ZINT_ERROR_TOO_LONG , WARN_FAIL_ALL , " " , ZINT_ERROR_TOO_LONG , " Error " } ,
/* 8*/ { ZINT_WARN_USES_ECI , - 1 , " 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 " , ZINT_WARN_USES_ECI , " Warning 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901 " } ,
/* 9*/ { ZINT_WARN_USES_ECI , WARN_FAIL_ALL , " 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 " , ZINT_ERROR_USES_ECI , " Error 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123 " } ,
/* 10*/ { ZINT_ERROR_INVALID_DATA , - 1 , " 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 " , ZINT_ERROR_INVALID_DATA , " Error 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123 " } ,
/* 11*/ { ZINT_ERROR_INVALID_DATA , WARN_FAIL_ALL , " 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 " , ZINT_ERROR_INVALID_DATA , " Error 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123 " } ,
/* 12*/ { ZINT_WARN_USES_ECI , - 1 , " 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 " , ZINT_WARN_USES_ECI , " Warning 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901 " } ,
/* 13*/ { ZINT_WARN_USES_ECI , WARN_FAIL_ALL , " 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 " , ZINT_ERROR_USES_ECI , " Error 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123 " } ,
/* 14*/ { ZINT_ERROR_INVALID_DATA , - 1 , " 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 " , ZINT_ERROR_INVALID_DATA , " Error 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123 " } ,
2021-01-13 08:51:54 +13:00
} ;
int data_size = ARRAY_SIZE ( data ) ;
2021-06-24 02:00:49 +12:00
int i , ret ;
2021-01-13 08:51:54 +13:00
2021-06-24 02:00:49 +12:00
testStart ( " test_error_tag " ) ;
for ( i = 0 ; i < data_size ; i + + ) {
2021-07-07 06:53:31 +12:00
struct zint_symbol symbol = { 0 } ;
2021-01-13 08:51:54 +13:00
2022-09-13 06:26:04 +12:00
if ( testContinue ( p_ctx , i ) ) continue ;
2021-01-13 08:51:54 +13:00
2021-07-07 06:53:31 +12:00
symbol . warn_level = data [ i ] . warn_level ;
RMQR: update to ISO/IEC 23941:2022 - R13x77 numeric cclens change 8 -> 7
QRCODE: use stricter interpretation of ZINT_FULL_MULTIBYTE, excluding
certain trailing bytes
libzint: fix some confusing error messages introduced by segment stuff
general: new escape chars \U, \d and \o
backend_qt: fudge rendering of border rectangles due to scaling/translation
rounding errors TODO: better fudge
GUI: foreground/background colours -> text boxes and icon buttons, add swap
button, independently movable picker (NULL parent), preview colour changes,
preview Data Window changes, add clear data (del) buttons, add zap button
and Factory Reset menu option, various other fixes
libzint: remove STATIC_UNLESS_ZINT_TEST, use wrappers
CMake: add find package QtSvg, remove QtXml
manual: split symbology and general specs and sort, move DAFT to 4-state,
UPC/EAN -> EAN/UPC, DataBar -> GS1 DataBar always, expand MAILMARK info,
various other fiddlings
man page: options or -> |, expand MSI Plessey check digit options
README.linux: add packages info
license: add SPDX-License-Identifier to touched files
2022-06-10 08:52:02 +12:00
ret = error_tag_test ( & symbol , data [ i ] . error_number , data [ i ] . data ) ;
2021-01-13 08:51:54 +13:00
assert_equal ( ret , data [ i ] . ret , " i:%d ret %d != %d \n " , i , ret , data [ i ] . ret ) ;
2021-07-07 06:53:31 +12:00
assert_zero ( strcmp ( symbol . errtxt , data [ i ] . expected ) , " i:%d strcmp(%s, %s) != 0 \n " , i , symbol . errtxt , data [ i ] . expected ) ;
if ( ( int ) strlen ( data [ i ] . data ) < 100 ) {
strcpy ( symbol . errtxt , data [ i ] . data ) ;
RMQR: update to ISO/IEC 23941:2022 - R13x77 numeric cclens change 8 -> 7
QRCODE: use stricter interpretation of ZINT_FULL_MULTIBYTE, excluding
certain trailing bytes
libzint: fix some confusing error messages introduced by segment stuff
general: new escape chars \U, \d and \o
backend_qt: fudge rendering of border rectangles due to scaling/translation
rounding errors TODO: better fudge
GUI: foreground/background colours -> text boxes and icon buttons, add swap
button, independently movable picker (NULL parent), preview colour changes,
preview Data Window changes, add clear data (del) buttons, add zap button
and Factory Reset menu option, various other fixes
libzint: remove STATIC_UNLESS_ZINT_TEST, use wrappers
CMake: add find package QtSvg, remove QtXml
manual: split symbology and general specs and sort, move DAFT to 4-state,
UPC/EAN -> EAN/UPC, DataBar -> GS1 DataBar always, expand MAILMARK info,
various other fiddlings
man page: options or -> |, expand MSI Plessey check digit options
README.linux: add packages info
license: add SPDX-License-Identifier to touched files
2022-06-10 08:52:02 +12:00
ret = error_tag_test ( & symbol , data [ i ] . error_number , NULL ) ;
2021-07-07 06:53:31 +12:00
assert_equal ( ret , data [ i ] . ret , " i:%d ret %d != %d \n " , i , ret , data [ i ] . ret ) ;
assert_zero ( strcmp ( symbol . errtxt , data [ i ] . expected ) , " i:%d strcmp(%s, %s) != 0 \n " , i , symbol . errtxt , data [ i ] . expected ) ;
}
2021-01-13 08:51:54 +13:00
}
testFinish ( ) ;
}
RMQR: update to ISO/IEC 23941:2022 - R13x77 numeric cclens change 8 -> 7
QRCODE: use stricter interpretation of ZINT_FULL_MULTIBYTE, excluding
certain trailing bytes
libzint: fix some confusing error messages introduced by segment stuff
general: new escape chars \U, \d and \o
backend_qt: fudge rendering of border rectangles due to scaling/translation
rounding errors TODO: better fudge
GUI: foreground/background colours -> text boxes and icon buttons, add swap
button, independently movable picker (NULL parent), preview colour changes,
preview Data Window changes, add clear data (del) buttons, add zap button
and Factory Reset menu option, various other fixes
libzint: remove STATIC_UNLESS_ZINT_TEST, use wrappers
CMake: add find package QtSvg, remove QtXml
manual: split symbology and general specs and sort, move DAFT to 4-state,
UPC/EAN -> EAN/UPC, DataBar -> GS1 DataBar always, expand MAILMARK info,
various other fiddlings
man page: options or -> |, expand MSI Plessey check digit options
README.linux: add packages info
license: add SPDX-License-Identifier to touched files
2022-06-10 08:52:02 +12:00
INTERNAL void strip_bom_test ( unsigned char * source , int * input_length ) ;
2021-01-13 08:51:54 +13:00
2022-09-13 06:26:04 +12:00
static void test_strip_bom ( const testCtx * const p_ctx ) {
2021-01-13 08:51:54 +13:00
2021-06-24 02:00:49 +12:00
int length , ret ;
2022-07-21 23:29:53 +12:00
char data [ ] = " \357 \273 \277 A " ; /* U+FEFF BOM, with "A" */
char bom_only [ ] = " \357 \273 \277 " ; /* U+FEFF BOM only */
2021-01-13 08:51:54 +13:00
char buf [ 6 ] ;
2022-09-13 06:26:04 +12:00
( void ) p_ctx ;
2021-06-24 02:00:49 +12:00
testStart ( " test_strip_bom " ) ;
2021-01-13 08:51:54 +13:00
strcpy ( buf , data ) ;
length = ( int ) strlen ( buf ) ;
RMQR: update to ISO/IEC 23941:2022 - R13x77 numeric cclens change 8 -> 7
QRCODE: use stricter interpretation of ZINT_FULL_MULTIBYTE, excluding
certain trailing bytes
libzint: fix some confusing error messages introduced by segment stuff
general: new escape chars \U, \d and \o
backend_qt: fudge rendering of border rectangles due to scaling/translation
rounding errors TODO: better fudge
GUI: foreground/background colours -> text boxes and icon buttons, add swap
button, independently movable picker (NULL parent), preview colour changes,
preview Data Window changes, add clear data (del) buttons, add zap button
and Factory Reset menu option, various other fixes
libzint: remove STATIC_UNLESS_ZINT_TEST, use wrappers
CMake: add find package QtSvg, remove QtXml
manual: split symbology and general specs and sort, move DAFT to 4-state,
UPC/EAN -> EAN/UPC, DataBar -> GS1 DataBar always, expand MAILMARK info,
various other fiddlings
man page: options or -> |, expand MSI Plessey check digit options
README.linux: add packages info
license: add SPDX-License-Identifier to touched files
2022-06-10 08:52:02 +12:00
strip_bom_test ( TU ( buf ) , & length ) ;
2021-01-13 08:51:54 +13:00
assert_equal ( length , 1 , " length %d != 1 \n " , length ) ;
assert_zero ( buf [ 1 ] , " buf[1] %d != 0 \n " , buf [ 1 ] ) ;
2022-07-21 23:29:53 +12:00
/* BOM not stripped if only data */
2021-01-13 08:51:54 +13:00
strcpy ( buf , bom_only ) ;
length = ( int ) strlen ( buf ) ;
RMQR: update to ISO/IEC 23941:2022 - R13x77 numeric cclens change 8 -> 7
QRCODE: use stricter interpretation of ZINT_FULL_MULTIBYTE, excluding
certain trailing bytes
libzint: fix some confusing error messages introduced by segment stuff
general: new escape chars \U, \d and \o
backend_qt: fudge rendering of border rectangles due to scaling/translation
rounding errors TODO: better fudge
GUI: foreground/background colours -> text boxes and icon buttons, add swap
button, independently movable picker (NULL parent), preview colour changes,
preview Data Window changes, add clear data (del) buttons, add zap button
and Factory Reset menu option, various other fixes
libzint: remove STATIC_UNLESS_ZINT_TEST, use wrappers
CMake: add find package QtSvg, remove QtXml
manual: split symbology and general specs and sort, move DAFT to 4-state,
UPC/EAN -> EAN/UPC, DataBar -> GS1 DataBar always, expand MAILMARK info,
various other fiddlings
man page: options or -> |, expand MSI Plessey check digit options
README.linux: add packages info
license: add SPDX-License-Identifier to touched files
2022-06-10 08:52:02 +12:00
strip_bom_test ( TU ( buf ) , & length ) ;
2021-01-13 08:51:54 +13:00
assert_equal ( length , 3 , " BOM only length %d != 3 \n " , length ) ;
ret = strcmp ( buf , bom_only ) ;
assert_zero ( ret , " BOM only strcmp ret %d != 0 \n " , ret ) ;
testFinish ( ) ;
}
2022-09-13 06:26:04 +12:00
static void test_zero_outfile ( const testCtx * const p_ctx ) {
2021-06-30 02:43:42 +12:00
int ret ;
struct zint_symbol * symbol ;
char * data = " 1234 " ;
2022-09-13 06:26:04 +12:00
( void ) p_ctx ;
2021-06-30 02:43:42 +12:00
testStart ( " test_zero_outfile " ) ;
symbol = ZBarcode_Create ( ) ;
assert_nonnull ( symbol , " Symbol not created \n " ) ;
assert_nonzero ( symbol - > outfile [ 0 ] , " ZBarcode_Create() outfile zero \n " ) ;
symbol - > outfile [ 0 ] = ' \0 ' ;
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
ret = ZBarcode_Encode ( symbol , TU ( data ) , 0 ) ;
2021-06-30 02:43:42 +12:00
assert_zero ( ret , " ZBarcode_Encode(%s) ret %d != 0 (%s) \n " , data , ret , symbol - > errtxt ) ;
assert_zero ( symbol - > outfile [ 0 ] , " ZBarcode_Encode() outfile non-zero \n " ) ;
ret = ZBarcode_Print ( symbol , 0 ) ;
assert_equal ( ret , ZINT_ERROR_INVALID_OPTION , " ZBarcode_Print() ret %d != ZINT_ERROR_INVALID_OPTION (%s) \n " , ret , symbol - > errtxt ) ;
assert_zero ( symbol - > outfile [ 0 ] , " ZBarcode_Print() outfile non-zero \n " ) ;
ret = ZBarcode_Buffer ( symbol , 0 ) ;
assert_zero ( ret , " ZBarcode_Buffer() ret %d != 0 (%s) \n " , ret , symbol - > errtxt ) ;
assert_zero ( symbol - > outfile [ 0 ] , " ZBarcode_Buffer() outfile non-zero \n " ) ;
ZBarcode_Delete ( symbol ) ;
testFinish ( ) ;
}
2022-09-13 06:26:04 +12:00
static void test_clear ( const testCtx * const p_ctx ) {
2021-07-07 06:53:31 +12:00
int ret ;
struct zint_symbol * symbol ;
char * data = " 1234 " ;
2022-09-13 06:26:04 +12:00
( void ) p_ctx ;
2021-07-07 06:53:31 +12:00
testStart ( " test_clear " ) ;
symbol = ZBarcode_Create ( ) ;
assert_nonnull ( symbol , " Symbol not created \n " ) ;
symbol - > symbology = BARCODE_MAXICODE ;
symbol - > whitespace_width = 5 ;
symbol - > whitespace_height = 5 ;
symbol - > border_width = 2 ;
symbol - > output_options = BARCODE_BOX ;
strcpy ( symbol - > fgcolour , " 000000AA " ) ;
strcpy ( symbol - > bgcolour , " FFFFFFAA " ) ;
2022-07-21 23:29:53 +12:00
/* Raster */
2021-07-07 06:53:31 +12:00
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
ret = ZBarcode_Encode ( symbol , TU ( data ) , 0 ) ;
2021-07-07 06:53:31 +12:00
assert_zero ( ret , " ZBarcode_Encode() ret %d != 0 (%s) \n " , ret , symbol - > errtxt ) ;
assert_nonzero ( symbol - > rows , " ZBarcode_Encode() rows 0 \n " ) ;
assert_nonzero ( symbol - > width , " ZBarcode_Encode() width 0 \n " ) ;
ret = ZBarcode_Buffer ( symbol , 0 ) ;
assert_zero ( ret , " ZBarcode_Buffer() ret %d != 0 (%s) \n " , ret , symbol - > errtxt ) ;
assert_nonnull ( symbol - > bitmap , " ZBarcode_Buffer() bitmap NULL \n " ) ;
assert_nonnull ( symbol - > alphamap , " ZBarcode_Buffer() alphamap NULL \n " ) ;
assert_nonzero ( symbol - > bitmap_width , " ZBarcode_Buffer() bitmap_width 0 \n " ) ;
assert_nonzero ( symbol - > bitmap_height , " ZBarcode_Buffer() bitmap_height 0 \n " ) ;
assert_nonzero ( symbol - > rows , " ZBarcode_Buffer() rows 0 \n " ) ;
assert_nonzero ( symbol - > width , " ZBarcode_Buffer() width 0 \n " ) ;
2021-07-08 00:58:04 +12:00
assert_zero ( symbol - > bitmap_byte_length , " ZBarcode_Buffer() bitmap_byte_length %d != 0 \n " , ( int ) symbol - > bitmap_byte_length ) ;
2021-07-07 06:53:31 +12:00
assert_null ( symbol - > vector , " ZBarcode_Buffer() vector != NULL \n " ) ;
ZBarcode_Clear ( symbol ) ;
assert_null ( symbol - > bitmap , " ZBarcode_Buffer() bitmap != NULL \n " ) ;
assert_null ( symbol - > alphamap , " ZBarcode_Buffer() alphamap != NULL \n " ) ;
assert_zero ( symbol - > bitmap_width , " ZBarcode_Buffer() bitmap_width %d != 0 \n " , symbol - > bitmap_width ) ;
assert_zero ( symbol - > bitmap_height , " ZBarcode_Buffer() bitmap_height %d != 0 \n " , symbol - > bitmap_height ) ;
assert_zero ( symbol - > rows , " ZBarcode_Buffer() rows %d != 0 \n " , symbol - > rows ) ;
assert_zero ( symbol - > width , " ZBarcode_Buffer() width %d != 0 \n " , symbol - > width ) ;
2021-07-08 00:58:04 +12:00
assert_zero ( symbol - > bitmap_byte_length , " ZBarcode_Buffer() bitmap_byte_length %d != 0 \n " , ( int ) symbol - > bitmap_byte_length ) ;
2021-07-07 06:53:31 +12:00
assert_null ( symbol - > vector , " ZBarcode_Buffer() vector != NULL \n " ) ;
2022-07-21 23:29:53 +12:00
/* Vector */
2021-07-07 06:53:31 +12:00
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
ret = ZBarcode_Encode ( symbol , TU ( data ) , 0 ) ;
2021-07-07 06:53:31 +12:00
assert_zero ( ret , " ZBarcode_Encode() ret %d != 0 (%s) \n " , ret , symbol - > errtxt ) ;
assert_nonzero ( symbol - > rows , " ZBarcode_Encode() rows 0 \n " ) ;
assert_nonzero ( symbol - > width , " ZBarcode_Encode() width 0 \n " ) ;
ret = ZBarcode_Buffer_Vector ( symbol , 0 ) ;
assert_zero ( ret , " ZBarcode_Buffer_Vector() ret %d != 0 (%s) \n " , ret , symbol - > errtxt ) ;
assert_nonnull ( symbol - > vector , " ZBarcode_Buffer_Vector() vector NULL \n " ) ;
assert_nonnull ( symbol - > vector - > rectangles , " ZBarcode_Buffer_Vector() vector->rectangles NULL \n " ) ;
assert_nonnull ( symbol - > vector - > hexagons , " ZBarcode_Buffer_Vector() vector->hexagons NULL \n " ) ;
2022-07-21 23:29:53 +12:00
assert_null ( symbol - > vector - > strings , " ZBarcode_Buffer_Vector() vector->strings != NULL \n " ) ; /* MAXICODE no text */
2021-07-07 06:53:31 +12:00
assert_nonnull ( symbol - > vector - > circles , " ZBarcode_Buffer_Vector() vector->circles NULL \n " ) ;
assert_nonzero ( symbol - > rows , " ZBarcode_Buffer_Vector() rows 0 \n " ) ;
assert_nonzero ( symbol - > width , " ZBarcode_Buffer_Vector() width 0 \n " ) ;
assert_null ( symbol - > bitmap , " ZBarcode_Buffer_Vector() bitmap != NULL \n " ) ;
assert_null ( symbol - > alphamap , " ZBarcode_Buffer_Vector() alphamap != NULL \n " ) ;
2021-07-08 00:58:04 +12:00
assert_zero ( symbol - > bitmap_byte_length , " ZBarcode_Buffer_Vector() bitmap_byte_length %d != 0 \n " , ( int ) symbol - > bitmap_byte_length ) ;
2021-07-07 06:53:31 +12:00
ZBarcode_Clear ( symbol ) ;
assert_null ( symbol - > vector , " ZBarcode_Buffer_Vector() vector != NULL \n " ) ;
assert_zero ( symbol - > rows , " ZBarcode_Buffer_Vector() rows %d != 0 \n " , symbol - > rows ) ;
assert_zero ( symbol - > width , " ZBarcode_Buffer_Vector() width %d != 0 \n " , symbol - > width ) ;
2021-07-08 00:58:04 +12:00
assert_zero ( symbol - > bitmap_byte_length , " ZBarcode_Buffer_Vector() bitmap_byte_length %d != 0 \n " , ( int ) symbol - > bitmap_byte_length ) ;
2021-07-07 06:53:31 +12:00
assert_null ( symbol - > bitmap , " ZBarcode_Buffer_Vector() bitmap != NULL \n " ) ;
assert_null ( symbol - > alphamap , " ZBarcode_Buffer_Vector() alphamap != NULL \n " ) ;
assert_zero ( symbol - > bitmap_width , " ZBarcode_Buffer_Vector() bitmap_width %d != 0 \n " , symbol - > bitmap_width ) ;
assert_zero ( symbol - > bitmap_height , " ZBarcode_Buffer_Vector() bitmap_height %d != 0 \n " , symbol - > bitmap_height ) ;
ZBarcode_Delete ( symbol ) ;
testFinish ( ) ;
}
- API: add new zint_symbol `dpmm` field for output resolution (BMP/
EMF/PCX/PNG/TIF only, i.e. excluding EPS, GIF & SVG)
- Add support for specifying scale by X-dimension and resolution
with new option `--scalexdimdp` for CLI/Tcl & new API function
`ZBarcode_Scale_From_XdimDp()` (+ `ZBarcode_XdimDp_From_Scale()`
& `ZBarcode_Default_Xdim()`) and new GUI popup; manual: document
- BMP/EMF/PCX/PNG/TIF: use new `dpmm` resolution field (for EMF
following Inkscape)
- backend_qt: add `dpmm()`, `vectorWidth()`, `vectorHeight()`,
`noPng()`, `getVersion()`, `takesGS1AIData()`, & `XdimDp` stuff
incl. new `QZintXdimDp` struct for passing around scale vars &
use in `getAsCLI()`; add comments
- Raise `scale` limit to 200 (from 100) to allow for large dpmm
- output: create directories & subdirectories as necessary for
output path using new function `out_fopen()` and use in BMP/EMF/
EPS/GIF/PCX/PNG/SVG/TIF
- DPLEIT/DPIDENT: format HRT according to (incomplete)
documentation, and set default height to 72X (from 50X)
- CODE128B renamed to CODE128AB as can use subsets A and/or B
- CODABAR: fix minimum height calc
- EMF: fix indexing of handles (zero-based not 1-based)
- GUI: fix symbology zap (previous technique of clearing and
re-loading settings without doing a sync no longer works);
fix UPCEAN guard descent enable
- MAILMARK: better error message if input < 14 characters
- GUI: add "Default" button for DAFT tracker ratio & enable/disable
various default buttons; use new `takesGS1AIData()` to
enable/disable GS1-specific checkboxes
- CLI: use new `validate_float()` to parse float options (7
significant digits allowed only, no scientific notation)
- DATAMATRIX/GRIDMATRIX/PDF417/QR/ULTRA: micro-optimize structapp
ID parse
- library/CLI: fiddle with static asserts (make CHAR_BIT sensitive,
supposedly)
- win32/README: update building libpng (assembly removed)
- README.linux: document incompatibility of Qt6 >= 6.3
- manual: expand Barcode Studio waffle
- test suite: change range separator to hyphen and allow multiple
excludes
2022-12-03 10:39:01 +13:00
static void test_scale_from_xdimdp ( const testCtx * const p_ctx ) {
struct item {
int symbology ;
float x_dim ;
float dpmm ;
int dpi ;
char * filetype ;
float expected ;
} ;
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
struct item data [ ] = {
/* 0*/ { BARCODE_EANX , 0.33f , 2 , 50 , " gif " , 0.5f } ,
/* 1*/ { BARCODE_EANX , 0.33f , 2 , 50 , " emf " , 0.33000001f } ,
/* 2*/ { BARCODE_EANX , 0.33f , 2 , 50 , " svg " , 0.33000001f } ,
/* 3*/ { BARCODE_EANX , 0.33f , 3 , 76 , " gif " , 0.5f } ,
/* 4*/ { BARCODE_EANX , 0.33f , 3 , 76 , " svg " , 0.495f } ,
/* 5*/ { BARCODE_EANX , 0.33f , 4 , 100 , " gif " , 0.5f } ,
/* 6*/ { BARCODE_EANX , 0.33f , 4 , 100 , " svg " , 0.66000003f } ,
/* 7*/ { BARCODE_EANX , 0.33f , 6 , 150 , " gif " , 1 } ,
/* 8*/ { BARCODE_EANX , 0.33f , 6 , 150 , " svg " , 0.99f } ,
/* 9*/ { BARCODE_EANX , 0.33f , 8 , 200 , " gif " , 1.5f } ,
/* 10*/ { BARCODE_EANX , 0.33f , 8 , 200 , " svg " , 1.32f } ,
/* 11*/ { BARCODE_EANX , 0.33f , 12 , 300 , " gif " , 2 } ,
/* 12*/ { BARCODE_EANX , 0.33f , 12 , 300 , " svg " , 1.98f } ,
/* 13*/ { BARCODE_EANX , 0.33f , 16 , 400 , " gif " , 2.5f } , /* NOTE: scale previously documented as 3.0f */
/* 14*/ { BARCODE_EANX , 0.33f , 16 , 400 , " svg " , 2.64f } ,
/* 15*/ { BARCODE_EANX , 0.33f , 24 , 600 , " gif " , 4 } ,
/* 16*/ { BARCODE_EANX , 0.33f , 24 , 600 , " svg " , 3.96f } ,
/* 17*/ { BARCODE_EANX , 0.33f , 47 , 1200 , " gif " , 8 } ,
/* 18*/ { BARCODE_EANX , 0.33f , 47 , 1200 , " emf " , 7.755f } ,
/* 19*/ { BARCODE_EANX , 0.33f , 47 , 1200 , " svg " , 7.755f } ,
/* 20*/ { BARCODE_EANX , 0.33f , 94 , 2400 , " gif " , 15.5f } , /* NOTE dpmm previously documented as 95 */
/* 21*/ { BARCODE_EANX , 0.33f , 94 , 2400 , " svg " , 15.51f } ,
/* 22*/ { BARCODE_EANX , 0.33f , 189 , 4800 , " gif " , 31 } ,
/* 23*/ { BARCODE_EANX , 0.33f , 189 , 4800 , " svg " , 31.185001f } ,
/* 24*/ { BARCODE_EANX , 0.33f , 378 , 9600 , " gif " , 62.5f } ,
/* 25*/ { BARCODE_EANX , 0.33f , 378 , 9600 , " svg " , 62.370003f } ,
/* 26*/ { BARCODE_MAXICODE , 0.88f , 4 , 100 , " gif " , 0.352f } ,
/* 27*/ { BARCODE_MAXICODE , 0.88f , 4 , 100 , " emf " , 0.1f } , /* NOTE scale rounded up to min 0.1 so doesn't round trip */
/* 28*/ { BARCODE_MAXICODE , 0.88f , 4 , 100 , " svg " , 1.76f } ,
/* 29*/ { BARCODE_MAXICODE , 0.88f , 6 , 150 , " gif " , 0.528f } , /* NOTE scale previously documented as 0.5f */
/* 30*/ { BARCODE_MAXICODE , 0.88f , 6 , 150 , " emf " , 0.132f } ,
/* 31*/ { BARCODE_MAXICODE , 0.88f , 6 , 150 , " svg " , 2.6399999 } ,
/* 32*/ { BARCODE_MAXICODE , 0.88f , 8 , 200 , " gif " , 0.704f } , /* NOTE scale previously documented as 0.7f */
/* 33*/ { BARCODE_MAXICODE , 0.88f , 8 , 200 , " emf " , 0.176f } ,
/* 34*/ { BARCODE_MAXICODE , 0.88f , 8 , 200 , " svg " , 3.52f } ,
/* 35*/ { BARCODE_MAXICODE , 0.88f , 12 , 300 , " gif " , 1.056f } , /* NOTE scale previously documented as 1.0f */
/* 36*/ { BARCODE_MAXICODE , 0.88f , 12 , 300 , " emf " , 0.264f } ,
/* 37*/ { BARCODE_MAXICODE , 0.88f , 12 , 300 , " svg " , 5.2799997f } ,
/* 38*/ { BARCODE_MAXICODE , 0.88f , 16 , 400 , " gif " , 1.408f } , /* NOTE scale previously documented as 1.4f */
/* 39*/ { BARCODE_MAXICODE , 0.88f , 16 , 400 , " emf " , 0.352f } ,
/* 40*/ { BARCODE_MAXICODE , 0.88f , 16 , 400 , " gif " , 1.408f } ,
/* 41*/ { BARCODE_MAXICODE , 0.88f , 24 , 600 , " gif " , 2.112f } , /* NOTE scale previously documented as 2.1f */
/* 42*/ { BARCODE_MAXICODE , 0.88f , 24 , 600 , " emf " , 0.528f } ,
/* 43*/ { BARCODE_MAXICODE , 0.88f , 24 , 600 , " svg " , 10.559999f } ,
/* 44*/ { BARCODE_MAXICODE , 0.88f , 47 , 1200 , " gif " , 4.136f } , /* NOTE scale previously documented as 4.1f */
/* 45*/ { BARCODE_MAXICODE , 0.88f , 47 , 1200 , " emf " , 1.034f } ,
/* 46*/ { BARCODE_MAXICODE , 0.88f , 47 , 1200 , " svg " , 20.68f } ,
/* 47*/ { BARCODE_MAXICODE , 0.88f , 94 , 2400 , " gif " , 8.272f } , /* NOTE dpmm previously documented as 95, scale as 8.2f */
/* 48*/ { BARCODE_MAXICODE , 0.88f , 94 , 2400 , " emf " , 2.0680001f } ,
/* 49*/ { BARCODE_MAXICODE , 0.88f , 94 , 2400 , " svg " , 41.360001f } ,
/* 50*/ { BARCODE_MAXICODE , 0.88f , 189 , 4800 , " gif " , 16.632f } , /* NOTE scale previously documented as 16.4f */
/* 51*/ { BARCODE_MAXICODE , 0.88f , 189 , 4800 , " emf " , 4.158f } ,
/* 52*/ { BARCODE_MAXICODE , 0.88f , 189 , 4800 , " svg " , 83.159996f } ,
/* 53*/ { BARCODE_MAXICODE , 0.88f , 378 , 9600 , " gif " , 33.264f } ,
/* 54*/ { BARCODE_MAXICODE , 0.88f , 378 , 9600 , " emf " , 8.316f } ,
/* 55*/ { BARCODE_MAXICODE , 0.88f , 378 , 9600 , " svg " , 166.31999f } ,
/* 56*/ { BARCODE_PDF417 , 0.27f , 2 , 50 , " gif " , 0.5f } ,
/* 57*/ { BARCODE_PDF417 , 0.27f , 2 , 50 , " svg " , 0.27000001f } ,
/* 58*/ { BARCODE_PDF417 , 0.27f , 6 , 150 , " gif " , 1 } ,
/* 59*/ { BARCODE_PDF417 , 0.27f , 6 , 150 , " svg " , 0.81000006f } ,
/* 60*/ { BARCODE_PDF417 , 0.27f , 12 , 300 , " gif " , 1.5 } ,
/* 61*/ { BARCODE_PDF417 , 0.27f , 12 , 300 , " svg " , 1.6200001f } ,
/* 62*/ { BARCODE_PDF417 , 0.27f , 24 , 600 , " gif " , 3 } ,
/* 63*/ { BARCODE_PDF417 , 0.27f , 24 , 600 , " emf " , 3.2400002f } ,
/* 64*/ { BARCODE_PDF417 , 0.27f , 24 , 600 , " svg " , 3.2400002f } ,
/* 65*/ { BARCODE_PHARMA_TWO , 1 , 2 , 50 , " gif " , 1 } ,
/* 66*/ { BARCODE_PHARMA_TWO , 1 , 2 , 50 , " svg " , 1 } ,
/* 67*/ { BARCODE_PHARMA_TWO , 1 , 6 , 150 , " gif " , 3 } ,
/* 68*/ { BARCODE_PHARMA_TWO , 1 , 6 , 150 , " svg " , 3 } ,
/* 69*/ { BARCODE_PHARMA_TWO , 1 , 8 , 200 , " gif " , 4 } ,
/* 70*/ { BARCODE_PHARMA_TWO , 1 , 8 , 200 , " svg " , 4 } ,
/* 71*/ { BARCODE_PHARMA_TWO , 1 , 189 , 4800 , " gif " , 94.5f } ,
/* 72*/ { BARCODE_PHARMA_TWO , 1 , 189 , 4800 , " svg " , 94.5f } ,
/* 73*/ { BARCODE_PHARMA_TWO , 1 , 378 , 9600 , " gif " , 189 } ,
/* 74*/ { BARCODE_PHARMA_TWO , 1 , 378 , 9600 , " svg " , 189 } ,
/* 75*/ { BARCODE_PHARMA_TWO , 1 , 401 , 10200 , " gif " , 200 } , /* NOTE scale capped to 200 so doesn't round trip */
/* 76*/ { BARCODE_PHARMA_TWO , 1 , 401 , 10200 , " svg " , 200 } ,
/* 77*/ { BARCODE_CODE128 , 0.5 , 12 , 300 , " gif " , 3 } ,
/* 78*/ { BARCODE_CODE128 , 0 , 12 , - 1 , " gif " , 0 } , /* x_dim zero */
/* 79*/ { BARCODE_CODE128 , 200.1f , 12 , - 1 , " gif " , 0 } , /* x_dim > 200 */
/* 80*/ { BARCODE_CODE128 , 0.5f , - 0.1f , - 1 , " gif " , 0 } , /* dpmm neg */
/* 81*/ { BARCODE_CODE128 , 0.5f , 1000.1 , - 1 , " gif " , 0 } , /* dpmm > 1000 */
/* 82*/ { BARCODE_CODE128 , 0.5f , 300 , - 1 , " abcd " , 0 } , /* filetype unknown */
/* 83*/ { BARCODE_QRCODE , 10 , 31 , 800 , " gif " , 155 } ,
} ;
int data_size = ARRAY_SIZE ( data ) ;
int i ;
float ret ;
float x_dim_from_scale ;
float dpmm_from_dpi ;
testStart ( " test_scale_from_xdimdp " ) ;
for ( i = 0 ; i < data_size ; i + + ) {
if ( testContinue ( p_ctx , i ) ) continue ;
ret = ZBarcode_Scale_From_XdimDp ( data [ i ] . symbology , data [ i ] . x_dim , data [ i ] . dpmm , data [ i ] . filetype ) ;
assert_equal ( ret , data [ i ] . expected , " i:%d ZBarcode_Scale_From_XdimDp(%s, %g, %g, %s) %.8g != %.8g \n " ,
i , testUtilBarcodeName ( data [ i ] . symbology ) , data [ i ] . dpmm , data [ i ] . x_dim , data [ i ] . filetype , ret , data [ i ] . expected ) ;
if ( ret ) {
2022-12-03 11:42:04 +13:00
dpmm_from_dpi = stripf ( roundf ( data [ i ] . dpi / 25.4f ) ) ;
- API: add new zint_symbol `dpmm` field for output resolution (BMP/
EMF/PCX/PNG/TIF only, i.e. excluding EPS, GIF & SVG)
- Add support for specifying scale by X-dimension and resolution
with new option `--scalexdimdp` for CLI/Tcl & new API function
`ZBarcode_Scale_From_XdimDp()` (+ `ZBarcode_XdimDp_From_Scale()`
& `ZBarcode_Default_Xdim()`) and new GUI popup; manual: document
- BMP/EMF/PCX/PNG/TIF: use new `dpmm` resolution field (for EMF
following Inkscape)
- backend_qt: add `dpmm()`, `vectorWidth()`, `vectorHeight()`,
`noPng()`, `getVersion()`, `takesGS1AIData()`, & `XdimDp` stuff
incl. new `QZintXdimDp` struct for passing around scale vars &
use in `getAsCLI()`; add comments
- Raise `scale` limit to 200 (from 100) to allow for large dpmm
- output: create directories & subdirectories as necessary for
output path using new function `out_fopen()` and use in BMP/EMF/
EPS/GIF/PCX/PNG/SVG/TIF
- DPLEIT/DPIDENT: format HRT according to (incomplete)
documentation, and set default height to 72X (from 50X)
- CODE128B renamed to CODE128AB as can use subsets A and/or B
- CODABAR: fix minimum height calc
- EMF: fix indexing of handles (zero-based not 1-based)
- GUI: fix symbology zap (previous technique of clearing and
re-loading settings without doing a sync no longer works);
fix UPCEAN guard descent enable
- MAILMARK: better error message if input < 14 characters
- GUI: add "Default" button for DAFT tracker ratio & enable/disable
various default buttons; use new `takesGS1AIData()` to
enable/disable GS1-specific checkboxes
- CLI: use new `validate_float()` to parse float options (7
significant digits allowed only, no scientific notation)
- DATAMATRIX/GRIDMATRIX/PDF417/QR/ULTRA: micro-optimize structapp
ID parse
- library/CLI: fiddle with static asserts (make CHAR_BIT sensitive,
supposedly)
- win32/README: update building libpng (assembly removed)
- README.linux: document incompatibility of Qt6 >= 6.3
- manual: expand Barcode Studio waffle
- test suite: change range separator to hyphen and allow multiple
excludes
2022-12-03 10:39:01 +13:00
ret = ZBarcode_Scale_From_XdimDp ( data [ i ] . symbology , data [ i ] . x_dim , dpmm_from_dpi , data [ i ] . filetype ) ;
assert_equal ( ret , data [ i ] . expected , " i:%d ZBarcode_Scale_From_XdimDp(%s, %g (dpi %d), %g, %s) %.8g != %.8g \n " ,
i , testUtilBarcodeName ( data [ i ] . symbology ) , dpmm_from_dpi , data [ i ] . dpi , data [ i ] . x_dim , data [ i ] . filetype , ret , data [ i ] . expected ) ;
if ( data [ i ] . expected > 0.1f & & data [ i ] . expected < 200.0f /* Can't round trip scales <= 0.1 or >= 200.0f */
& & ( data [ i ] . symbology = = BARCODE_MAXICODE | | strcmp ( data [ i ] . filetype , " gif " ) ! = 0 ) ) { /* Non-MAXICODE raster rounds to half-increments */
x_dim_from_scale = ZBarcode_XdimDp_From_Scale ( data [ i ] . symbology , ret , data [ i ] . dpmm , data [ i ] . filetype ) ;
2022-12-03 11:42:04 +13:00
x_dim_from_scale = stripf ( stripf ( roundf ( x_dim_from_scale * 100.0f ) ) / 100.0f ) ;
- API: add new zint_symbol `dpmm` field for output resolution (BMP/
EMF/PCX/PNG/TIF only, i.e. excluding EPS, GIF & SVG)
- Add support for specifying scale by X-dimension and resolution
with new option `--scalexdimdp` for CLI/Tcl & new API function
`ZBarcode_Scale_From_XdimDp()` (+ `ZBarcode_XdimDp_From_Scale()`
& `ZBarcode_Default_Xdim()`) and new GUI popup; manual: document
- BMP/EMF/PCX/PNG/TIF: use new `dpmm` resolution field (for EMF
following Inkscape)
- backend_qt: add `dpmm()`, `vectorWidth()`, `vectorHeight()`,
`noPng()`, `getVersion()`, `takesGS1AIData()`, & `XdimDp` stuff
incl. new `QZintXdimDp` struct for passing around scale vars &
use in `getAsCLI()`; add comments
- Raise `scale` limit to 200 (from 100) to allow for large dpmm
- output: create directories & subdirectories as necessary for
output path using new function `out_fopen()` and use in BMP/EMF/
EPS/GIF/PCX/PNG/SVG/TIF
- DPLEIT/DPIDENT: format HRT according to (incomplete)
documentation, and set default height to 72X (from 50X)
- CODE128B renamed to CODE128AB as can use subsets A and/or B
- CODABAR: fix minimum height calc
- EMF: fix indexing of handles (zero-based not 1-based)
- GUI: fix symbology zap (previous technique of clearing and
re-loading settings without doing a sync no longer works);
fix UPCEAN guard descent enable
- MAILMARK: better error message if input < 14 characters
- GUI: add "Default" button for DAFT tracker ratio & enable/disable
various default buttons; use new `takesGS1AIData()` to
enable/disable GS1-specific checkboxes
- CLI: use new `validate_float()` to parse float options (7
significant digits allowed only, no scientific notation)
- DATAMATRIX/GRIDMATRIX/PDF417/QR/ULTRA: micro-optimize structapp
ID parse
- library/CLI: fiddle with static asserts (make CHAR_BIT sensitive,
supposedly)
- win32/README: update building libpng (assembly removed)
- README.linux: document incompatibility of Qt6 >= 6.3
- manual: expand Barcode Studio waffle
- test suite: change range separator to hyphen and allow multiple
excludes
2022-12-03 10:39:01 +13:00
assert_equal ( x_dim_from_scale , data [ i ] . x_dim , " i:%d ZBarcode_XdimDp_From_Scale(%s, %g, %g, %s) %.8g != x_dim %.8g \n " ,
i , testUtilBarcodeName ( data [ i ] . symbology ) , ret , data [ i ] . x_dim , data [ i ] . filetype , x_dim_from_scale , data [ i ] . x_dim ) ;
}
}
}
testFinish ( ) ;
}
static void test_xdimdp_from_scale ( const testCtx * const p_ctx ) {
struct item {
int symbology ;
float scale ;
float dpmm ; /* Note testing "normal" case that want X-dim, not dpmm */
int dpi ;
char * filetype ;
float expected ;
} ;
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
struct item data [ ] = {
/* 0*/ { BARCODE_EANX , 1 , 6 , 150 , " gif " , 0.33333334f } ,
/* 1*/ { BARCODE_EANX , 1.32f , 8 , 200 , " gif " , 0.33000001f } ,
/* 2*/ { BARCODE_EANX , 1.5f , 8 , 200 , " gif " , 0.375f } ,
/* 3*/ { BARCODE_EANX , 1.98f , 12 , 300 , " gif " , 0.33f } ,
/* 4*/ { BARCODE_EANX , 2 , 12 , 300 , " gif " , 0.33333334f } ,
/* 5*/ { BARCODE_EANX , 2 , 12 , 300 , " svg " , 0.33333334f } ,
/* 6*/ { BARCODE_EANX , 2.64f , 16 , 400 , " gif " , 0.33f } ,
/* 7*/ { BARCODE_EANX , 2.5f , 16 , 400 , " gif " , 0.3125f } ,
/* 8*/ { BARCODE_EANX , 3.96f , 24 , 600 , " gif " , 0.33f } ,
/* 9*/ { BARCODE_EANX , 3.96f , 24 , 600 , " svg " , 0.33f } ,
/* 10*/ { BARCODE_EANX , 4 , 24 , 600 , " gif " , 0.33333334f } ,
/* 11*/ { BARCODE_EANX , 7.755f , 47 , 1200 , " gif " , 0.33f } ,
/* 12*/ { BARCODE_EANX , 8 , 47 , 1200 , " gif " , 0.34042552f } ,
/* 13*/ { BARCODE_EANX , 15.51f , 94 , 2400 , " gif " , 0.33f } ,
/* 14*/ { BARCODE_EANX , 15.5f , 94 , 2400 , " gif " , 0.32978722f } ,
/* 15*/ { BARCODE_EANX , 31.185001f , 189 , 4800 , " gif " , 0.33f } ,
/* 16*/ { BARCODE_EANX , 31 , 189 , 4800 , " gif " , 0.32804233f } ,
/* 17*/ { BARCODE_MAXICODE , 1 , 12 , 300 , " gif " , 0.83333331f } ,
/* 18*/ { BARCODE_MAXICODE , 0.264f , 12 , 300 , " emf " , 0.87999994f } ,
/* 19*/ { BARCODE_MAXICODE , 5.2799997f , 12 , 300 , " svg " , 0.87999994f } ,
/* 20*/ { BARCODE_MAXICODE , 2 , 24 , 600 , " gif " , 0.83333331f } ,
/* 21*/ { BARCODE_MAXICODE , 0.528f , 24 , 600 , " emf " , 0.87999994f } ,
/* 22*/ { BARCODE_MAXICODE , 10.559999f , 24 , 600 , " svg " , 0.87999994f } ,
/* 23*/ { BARCODE_CODE128 , 0 , 12 , - 1 , " gif " , 0 } , /* scale zero */
/* 24*/ { BARCODE_CODE128 , 200.01f , 12 , - 1 , " gif " , 0 } , /* scale > 200 */
/* 25*/ { BARCODE_CODE128 , 0.5f , 0 , - 1 , " gif " , 0 } , /* xdim_mm_or_dpmm zero */
/* 26*/ { BARCODE_CODE128 , 0.5f , 1000.1f , - 1 , " gif " , 0 } , /* xdim_mm_or_dpmm > 1000 */
} ;
int data_size = ARRAY_SIZE ( data ) ;
int i ;
float ret ;
float dpmm_from_dpi ;
testStart ( " test_xdimdp_from_scale " ) ;
for ( i = 0 ; i < data_size ; i + + ) {
if ( testContinue ( p_ctx , i ) ) continue ;
ret = ZBarcode_XdimDp_From_Scale ( data [ i ] . symbology , data [ i ] . scale , data [ i ] . dpmm , data [ i ] . filetype ) ;
assert_equal ( ret , data [ i ] . expected , " i:%d ZBarcode_XdimDp_From_Scale(%s, %g, %g, %s) %.8g != %.8g \n " ,
i , testUtilBarcodeName ( data [ i ] . symbology ) , data [ i ] . dpmm , data [ i ] . scale , data [ i ] . filetype , ret , data [ i ] . expected ) ;
if ( ret ) {
2022-12-03 11:42:04 +13:00
dpmm_from_dpi = stripf ( roundf ( data [ i ] . dpi / 25.4f ) ) ;
- API: add new zint_symbol `dpmm` field for output resolution (BMP/
EMF/PCX/PNG/TIF only, i.e. excluding EPS, GIF & SVG)
- Add support for specifying scale by X-dimension and resolution
with new option `--scalexdimdp` for CLI/Tcl & new API function
`ZBarcode_Scale_From_XdimDp()` (+ `ZBarcode_XdimDp_From_Scale()`
& `ZBarcode_Default_Xdim()`) and new GUI popup; manual: document
- BMP/EMF/PCX/PNG/TIF: use new `dpmm` resolution field (for EMF
following Inkscape)
- backend_qt: add `dpmm()`, `vectorWidth()`, `vectorHeight()`,
`noPng()`, `getVersion()`, `takesGS1AIData()`, & `XdimDp` stuff
incl. new `QZintXdimDp` struct for passing around scale vars &
use in `getAsCLI()`; add comments
- Raise `scale` limit to 200 (from 100) to allow for large dpmm
- output: create directories & subdirectories as necessary for
output path using new function `out_fopen()` and use in BMP/EMF/
EPS/GIF/PCX/PNG/SVG/TIF
- DPLEIT/DPIDENT: format HRT according to (incomplete)
documentation, and set default height to 72X (from 50X)
- CODE128B renamed to CODE128AB as can use subsets A and/or B
- CODABAR: fix minimum height calc
- EMF: fix indexing of handles (zero-based not 1-based)
- GUI: fix symbology zap (previous technique of clearing and
re-loading settings without doing a sync no longer works);
fix UPCEAN guard descent enable
- MAILMARK: better error message if input < 14 characters
- GUI: add "Default" button for DAFT tracker ratio & enable/disable
various default buttons; use new `takesGS1AIData()` to
enable/disable GS1-specific checkboxes
- CLI: use new `validate_float()` to parse float options (7
significant digits allowed only, no scientific notation)
- DATAMATRIX/GRIDMATRIX/PDF417/QR/ULTRA: micro-optimize structapp
ID parse
- library/CLI: fiddle with static asserts (make CHAR_BIT sensitive,
supposedly)
- win32/README: update building libpng (assembly removed)
- README.linux: document incompatibility of Qt6 >= 6.3
- manual: expand Barcode Studio waffle
- test suite: change range separator to hyphen and allow multiple
excludes
2022-12-03 10:39:01 +13:00
ret = ZBarcode_XdimDp_From_Scale ( data [ i ] . symbology , data [ i ] . scale , dpmm_from_dpi , data [ i ] . filetype ) ;
assert_equal ( ret , data [ i ] . expected , " i:%d ZBarcode_XdimDp_From_Scale(%s, %g (dpi %d), %g, %s) %.8g != %.8g \n " ,
i , testUtilBarcodeName ( data [ i ] . symbology ) , dpmm_from_dpi , data [ i ] . dpi , data [ i ] . scale , data [ i ] . filetype , ret , data [ i ] . expected ) ;
}
}
testFinish ( ) ;
}
2020-05-06 09:28:25 +12:00
int main ( int argc , char * argv [ ] ) {
2022-09-13 06:26:04 +12:00
testFunction funcs [ ] = { /* name, func */
{ " test_checks " , test_checks } ,
{ " test_checks_segs " , test_checks_segs } ,
{ " test_input_data " , test_input_data } ,
{ " test_symbologies " , test_symbologies } ,
{ " test_input_mode " , test_input_mode } ,
{ " test_escape_char_process " , test_escape_char_process } ,
{ " test_cap " , test_cap } ,
{ " test_cap_compliant_height " , test_cap_compliant_height } ,
{ " test_encode_file_empty " , test_encode_file_empty } ,
{ " test_encode_file_too_large " , test_encode_file_too_large } ,
{ " test_encode_file_unreadable " , test_encode_file_unreadable } ,
{ " test_encode_file_directory " , test_encode_file_directory } ,
{ " test_encode_file " , test_encode_file } ,
{ " test_encode_print_outfile_directory " , test_encode_print_outfile_directory } ,
{ " test_bad_args " , test_bad_args } ,
{ " test_valid_id " , test_valid_id } ,
{ " test_error_tag " , test_error_tag } ,
{ " test_strip_bom " , test_strip_bom } ,
{ " test_zero_outfile " , test_zero_outfile } ,
{ " test_clear " , test_clear } ,
- API: add new zint_symbol `dpmm` field for output resolution (BMP/
EMF/PCX/PNG/TIF only, i.e. excluding EPS, GIF & SVG)
- Add support for specifying scale by X-dimension and resolution
with new option `--scalexdimdp` for CLI/Tcl & new API function
`ZBarcode_Scale_From_XdimDp()` (+ `ZBarcode_XdimDp_From_Scale()`
& `ZBarcode_Default_Xdim()`) and new GUI popup; manual: document
- BMP/EMF/PCX/PNG/TIF: use new `dpmm` resolution field (for EMF
following Inkscape)
- backend_qt: add `dpmm()`, `vectorWidth()`, `vectorHeight()`,
`noPng()`, `getVersion()`, `takesGS1AIData()`, & `XdimDp` stuff
incl. new `QZintXdimDp` struct for passing around scale vars &
use in `getAsCLI()`; add comments
- Raise `scale` limit to 200 (from 100) to allow for large dpmm
- output: create directories & subdirectories as necessary for
output path using new function `out_fopen()` and use in BMP/EMF/
EPS/GIF/PCX/PNG/SVG/TIF
- DPLEIT/DPIDENT: format HRT according to (incomplete)
documentation, and set default height to 72X (from 50X)
- CODE128B renamed to CODE128AB as can use subsets A and/or B
- CODABAR: fix minimum height calc
- EMF: fix indexing of handles (zero-based not 1-based)
- GUI: fix symbology zap (previous technique of clearing and
re-loading settings without doing a sync no longer works);
fix UPCEAN guard descent enable
- MAILMARK: better error message if input < 14 characters
- GUI: add "Default" button for DAFT tracker ratio & enable/disable
various default buttons; use new `takesGS1AIData()` to
enable/disable GS1-specific checkboxes
- CLI: use new `validate_float()` to parse float options (7
significant digits allowed only, no scientific notation)
- DATAMATRIX/GRIDMATRIX/PDF417/QR/ULTRA: micro-optimize structapp
ID parse
- library/CLI: fiddle with static asserts (make CHAR_BIT sensitive,
supposedly)
- win32/README: update building libpng (assembly removed)
- README.linux: document incompatibility of Qt6 >= 6.3
- manual: expand Barcode Studio waffle
- test suite: change range separator to hyphen and allow multiple
excludes
2022-12-03 10:39:01 +13:00
{ " test_scale_from_xdimdp " , test_scale_from_xdimdp } ,
{ " test_xdimdp_from_scale " , test_xdimdp_from_scale } ,
2020-05-06 09:28:25 +12:00
} ;
testRun ( argc , argv , funcs , ARRAY_SIZE ( funcs ) ) ;
2019-10-17 22:06:21 +13:00
testReport ( ) ;
return 0 ;
}
Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-10 06:50:50 +12:00
/* vim: set ts=4 sw=4 et : */