mirror of
https://git.code.sf.net/p/zint/code
synced 2025-05-23 19:46:56 -04:00
tests: VC6 compatible; plot_raster_dotty: avoid float rounding difference
This commit is contained in:
parent
e5115bad07
commit
70801d8932
97 changed files with 3354 additions and 1893 deletions
|
@ -34,16 +34,6 @@
|
|||
|
||||
static void test_print(int index, int generate, int debug) {
|
||||
|
||||
testStart("");
|
||||
|
||||
int have_libreoffice = 0;
|
||||
int have_vnu = 0;
|
||||
if (generate) {
|
||||
have_libreoffice = testUtilHaveLibreOffice();
|
||||
have_vnu = testUtilHaveVnu();
|
||||
}
|
||||
|
||||
int ret;
|
||||
struct item {
|
||||
int symbology;
|
||||
int input_mode;
|
||||
|
@ -107,6 +97,8 @@ static void test_print(int index, int generate, int debug) {
|
|||
/* 43*/ { BARCODE_USPS_IMAIL, -1, -1, -1, -1, -1, -1, -1, -1, 7.75, "12345678901234567890", "", 0, "imail_height7.75.svg" },
|
||||
};
|
||||
int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
struct zint_symbol *symbol;
|
||||
|
||||
const char *data_dir = "/backend/tests/data/svg";
|
||||
const char *svg = "out.svg";
|
||||
|
@ -115,23 +107,33 @@ static void test_print(int index, int generate, int debug) {
|
|||
int escaped_size = 1024;
|
||||
char *text;
|
||||
|
||||
int have_libreoffice = 0;
|
||||
int have_vnu = 0;
|
||||
|
||||
testStart("test_print");
|
||||
|
||||
if (generate) {
|
||||
char data_dir_path[1024];
|
||||
|
||||
have_libreoffice = testUtilHaveLibreOffice();
|
||||
have_vnu = testUtilHaveVnu();
|
||||
|
||||
assert_nonzero(testUtilDataPath(data_dir_path, sizeof(data_dir_path), data_dir, NULL), "testUtilDataPath(%s) == 0\n", data_dir);
|
||||
if (!testUtilExists(data_dir_path)) {
|
||||
ret = testutil_mkdir(data_dir_path, 0755);
|
||||
assert_zero(ret, "testutil_mkdir(%s) ret %d != 0 (%d: %s)\n", data_dir_path, ret, errno, strerror(errno));
|
||||
if (!testUtilDirExists(data_dir_path)) {
|
||||
ret = testUtilMkDir(data_dir_path);
|
||||
assert_zero(ret, "testUtilMkDir(%s) ret %d != 0 (%d: %s)\n", data_dir_path, ret, errno, strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < data_size; i++) {
|
||||
for (i = 0; i < data_size; i++) {
|
||||
int text_length;
|
||||
|
||||
if (index != -1 && i != index) continue;
|
||||
|
||||
struct zint_symbol *symbol = ZBarcode_Create();
|
||||
symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
|
||||
int length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, data[i].output_options, data[i].data, -1, debug);
|
||||
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, data[i].output_options, data[i].data, -1, debug);
|
||||
if (data[i].show_hrt != -1) {
|
||||
symbol->show_hrt = data[i].show_hrt;
|
||||
}
|
||||
|
@ -153,7 +155,7 @@ static void test_print(int index, int generate, int debug) {
|
|||
} else {
|
||||
text = data[i].data;
|
||||
}
|
||||
int text_length = strlen(text);
|
||||
text_length = strlen(text);
|
||||
|
||||
ret = ZBarcode_Encode(symbol, (unsigned char *) text, text_length);
|
||||
assert_equal(ret, data[i].ret, "i:%d %s ZBarcode_Encode ret %d != %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, data[i].ret, symbol->errtxt);
|
||||
|
@ -169,8 +171,8 @@ static void test_print(int index, int generate, int debug) {
|
|||
i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), data[i].border_width, testUtilOutputOptionsName(data[i].output_options),
|
||||
data[i].whitespace_width, data[i].whitespace_height, data[i].show_hrt, data[i].option_1, data[i].option_2, data[i].height,
|
||||
testUtilEscape(data[i].data, length, escaped, escaped_size), data[i].composite, data[i].expected_file);
|
||||
ret = rename(symbol->outfile, expected_file);
|
||||
assert_zero(ret, "i:%d rename(%s, %s) ret %d != 0\n", i, symbol->outfile, expected_file, ret);
|
||||
ret = testUtilRename(symbol->outfile, expected_file);
|
||||
assert_zero(ret, "i:%d testUtilRename(%s, %s) ret %d != 0\n", i, symbol->outfile, expected_file, ret);
|
||||
if (have_libreoffice) {
|
||||
ret = testUtilVerifyLibreOffice(expected_file, debug);
|
||||
assert_zero(ret, "i:%d %s libreoffice %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), expected_file, ret);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue