1
0
mirror of https://git.code.sf.net/p/zint/code synced 2026-07-31 10:29:52 +00:00

CLI: make --mirror available in standard non-batch mode via

new routines `mirror_start()`, `mirror_outfile()` & limit
  substitutions on Unix to backslash (Windows remains the same);
  restrict "borderwidth", "textgap", "vwhitesp", "whitesp" < 100
CODEONE: fix `ceilf()` -> `C1_MULT_CEIL()` in FAST_MODE encodation
  (improves/changes some encodation)
composite: preserve `gs1_verify()` warning using `warn_level` hack;
  fix wrong name `zint_dbar_omnstk_set_height()` ->
  `zint_dbar_stk_set_height()`;
  use new `zint_micropdf_variant()` & `zint_micropdf_expand()`
  routines (see below)
MICROPDF417: move variant determination into new shareable routine
  `zint_micropdf_variant()` & expansion into `zint_micropdf_expand()`
qzint: add helper methods `setbordertypevalue()`,
  `encodedinputmode()`, `encodedoutputoptions()`,
  `ecivaluetoeciindex()` and `eciindextoecivalue()`
dbar: for performance pre-calculate `combins()` as array
coverage: add `malloc()`-type failure testing to AZTEC,
  CONTENT_SEGS, MEMORY_FILE, raster, Reed-Solomon & vector;
  numerous changes to remove unused code and test more branches
common: add `isxdigit()`
general: various code fiddlings
manual: add char names to sequence and batch format char tables;
  mention long options can be shortened (& use "--compliantheight"
  -> "--compliant");
  expand mirror explanation & document substitutions in footnote;
  workaround xecjk putting space after double quote when quoting
  cjk chars & rejig input mode examples;
  workaround html alignment bug in table gs1-enabled symbologies by
  adding extra rh dashes to header cols;
  add "figure nn: " to txt image tags via sed:
  various other small fixes and rephrasings
This commit is contained in:
gitlost
2026-06-23 23:25:23 +01:00
parent 4a60a0b068
commit a81c9d9258
91 changed files with 6879 additions and 4368 deletions
+63 -3
View File
@@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2020-2025 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2020-2026 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -101,7 +101,7 @@ static void test_pixel_plot(const testCtx *const p_ctx) {
symbol->bitmap = (unsigned char *) data_buf;
ret = zint_bmp_pixel_plot(symbol, TCU(data_buf));
ret = zint_bmp_pixel_plot(symbol, ZCUCP(data_buf));
assert_equal(ret, data[i].ret, "i:%d zint_bmp_pixel_plot ret %d != %d (%s)\n",
i, ret, data[i].ret, symbol->errtxt);
@@ -201,7 +201,7 @@ static void test_print(const testCtx *const p_ctx) {
strcpy(symbol->bgcolour, data[i].bgcolour);
}
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
ret = ZBarcode_Encode(symbol, ZCUCP(data[i].data), length);
assert_zero(ret, "i:%d %s ZBarcode_Encode ret %d != 0 %s\n",
i, testUtilBarcodeName(data[i].symbology), ret, symbol->errtxt);
@@ -307,12 +307,72 @@ static void test_outfile(const testCtx *const p_ctx) {
testFinish();
}
#include "filemem.h"
static void test_fm(const testCtx *const p_ctx) {
int debug = p_ctx->debug;
struct item {
int symbology;
int output_options;
const char *data;
int ret;
int ats[5];
int at_cnt;
int id;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
/* 0*/ { BARCODE_DATAMATRIX, -1, "123", ZINT_ERROR_FILE_ACCESS, { 1, 0, 0, 0, 0 }, 1, FM_FAIL_ID_OPEN },
/* 1*/ { BARCODE_DATAMATRIX, -1, "123", ZINT_ERROR_FILE_WRITE, { 5, 11, 0, 0, 0 }, 2, FM_FAIL_ID_WRITE },
/* 2*/ { BARCODE_DATAMATRIX, -1, "123", ZINT_ERROR_FILE_WRITE, { 1, 0, 0, 0, 0 }, 1, FM_FAIL_ID_CLOSE },
/* 3*/ { BARCODE_DATAMATRIX, BARCODE_STDOUT, "123", ZINT_ERROR_FILE_WRITE, { 1, 0, 0, 0, 0 }, 1, FM_FAIL_ID_CLOSE },
};
const int data_size = ARRAY_SIZE(data);
int i, length, ret;
struct zint_symbol *symbol = NULL;
testStartSymbol(p_ctx->func_name, &symbol);
for (i = 0; i < data_size; i++) {
int j;
if (testContinue(p_ctx, i)) continue;
symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");
for (j = 0; j < data[i].at_cnt; j++) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/,
-1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, data[i].output_options,
data[i].data, -1, debug);
strcpy(symbol->outfile, "out.bmp");
ret = ZBarcode_Encode(symbol, ZCUCP(data[i].data), length);
assert_zero(ret, "i:%d %s ZBarcode_Encode ret %d != 0 %s\n",
i, testUtilBarcodeName(data[i].symbology), ret, symbol->errtxt);
zint_test_fm_set_fail(data[i].id, data[i].ats[j]);
ret = ZBarcode_Print(symbol, 0 /*rotate_angle*/);
assert_equal(ret, data[i].ret, "i:%d j:%d ZBarcode_Print (%d,%d) ret %d != %d (%s)\n",
i, j, data[i].id, data[i].ats[j], ret, data[i].ret, symbol->errtxt);
ZBarcode_Reset(symbol);
}
zint_test_fm_set_fail(0, 0);
ZBarcode_Delete(symbol);
}
testFinish();
}
int main(int argc, char *argv[]) {
testFunction funcs[] = { /* name, func */
{ "test_pixel_plot", test_pixel_plot },
{ "test_print", test_print },
{ "test_outfile", test_outfile },
{ "test_fm", test_fm },
};
testRun(argc, argv, funcs, ARRAY_SIZE(funcs));