mirror of
https://git.code.sf.net/p/zint/code
synced 2025-05-27 13:34:19 -04: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
This commit is contained in:
parent
6393813cff
commit
c8033695d9
127 changed files with 4032 additions and 1248 deletions
|
@ -30,6 +30,11 @@
|
|||
/* SPDX-License-Identifier: BSD-3-Clause */
|
||||
|
||||
#include "testcommon.h"
|
||||
#include "../output.h"
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include <direct.h>
|
||||
#endif
|
||||
|
||||
INTERNAL int out_quiet_zones_test(const struct zint_symbol *symbol, const int hide_text,
|
||||
float *left, float *right, float *top, float *bottom);
|
||||
|
@ -57,10 +62,107 @@ static void test_quiet_zones(const testCtx *const p_ctx) {
|
|||
testFinish();
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#define TEST_OUT_SEP '\\'
|
||||
#define TEST_OUT_SEP_STR "\\"
|
||||
#else
|
||||
#define TEST_OUT_SEP '/'
|
||||
#define TEST_OUT_SEP_STR "/"
|
||||
#endif
|
||||
|
||||
static void test_fopen(const testCtx *const p_ctx) {
|
||||
struct item {
|
||||
char dir[32];
|
||||
char subdir[32];
|
||||
char *filename;
|
||||
int succeed;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
struct item data[] = {
|
||||
/* 0*/ { "", "", "out.png", 1 },
|
||||
/* 1*/ { "out_test", "", "out.png", 1 },
|
||||
/* 2*/ { "out_test_with_subdir", "out_test_subdir", "out.png", 1 },
|
||||
/* 3*/ { "out_test_with_subdir", "out_test_subdir", "out.bmp", 1 },
|
||||
/* 4*/ { "out_test_with_subdir", "out_test_subdir", "out.emf", 1 },
|
||||
/* 5*/ { "out_test_with_subdir", "out_test_subdir", "out.eps", 1 },
|
||||
/* 6*/ { "out_test_with_subdir", "out_test_subdir", "out.gif", 1 },
|
||||
/* 7*/ { "out_test_with_subdir", "out_test_subdir", "out.pcx", 1 },
|
||||
/* 8*/ { "out_test_with_subdir", "out_test_subdir", "out.svg", 1 },
|
||||
/* 9*/ { "out_test_with_subdir", "out_test_subdir", "out.tif", 1 },
|
||||
/* 10*/ { "out_test/", "", "out.png", 1 },
|
||||
/* 11*/ { "out_test//", "", "out.png", 1 },
|
||||
/* 12*/ { "out_test/", "/out_test_subdir/", "out.png", 1 },
|
||||
/* 13*/ { "out_test\\", "\\out_test_subdir\\", "out.png", 1 },
|
||||
};
|
||||
int data_size = ARRAY_SIZE(data);
|
||||
int i, len;
|
||||
|
||||
FILE *ret;
|
||||
char cwdbuf[1024];
|
||||
char outfile[1024 + 256];
|
||||
char dirname[1024 + 256];
|
||||
char subdirname[1024 + 256];
|
||||
int dir_exists, subdir_exists;
|
||||
|
||||
testStart("test_fopen");
|
||||
|
||||
assert_nonnull(getcwd(cwdbuf, sizeof(cwdbuf)), "getcwd NULL (%d, %s)\n", errno, strerror(errno));
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
if (testContinue(p_ctx, i)) continue;
|
||||
|
||||
strcpy(outfile, cwdbuf);
|
||||
len = strlen(outfile);
|
||||
if (len && outfile[len - 1] != TEST_OUT_SEP) { outfile[len++] = TEST_OUT_SEP; outfile[len] = '\0'; }
|
||||
dir_exists = subdir_exists = 0;
|
||||
|
||||
if (data[i].dir[0]) {
|
||||
strcat(outfile, data[i].dir);
|
||||
strcat(outfile, TEST_OUT_SEP_STR);
|
||||
strcpy(dirname, outfile);
|
||||
dir_exists = testUtilDirExists(dirname);
|
||||
if (data[i].subdir[0]) {
|
||||
strcat(outfile, data[i].subdir);
|
||||
strcat(outfile, TEST_OUT_SEP_STR);
|
||||
strcpy(subdirname, outfile);
|
||||
subdir_exists = testUtilDirExists(subdirname);
|
||||
}
|
||||
}
|
||||
strcat(outfile, data[i].filename);
|
||||
|
||||
ret = out_fopen(outfile, "w");
|
||||
if (data[i].succeed) {
|
||||
assert_nonnull(ret, "i:%d out_fopen(%s) == NULL (%d: %s)\n", i, outfile, errno, strerror(errno));
|
||||
assert_zero(fclose(ret), "i:%d fclose(%s) != 0 (%d: %s)\n", i, outfile, errno, strerror(errno));
|
||||
assert_nonzero(testUtilExists(outfile), "i:%d testUtilExists(%s) != 0 (%d: %s)\n", i, outfile, errno, strerror(errno));
|
||||
if (data[i].dir[0]) {
|
||||
assert_nonzero(testUtilDirExists(dirname), "i:%d testUtilDirExists(%s) != 0 (%d: %s)\n", i, dirname, errno, strerror(errno));
|
||||
}
|
||||
assert_zero(remove(outfile), "i:%d remove(%s) != 0 (%d: %s)\n", i, outfile, errno, strerror(errno));
|
||||
if (data[i].dir[0]) {
|
||||
if (data[i].subdir[0] && !subdir_exists) {
|
||||
assert_zero(testUtilRmDir(subdirname), "i:%d rmdir(%s) != 0 (%d: %s)\n", i, subdirname, errno, strerror(errno));
|
||||
}
|
||||
if (!dir_exists && strcmp(dirname, "/") != 0 && strcmp(dirname, "\\") != 0) {
|
||||
assert_zero(testUtilRmDir(dirname), "i:%d rmdir(%s) != 0 (%d: %s)\n", i, dirname, errno, strerror(errno));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
assert_null(ret, "i:%d out_fopen(%s) == NULL (%d: %s)\n", i, outfile, errno, strerror(errno));
|
||||
/* TODO: may have left junk around */
|
||||
}
|
||||
}
|
||||
|
||||
testFinish();
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
testFunction funcs[] = { /* name, func */
|
||||
{ "test_quiet_zones", test_quiet_zones },
|
||||
{ "test_fopen", test_fopen },
|
||||
};
|
||||
|
||||
testRun(argc, argv, funcs, ARRAY_SIZE(funcs));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue