diff --git a/backend/tests/CMakeLists.txt b/backend/tests/CMakeLists.txt index a4251d58..bb3afc14 100644 --- a/backend/tests/CMakeLists.txt +++ b/backend/tests/CMakeLists.txt @@ -4,6 +4,7 @@ # vim: set ts=4 sw=4 et : cmake_minimum_required(VERSION 3.9) +project(zint_backend_tests) enable_testing() @@ -30,20 +31,38 @@ if(NOT EXISTS ${BWIPP_PS}) WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tools) endif() -if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") - if(ZINT_DEBUG) +include(CheckCCompilerFlag) + +check_c_compiler_flag(-Wall C_COMPILER_FLAG_WALL) +if(C_COMPILER_FLAG_WALL) + add_compile_options("-Wall") +endif() + +check_c_compiler_flag(-Wextra C_COMPILER_FLAG_WEXTRA) +if(C_COMPILER_FLAG_WEXTRA) + add_compile_options("-Wextra") +endif() + +if(ZINT_DEBUG) + check_c_compiler_flag(-g C_COMPILER_FLAG_G) + if(C_COMPILER_FLAG_G) add_compile_options("-g") endif() - if(ZINT_SANITIZE) +endif() + +if(ZINT_SANITIZE) + # check_c_compiler_flag fails for -fsanitize + if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU") add_compile_options("-fsanitize=undefined") add_compile_options("-fsanitize=address") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined -fsanitize=address") - endif() - if(ZINT_TEST) - add_definitions("-DZINT_TEST") + link_libraries("-fsanitize=undefined -fsanitize=address") endif() endif() +if(ZINT_TEST) + add_definitions("-DZINT_TEST") +endif() + add_library(testcommon testcommon.c testcommon.h) if(PNG_FOUND) target_link_libraries(testcommon ZINT::ZINT ${PNG_LIBRARIES}) diff --git a/backend/tests/data/emf/code39_rotate_180.emf b/backend/tests/data/emf/code39_rotate_180.emf new file mode 100644 index 00000000..5f208be1 Binary files /dev/null and b/backend/tests/data/emf/code39_rotate_180.emf differ diff --git a/backend/tests/data/emf/code39_rotate_270.emf b/backend/tests/data/emf/code39_rotate_270.emf new file mode 100644 index 00000000..a474087f Binary files /dev/null and b/backend/tests/data/emf/code39_rotate_270.emf differ diff --git a/backend/tests/data/emf/code39_rotate_90.emf b/backend/tests/data/emf/code39_rotate_90.emf new file mode 100644 index 00000000..a735b78c Binary files /dev/null and b/backend/tests/data/emf/code39_rotate_90.emf differ diff --git a/backend/tests/data/svg/codablockf_3rows.svg b/backend/tests/data/svg/codablockf_3rows.svg index 0645033f..ece7188d 100644 --- a/backend/tests/data/svg/codablockf_3rows.svg +++ b/backend/tests/data/svg/codablockf_3rows.svg @@ -1,63 +1,63 @@ - Zint Generated Symbol - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/backend/tests/test_2of5.c b/backend/tests/test_2of5.c index d6170b5d..8174a101 100644 --- a/backend/tests/test_2of5.c +++ b/backend/tests/test_2of5.c @@ -38,7 +38,7 @@ static void test_large(int index, int debug) { int ret; struct item { int symbology; - unsigned char *pattern; + char *pattern; int length; int ret; int expected_rows; @@ -79,7 +79,7 @@ static void test_large(int index, int debug) { int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1 /*option_2*/, -1, -1 /*output_options*/, data_buf, data[i].length, debug); - ret = ZBarcode_Encode(symbol, data_buf, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (ret < 5) { @@ -100,8 +100,8 @@ static void test_hrt(int index, int debug) { int ret; struct item { int symbology; - unsigned char *data; - unsigned char *expected; + char *data; + char *expected; }; // s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<")) struct item data[] = { @@ -119,8 +119,6 @@ static void test_hrt(int index, int debug) { }; int data_size = ARRAY_SIZE(data); - char *text; - for (int i = 0; i < data_size; i++) { if (index != -1 && i != index) continue; @@ -130,10 +128,10 @@ static void test_hrt(int index, int debug) { int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 %s\n", i, ret, symbol->errtxt); - assert_zero(strcmp(symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->text, data[i].expected); + assert_zero(strcmp((char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->text, data[i].expected); ZBarcode_Delete(symbol); } @@ -148,7 +146,7 @@ static void test_input(int index, int debug) { int ret; struct item { int symbology; - unsigned char *data; + char *data; int ret; int expected_rows; int expected_width; @@ -175,7 +173,7 @@ static void test_input(int index, int debug) { int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1 /*option_2*/, -1, -1 /*output_options*/, data[i].data, -1, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (ret < 5) { @@ -198,7 +196,7 @@ static void test_encode(int index, int generate, int debug) { int ret; struct item { int symbology; - unsigned char *data; + char *data; int ret; int expected_rows; @@ -266,7 +264,7 @@ static void test_encode(int index, int generate, int debug) { int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1 /*option_2*/, -1, -1 /*output_options*/, data[i].data, -1, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { diff --git a/backend/tests/test_auspost.c b/backend/tests/test_auspost.c index 499474f2..d2298893 100644 --- a/backend/tests/test_auspost.c +++ b/backend/tests/test_auspost.c @@ -38,7 +38,7 @@ static void test_large(int index, int debug) { int ret; struct item { int symbology; - unsigned char *pattern; + char *pattern; int length; int ret; int expected_rows; @@ -79,7 +79,7 @@ static void test_large(int index, int debug) { int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data_buf, data[i].length, debug); - ret = ZBarcode_Encode(symbol, data_buf, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (ret < 5) { @@ -100,9 +100,9 @@ static void test_hrt(int index, int debug) { int ret; struct item { int symbology; - unsigned char *data; + char *data; - unsigned char *expected; + char *expected; }; // s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<")) struct item data[] = { @@ -110,8 +110,6 @@ static void test_hrt(int index, int debug) { }; int data_size = ARRAY_SIZE(data); - char *text; - for (int i = 0; i < data_size; i++) { if (index != -1 && i != index) continue; @@ -121,10 +119,10 @@ static void test_hrt(int index, int debug) { int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 %s\n", i, ret, symbol->errtxt); - assert_zero(strcmp(symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->text, data[i].expected); + assert_zero(strcmp((char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->text, data[i].expected); ZBarcode_Delete(symbol); } @@ -139,7 +137,7 @@ static void test_input(int index, int debug) { int ret; struct item { int symbology; - unsigned char *data; + char *data; int ret; int expected_rows; int expected_width; @@ -176,7 +174,7 @@ static void test_input(int index, int debug) { int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (ret < 5) { @@ -201,7 +199,7 @@ static void test_encode(int index, int generate, int debug) { int ret; struct item { int symbology; - unsigned char *data; + char *data; int ret; int expected_rows; @@ -266,7 +264,7 @@ static void test_encode(int index, int generate, int debug) { int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { @@ -309,7 +307,7 @@ static void test_fuzz(int index, int debug) { int ret; struct item { int symbology; - unsigned char *data; + char *data; int length; int ret; }; @@ -339,7 +337,7 @@ static void test_fuzz(int index, int debug) { length = strlen(data[i].data); } - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); ZBarcode_Delete(symbol); diff --git a/backend/tests/test_aztec.c b/backend/tests/test_aztec.c index 5fc420b2..073b7fb1 100644 --- a/backend/tests/test_aztec.c +++ b/backend/tests/test_aztec.c @@ -41,7 +41,7 @@ static void test_encode(int index, int generate, int debug) { int input_mode; int option_1; int option_2; - unsigned char *data; + char *data; int ret; int expected_rows; @@ -444,7 +444,7 @@ static void test_encode(int index, int generate, int debug) { int length = strlen(data[i].data); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { @@ -480,7 +480,7 @@ static void test_fuzz(int index, int debug) { int ret; struct item { int symbology; - unsigned char *data; + char *data; int length; int input_mode; int option_1; @@ -912,7 +912,7 @@ static void test_fuzz(int index, int debug) { } symbol->debug |= debug; - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); ZBarcode_Delete(symbol); diff --git a/backend/tests/test_bmp.c b/backend/tests/test_bmp.c index 40683b0b..502dc2d1 100644 --- a/backend/tests/test_bmp.c +++ b/backend/tests/test_bmp.c @@ -47,7 +47,7 @@ static void test_pixel_plot(int index, int debug) { struct item { int width; int height; - unsigned char *pattern; + char *pattern; int repeat; }; // s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<")) @@ -66,8 +66,6 @@ static void test_pixel_plot(int index, int debug) { int data_size = ARRAY_SIZE(data); char *bmp = "out.bmp"; - char escaped[1024]; - int escaped_size = 1024; char data_buf[8 * 2 + 1]; @@ -94,7 +92,7 @@ static void test_pixel_plot(int index, int debug) { } assert_equal(size, (int) strlen(data_buf), "i:%d bmp_pixel_plot size %d != strlen(data_buf) %d\n", i, size, (int) strlen(data_buf)); - symbol->bitmap = data_buf; + symbol->bitmap = (unsigned char *) data_buf; ret = bmp_pixel_plot(symbol, data_buf); assert_zero(ret, "i:%d bmp_pixel_plot ret %d != 0 (%s)\n", i, ret, symbol->errtxt); @@ -126,7 +124,7 @@ static void test_print(int index, int generate, int debug) { int option_2; char *fgcolour; char *bgcolour; - unsigned char* data; + char* data; char* expected_file; }; struct item data[] = { @@ -165,7 +163,7 @@ static void test_print(int index, int generate, int debug) { strcpy(symbol->bgcolour, data[i].bgcolour); } - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) 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); strcpy(symbol->outfile, bmp); diff --git a/backend/tests/test_channel.c b/backend/tests/test_channel.c index dc9fb50f..e1c9ae36 100644 --- a/backend/tests/test_channel.c +++ b/backend/tests/test_channel.c @@ -38,7 +38,7 @@ static void test_input(int index, int debug) { int ret; struct item { int option_2; - unsigned char *data; + char *data; int ret; int expected_rows; int expected_width; @@ -104,7 +104,7 @@ static void test_input(int index, int debug) { int length = testUtilSetSymbol(symbol, BARCODE_CHANNEL, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d\n", i, ret, data[i].ret); if (ret < 5) { @@ -127,7 +127,7 @@ static void test_encode(int index, int generate, int debug) { int ret; struct item { int option_2; - unsigned char *data; + char *data; int ret; int expected_rows; @@ -362,7 +362,7 @@ static void test_encode(int index, int generate, int debug) { int length = testUtilSetSymbol(symbol, BARCODE_CHANNEL, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { @@ -406,7 +406,7 @@ static void test_generate(int generate) { int ret; struct item { - unsigned char *data; + char *data; }; struct item data[] = { { "576688" }, { "7742862" } }; int data_size = ARRAY_SIZE(data); @@ -417,7 +417,7 @@ static void test_generate(int generate) { int length = testUtilSetSymbol(symbol, BARCODE_CHANNEL, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, 0); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 (%s)\n", i, ret, symbol->errtxt); ZBarcode_Delete(symbol); diff --git a/backend/tests/test_codablock.c b/backend/tests/test_codablock.c index f0da6be4..1b55342c 100644 --- a/backend/tests/test_codablock.c +++ b/backend/tests/test_codablock.c @@ -37,7 +37,7 @@ static void test_large(int index, int debug) { int ret; struct item { - unsigned char *pattern; + char *pattern; int length; int ret; int expected_rows; @@ -71,7 +71,7 @@ static void test_large(int index, int debug) { int length = testUtilSetSymbol(symbol, BARCODE_CODABLOCKF, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data_buf, data[i].length, debug); - ret = ZBarcode_Encode(symbol, data_buf, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (ret < 5) { @@ -94,7 +94,7 @@ static void test_options(int index, int debug) { int input_mode; int option_1; int option_2; - unsigned char *data; + char *data; int ret; int expected_rows; int expected_width; @@ -138,7 +138,7 @@ static void test_options(int index, int debug) { int length = testUtilSetSymbol(symbol, BARCODE_CODABLOCKF, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (ret < 5) { @@ -161,7 +161,7 @@ static void test_reader_init(int index, int generate, int debug) { int symbology; int input_mode; int output_options; - unsigned char *data; + char *data; int ret; int expected_rows; int expected_width; @@ -187,7 +187,7 @@ static void test_reader_init(int index, int generate, int debug) { int length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1 /*option_2*/, -1, data[i].output_options, data[i].data, -1, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { @@ -199,7 +199,7 @@ static void test_reader_init(int index, int generate, int debug) { if (ret < 5) { assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (%s)\n", i, symbol->rows, data[i].expected_rows, data[i].data); assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n", i, symbol->width, data[i].expected_width, data[i].data); - assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected); + assert_zero(strcmp((char *) symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected); } } @@ -218,7 +218,7 @@ static void test_input(int index, int generate, int debug) { int symbology; int input_mode; int option_2; - unsigned char *data; + char *data; int length; int ret; int expected_rows; @@ -294,7 +294,7 @@ static void test_input(int index, int generate, int debug) { int length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, data[i].length, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { @@ -306,7 +306,7 @@ static void test_input(int index, int generate, int debug) { if (ret < 5) { assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (%s)\n", i, symbol->rows, data[i].expected_rows, data[i].data); assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n", i, symbol->width, data[i].expected_width, data[i].data); - assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected); + assert_zero(strcmp((char *) symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected); } } @@ -327,7 +327,7 @@ static void test_encode(int index, int generate, int debug) { int symbology; int option_1; int option_2; - unsigned char *data; + char *data; int ret; int expected_rows; @@ -426,7 +426,7 @@ static void test_encode(int index, int generate, int debug) { int length = testUtilSetSymbol(symbol, data[i].symbology, UNICODE_MODE, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { @@ -472,7 +472,7 @@ static void test_fuzz(int index, int debug) { int ret; struct item { - unsigned char *data; + char *data; int length; int ret; }; @@ -491,7 +491,7 @@ static void test_fuzz(int index, int debug) { int length = testUtilSetSymbol(symbol, BARCODE_CODABLOCKF, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, data[i].length, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); ZBarcode_Delete(symbol); diff --git a/backend/tests/test_code.c b/backend/tests/test_code.c index 1d915ed7..d493ad89 100644 --- a/backend/tests/test_code.c +++ b/backend/tests/test_code.c @@ -39,7 +39,7 @@ static void test_large(int index, int debug) { struct item { int symbology; int option_2; - unsigned char *pattern; + char *pattern; int length; int ret; int expected_rows; @@ -87,7 +87,7 @@ static void test_large(int index, int debug) { int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data_buf, data[i].length, debug); - ret = ZBarcode_Encode(symbol, data_buf, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (ret < 5) { @@ -109,10 +109,10 @@ static void test_hrt(int index, int debug) { struct item { int symbology; int option_2; - unsigned char *data; + char *data; int length; - unsigned char *expected; + char *expected; }; // s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<")) struct item data[] = { @@ -146,8 +146,6 @@ static void test_hrt(int index, int debug) { }; int data_size = ARRAY_SIZE(data); - char *text; - for (int i = 0; i < data_size; i++) { if (index != -1 && i != index) continue; @@ -157,10 +155,10 @@ static void test_hrt(int index, int debug) { int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, data[i].length, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 %s\n", i, ret, symbol->errtxt); - assert_zero(strcmp(symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->text, data[i].expected); + assert_zero(strcmp((char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->text, data[i].expected); ZBarcode_Delete(symbol); } @@ -176,7 +174,7 @@ static void test_input(int index, int debug) { struct item { int symbology; int option_2; - unsigned char *data; + char *data; int length; int ret; int expected_rows; @@ -224,7 +222,7 @@ static void test_input(int index, int debug) { int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, data[i].length, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (ret < 5) { @@ -248,7 +246,7 @@ static void test_encode(int index, int generate, int debug) { struct item { int symbology; int option_2; - unsigned char *data; + char *data; int length; int ret; @@ -352,7 +350,7 @@ static void test_encode(int index, int generate, int debug) { int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, data[i].length, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { diff --git a/backend/tests/test_code1.c b/backend/tests/test_code1.c index aa82c882..df1d9b04 100644 --- a/backend/tests/test_code1.c +++ b/backend/tests/test_code1.c @@ -38,7 +38,7 @@ static void test_large(int index, int debug) { int ret; struct item { int option_2; - unsigned char *pattern; + char *pattern; int length; int ret; int expected_rows; @@ -93,7 +93,7 @@ static void test_large(int index, int debug) { int length = testUtilSetSymbol(symbol, BARCODE_CODEONE, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data_buf, data[i].length, debug); - ret = ZBarcode_Encode(symbol, data_buf, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (ret < 5) { @@ -115,7 +115,7 @@ static void test_input(int index, int debug) { struct item { int input_mode; int option_2; - unsigned char *data; + char *data; int length; int ret; int expected_rows; @@ -149,7 +149,7 @@ static void test_input(int index, int debug) { int length = testUtilSetSymbol(symbol, BARCODE_CODEONE, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, data[i].length, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (ret < 5) { @@ -172,7 +172,7 @@ static void test_encode(int index, int generate, int debug) { int ret; struct item { int option_2; - unsigned char *data; + char *data; int length; int ret; @@ -216,7 +216,7 @@ static void test_encode(int index, int generate, int debug) { int length = testUtilSetSymbol(symbol, BARCODE_CODEONE, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, data[i].length, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { @@ -258,7 +258,7 @@ static void test_fuzz(int index, int debug) { int ret; struct item { - unsigned char *data; + char *data; int length; int ret; }; @@ -280,7 +280,7 @@ static void test_fuzz(int index, int debug) { int length = data[i].length == -1 ? (int) strlen(data[i].data) : data[i].length; - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); ZBarcode_Delete(symbol); diff --git a/backend/tests/test_code128.c b/backend/tests/test_code128.c index cb574048..75d6ecef 100644 --- a/backend/tests/test_code128.c +++ b/backend/tests/test_code128.c @@ -40,7 +40,7 @@ static void test_large(int index, int debug) { int ret; struct item { int symbology; - unsigned char *pattern; + char *pattern; int length; int ret; int expected_width; @@ -87,7 +87,7 @@ static void test_large(int index, int debug) { int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data_buf, data[i].length, debug); - ret = ZBarcode_Encode(symbol, data_buf, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (ret < 5) { @@ -108,7 +108,7 @@ static void test_hrt_cpy_iso8859_1(int index, int debug) { int ret; struct item { - unsigned char *data; + char *data; int length; int ret; char *expected; @@ -135,7 +135,6 @@ static void test_hrt_cpy_iso8859_1(int index, int debug) { }; int data_size = ARRAY_SIZE(data); - int vals[20]; struct zint_symbol symbol; symbol.debug |= debug; @@ -145,14 +144,14 @@ static void test_hrt_cpy_iso8859_1(int index, int debug) { int length = data[i].length == -1 ? (int) strlen(data[i].data) : data[i].length; - ret = hrt_cpy_iso8859_1(&symbol, data[i].data, length); + ret = hrt_cpy_iso8859_1(&symbol, (unsigned char *) data[i].data, length); for (int j = 0; j < ret; j++) { //fprintf(stderr, "symbol.text[%d] %2X\n", j, symbol.text[j]); } assert_equal(ret, data[i].ret, "i:%d ret %d != %d\n", i, ret, data[i].ret); - assert_equal(ret, (int) strlen(symbol.text), "i:%d ret %d != strlen %d\n", i, ret, (int) strlen(symbol.text)); - assert_nonzero(testUtilIsValidUTF8(symbol.text, strlen(symbol.text)), "i:%d testUtilIsValidUTF8(%s) != 1\n", i, symbol.text); - assert_zero(strcmp(symbol.text, data[i].expected), "i:%d symbol.text (%s) != expected (%s)\n", i, symbol.text, data[i].expected); + assert_equal(ret, (int) ustrlen(symbol.text), "i:%d ret %d != strlen %d\n", i, ret, (int) ustrlen(symbol.text)); + assert_nonzero(testUtilIsValidUTF8(symbol.text, ustrlen(symbol.text)), "i:%d testUtilIsValidUTF8(%s) != 1\n", i, symbol.text); + assert_zero(strcmp((char *) symbol.text, data[i].expected), "i:%d symbol.text (%s) != expected (%s)\n", i, symbol.text, data[i].expected); } testFinish(); @@ -166,10 +165,10 @@ static void test_hrt(int index, int debug) { struct item { int symbology; int input_mode; - unsigned char *data; + char *data; int length; - unsigned char *expected; + char *expected; }; // é U+00E9 (\351, 233), UTF-8 C3A9, CodeB-only extended ASCII // s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<")) @@ -188,8 +187,6 @@ static void test_hrt(int index, int debug) { }; int data_size = ARRAY_SIZE(data); - char *text; - for (int i = 0; i < data_size; i++) { if (index != -1 && i != index) continue; @@ -199,10 +196,10 @@ static void test_hrt(int index, int debug) { int length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, data[i].length, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 %s\n", i, ret, symbol->errtxt); - assert_zero(strcmp(symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->text, data[i].expected); + assert_zero(strcmp((char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->text, data[i].expected); ZBarcode_Delete(symbol); } @@ -219,7 +216,7 @@ static void test_reader_init(int index, int generate, int debug) { int symbology; int input_mode; int output_options; - unsigned char *data; + char *data; int ret; int expected_rows; int expected_width; @@ -250,7 +247,7 @@ static void test_reader_init(int index, int generate, int debug) { int length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1 /*option_2*/, -1, data[i].output_options, data[i].data, -1, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { @@ -279,7 +276,7 @@ static void test_input(int index, int generate, int debug) { int ret; struct item { int input_mode; - unsigned char *data; + char *data; int length; int ret; int expected_width; @@ -345,7 +342,7 @@ static void test_input(int index, int generate, int debug) { int length = testUtilSetSymbol(symbol, BARCODE_CODE128, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, data[i].length, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { @@ -371,7 +368,7 @@ static void test_ean128_input(int index, int generate, int debug) { int ret; struct item { - unsigned char *data; + char *data; int ret; int expected_width; char *expected; @@ -415,7 +412,7 @@ static void test_ean128_input(int index, int generate, int debug) { int length = testUtilSetSymbol(symbol, BARCODE_GS1_128, GS1_MODE, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { @@ -441,7 +438,7 @@ static void test_hibc_input(int index, int generate, int debug) { int ret; struct item { - unsigned char *data; + char *data; int ret; int expected_width; char *expected; @@ -466,7 +463,7 @@ static void test_hibc_input(int index, int generate, int debug) { int length = testUtilSetSymbol(symbol, BARCODE_HIBC_128, UNICODE_MODE, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { @@ -496,7 +493,7 @@ static void test_encode(int index, int generate, int debug) { struct item { int symbology; int input_mode; - unsigned char *data; + char *data; int ret; int expected_rows; @@ -650,7 +647,7 @@ static void test_encode(int index, int generate, int debug) { int length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { diff --git a/backend/tests/test_code16k.c b/backend/tests/test_code16k.c index aececf27..d04153d2 100644 --- a/backend/tests/test_code16k.c +++ b/backend/tests/test_code16k.c @@ -37,7 +37,7 @@ static void test_large(int index, int debug) { int ret; struct item { - unsigned char *pattern; + char *pattern; int length; int ret; int expected_rows; @@ -66,7 +66,7 @@ static void test_large(int index, int debug) { int length = testUtilSetSymbol(symbol, BARCODE_CODE16K, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data_buf, data[i].length, debug); - ret = ZBarcode_Encode(symbol, data_buf, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (ret < 5) { @@ -88,7 +88,7 @@ static void test_reader_init(int index, int generate, int debug) { struct item { int input_mode; int output_options; - unsigned char *data; + char *data; int ret; int expected_rows; int expected_width; @@ -116,7 +116,7 @@ static void test_reader_init(int index, int generate, int debug) { int length = testUtilSetSymbol(symbol, BARCODE_CODE16K, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1 /*option_2*/, -1, data[i].output_options, data[i].data, -1, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { @@ -128,7 +128,7 @@ static void test_reader_init(int index, int generate, int debug) { if (ret < 5) { assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (%s)\n", i, symbol->rows, data[i].expected_rows, data[i].data); assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n", i, symbol->width, data[i].expected_width, data[i].data); - assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected); + assert_zero(strcmp((char *) symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected); } } @@ -145,7 +145,7 @@ static void test_input(int index, int generate, int debug) { int ret; struct item { int input_mode; - unsigned char *data; + char *data; int length; int ret; int expected_rows; @@ -195,7 +195,7 @@ static void test_input(int index, int generate, int debug) { int length = testUtilSetSymbol(symbol, BARCODE_CODE16K, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, data[i].length, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { @@ -206,7 +206,7 @@ static void test_input(int index, int generate, int debug) { if (ret < 5) { assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (%s)\n", i, symbol->rows, data[i].expected_rows, data[i].data); assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n", i, symbol->width, data[i].expected_width, data[i].data); - assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected); + assert_zero(strcmp((char *) symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected); } } @@ -225,7 +225,7 @@ static void test_encode(int index, int generate, int debug) { int ret; struct item { int input_mode; - unsigned char *data; + char *data; int ret; int expected_rows; @@ -260,7 +260,7 @@ static void test_encode(int index, int generate, int debug) { int length = testUtilSetSymbol(symbol, BARCODE_CODE16K, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { diff --git a/backend/tests/test_code49.c b/backend/tests/test_code49.c index 962260d4..628f6104 100644 --- a/backend/tests/test_code49.c +++ b/backend/tests/test_code49.c @@ -37,7 +37,7 @@ static void test_large(int index, int debug) { int ret; struct item { - unsigned char *pattern; + char *pattern; int length; int ret; int expected_rows; @@ -66,7 +66,7 @@ static void test_large(int index, int debug) { int length = testUtilSetSymbol(symbol, BARCODE_CODE49, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data_buf, data[i].length, debug); - ret = ZBarcode_Encode(symbol, data_buf, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (ret < 5) { @@ -87,7 +87,7 @@ static void test_input(int index, int generate, int debug) { int ret; struct item { int input_mode; - unsigned char *data; + char *data; int length; int ret; int expected_rows; @@ -128,7 +128,7 @@ static void test_input(int index, int generate, int debug) { int length = testUtilSetSymbol(symbol, BARCODE_CODE49, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, data[i].length, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { @@ -139,7 +139,7 @@ static void test_input(int index, int generate, int debug) { if (ret < 5) { assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (%s)\n", i, symbol->rows, data[i].expected_rows, data[i].data); assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n", i, symbol->width, data[i].expected_width, data[i].data); - assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected); + assert_zero(strcmp((char *) symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected); } } @@ -158,7 +158,7 @@ static void test_encode(int index, int generate, int debug) { int ret; struct item { int input_mode; - unsigned char *data; + char *data; int ret; int expected_rows; @@ -194,7 +194,7 @@ static void test_encode(int index, int generate, int debug) { int length = testUtilSetSymbol(symbol, BARCODE_CODE49, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { diff --git a/backend/tests/test_dotcode.c b/backend/tests/test_dotcode.c index bbadfe7e..fdf3d281 100644 --- a/backend/tests/test_dotcode.c +++ b/backend/tests/test_dotcode.c @@ -39,7 +39,7 @@ static void test_input(int index, int generate, int debug) { struct item { int input_mode; int eci; - unsigned char *data; + char *data; int length; int ret; char *expected; @@ -104,7 +104,7 @@ static void test_input(int index, int generate, int debug) { int length = data[i].length == -1 ? (int) strlen(data[i].data) : data[i].length; - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { @@ -113,7 +113,7 @@ static void test_input(int index, int generate, int debug) { data[i].length, testUtilErrorName(data[i].ret), symbol->errtxt, data[i].comment); } else { if (ret < 5) { - assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected); + assert_zero(strcmp((char *) symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected); } } @@ -131,7 +131,7 @@ static void test_encode(int index, int generate, int debug) { struct item { int input_mode; int option_2; - unsigned char *data; + char *data; int length; int ret; @@ -375,7 +375,7 @@ static void test_encode(int index, int generate, int debug) { int length = data[i].length == -1 ? (int) strlen(data[i].data) : data[i].length; - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { @@ -410,7 +410,7 @@ static void test_fuzz(int index, int debug) { int ret; struct item { - unsigned char *data; + char *data; int length; int input_mode; int ret; @@ -457,7 +457,7 @@ static void test_fuzz(int index, int debug) { int length = data[i].length == -1 ? (int) strlen(data[i].data) : data[i].length; - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); ZBarcode_Delete(symbol); @@ -504,7 +504,7 @@ static void test_large(int index, int debug) { memset(data_buf, data[i].datum, length); - ret = ZBarcode_Encode(symbol, data_buf, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); ZBarcode_Delete(symbol); diff --git a/backend/tests/test_eci.c b/backend/tests/test_eci.c index 1d6bc102..85e97a22 100644 --- a/backend/tests/test_eci.c +++ b/backend/tests/test_eci.c @@ -71,7 +71,7 @@ static void test_bom(int debug) { "111111100101101000101"; int ret; - ret = ZBarcode_Encode(symbol, data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data, length); assert_equal(ret, ZINT_WARN_USES_ECI, "ZBarcode_Encode ret %d != ZINT_WARN_USES_ECI\n", ret); assert_equal(symbol->eci, 21, "eci %d != 21\n", symbol->eci); // ECI 21 == Windows-1250 @@ -99,7 +99,7 @@ static void test_iso_8859_16(int debug) { int length = strlen(data); int ret; - ret = ZBarcode_Encode(symbol, data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data, length); assert_equal(ret, ZINT_WARN_USES_ECI, "ZBarcode_Encode ret %d != ZINT_WARN_USES_ECI\n", ret); assert_equal(symbol->eci, 18, "eci %d != 18\n", symbol->eci); // ECI 18 == ISO 8859-16 @@ -118,7 +118,7 @@ static void test_reduced_charset_input(int index, int debug) { int symbology; int input_mode; int eci; - unsigned char *data; + char *data; int ret; int expected_eci; char *comment; @@ -228,7 +228,7 @@ static void test_reduced_charset_input(int index, int debug) { int length = strlen(data[i].data); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (data[i].expected_eci != -1) { diff --git a/backend/tests/test_emf.c b/backend/tests/test_emf.c index 4e29e22b..cacd5261 100644 --- a/backend/tests/test_emf.c +++ b/backend/tests/test_emf.c @@ -36,8 +36,8 @@ static void test_emf(int index, int debug) { testStart(""); - if (!testUtilHaveInkscape()) { - testSkip("Inkscape not available"); + if (!testUtilHaveLibreOffice()) { + testSkip("LibreOffice not available"); return; } @@ -49,7 +49,7 @@ static void test_emf(int index, int debug) { char *fgcolour; char *bgcolour; float scale; - unsigned char *data; + char *data; }; // s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<")) struct item data[] = { @@ -76,7 +76,7 @@ static void test_emf(int index, int debug) { symbol->scale = data[i].scale; } - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) 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); char *filename = "out.emf"; @@ -84,8 +84,8 @@ static void test_emf(int index, int debug) { ret = ZBarcode_Print(symbol, 0); assert_zero(ret, "i:%d %s ZBarcode_Print %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret); - ret = testUtilVerifyInkscape(symbol->outfile, debug); // Slow - assert_zero(ret, "i:%d %s inkscape %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret); + ret = testUtilVerifyLibreOffice(symbol->outfile, debug); // Slow + assert_zero(ret, "i:%d %s libreoffice %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret); assert_zero(remove(symbol->outfile), "i:%d remove(%s) != 0\n", i, symbol->outfile); @@ -99,7 +99,10 @@ static void test_print(int index, int generate, int debug) { testStart(""); - int have_inkscape = testUtilHaveInkscape(); + int have_libreoffice = 0; + if (generate) { + have_libreoffice = testUtilHaveLibreOffice(); + } int ret; struct item { @@ -111,18 +114,22 @@ static void test_print(int index, int generate, int debug) { int option_2; char *fgcolour; char *bgcolour; - unsigned char* data; + int rotate_angle; + char* data; char* expected_file; }; struct item data[] = { - /* 0*/ { BARCODE_CODE128, UNICODE_MODE, BOLD_TEXT, -1, -1, -1, "", "", "Égjpqy", "../data/emf/code128_egrave_bold.emf" }, - /* 1*/ { BARCODE_TELEPEN, -1, -1, -1, -1, -1, "147AD0", "FC9630", "123", "../data/emf/telenum_fg_bg.emf" }, - /* 2*/ { BARCODE_ULTRA, -1, -1, 5, -1, -1, "147AD0", "FC9630", "123", "../data/emf/ultracode_fg_bg.emf" }, - /* 3*/ { BARCODE_EANX, -1, -1, -1, -1, -1, "", "", "9780877799306+54321", "../data/emf/ean13_5addon_ggs_5.2.2.5.2-2.emf" }, - /* 4*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, "", "", "012345678905+24", "../data/emf/upca_2addon_ggs_5.2.6.6-5.emf" }, - /* 5*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, "", "", "0123456+12", "../data/emf/upce_2addon.emf" }, - /* 6*/ { BARCODE_UPCE, -1, SMALL_TEXT | BOLD_TEXT, -1, -1, -1, "", "", "0123456+12", "../data/emf/upce_2addon_small_bold.emf" }, - /* 7*/ { BARCODE_ITF14, -1, BOLD_TEXT, -1, -1, -1, "", "", "123", "../data/emf/itf14_bold.emf" }, + /* 0*/ { BARCODE_CODE128, UNICODE_MODE, BOLD_TEXT, -1, -1, -1, "", "", 0, "Égjpqy", "../data/emf/code128_egrave_bold.emf" }, + /* 1*/ { BARCODE_TELEPEN, -1, -1, -1, -1, -1, "147AD0", "FC9630", 0, "123", "../data/emf/telenum_fg_bg.emf" }, + /* 2*/ { BARCODE_ULTRA, -1, -1, 5, -1, -1, "147AD0", "FC9630", 0, "123", "../data/emf/ultracode_fg_bg.emf" }, + /* 3*/ { BARCODE_EANX, -1, -1, -1, -1, -1, "", "", 0, "9780877799306+54321", "../data/emf/ean13_5addon_ggs_5.2.2.5.2-2.emf" }, + /* 4*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, "", "", 0, "012345678905+24", "../data/emf/upca_2addon_ggs_5.2.6.6-5.emf" }, + /* 5*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, "", "", 0, "0123456+12", "../data/emf/upce_2addon.emf" }, + /* 6*/ { BARCODE_UPCE, -1, SMALL_TEXT | BOLD_TEXT, -1, -1, -1, "", "", 0, "0123456+12", "../data/emf/upce_2addon_small_bold.emf" }, + /* 7*/ { BARCODE_ITF14, -1, BOLD_TEXT, -1, -1, -1, "", "", 0, "123", "../data/emf/itf14_bold.emf" }, + /* 8*/ { BARCODE_CODE39, -1, -1, -1, -1, -1, "", "", 90, "123", "../data/emf/code39_rotate_90.emf" }, + /* 9*/ { BARCODE_CODE39, -1, -1, -1, -1, -1, "", "", 180, "123", "../data/emf/code39_rotate_180.emf" }, + /* 10*/ { BARCODE_CODE39, -1, -1, -1, -1, -1, "", "", 270, "123", "../data/emf/code39_rotate_270.emf" }, }; int data_size = ARRAY_SIZE(data); @@ -156,22 +163,22 @@ static void test_print(int index, int generate, int debug) { strcpy(symbol->bgcolour, data[i].bgcolour); } - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) 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); strcpy(symbol->outfile, emf); - ret = ZBarcode_Print(symbol, 0); + ret = ZBarcode_Print(symbol, data[i].rotate_angle); assert_zero(ret, "i:%d %s ZBarcode_Print %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret); if (generate) { - printf(" /*%3d*/ { %s, %s, %s, %d, %d, %d, \"%s\", \"%s\", \"%s\", \"%s\"},\n", + printf(" /*%3d*/ { %s, %s, %s, %d, %d, %d, \"%s\", \"%s\", %d, \"%s\", \"%s\"},\n", i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), testUtilOutputOptionsName(data[i].output_options), data[i].whitespace_width, - data[i].option_1, data[i].option_2, data[i].fgcolour, data[i].bgcolour, testUtilEscape(data[i].data, length, escaped, escaped_size), data[i].expected_file); + data[i].option_1, data[i].option_2, data[i].fgcolour, data[i].bgcolour, data[i].rotate_angle, testUtilEscape(data[i].data, length, escaped, escaped_size), data[i].expected_file); ret = rename(symbol->outfile, data[i].expected_file); assert_zero(ret, "i:%d rename(%s, %s) ret %d != 0\n", i, symbol->outfile, data[i].expected_file, ret); - if (have_inkscape) { - ret = testUtilVerifyInkscape(data[i].expected_file, debug); - assert_zero(ret, "i:%d %s inkscape %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), data[i].expected_file, ret); + if (have_libreoffice) { + ret = testUtilVerifyLibreOffice(data[i].expected_file, debug); + assert_zero(ret, "i:%d %s libreoffice %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), data[i].expected_file, ret); } } else { assert_nonzero(testUtilExists(symbol->outfile), "i:%d testUtilExists(%s) == 0\n", i, symbol->outfile); diff --git a/backend/tests/test_gb18030.c b/backend/tests/test_gb18030.c index 529afec3..8e60ff90 100644 --- a/backend/tests/test_gb18030.c +++ b/backend/tests/test_gb18030.c @@ -152,7 +152,7 @@ static void test_gb18030_utf8tomb(int index) { int ret; struct item { - unsigned char *data; + char *data; int length; int ret; size_t ret_length; @@ -192,7 +192,7 @@ static void test_gb18030_utf8tomb(int index) { int length = data[i].length == -1 ? (int) strlen(data[i].data) : data[i].length; size_t ret_length = length; - ret = gb18030_utf8tomb(&symbol, data[i].data, &ret_length, gbdata); + ret = gb18030_utf8tomb(&symbol, (unsigned char *) data[i].data, &ret_length, gbdata); assert_equal(ret, data[i].ret, "i:%d ret %d != %d (%s)\n", i, ret, data[i].ret, symbol.errtxt); if (ret == 0) { assert_equal(ret_length, data[i].ret_length, "i:%d ret_length %zu != %zu\n", i, ret_length, data[i].ret_length); @@ -213,7 +213,7 @@ static void test_gb18030_utf8tosb(int index) { struct item { int eci; int full_multibyte; - unsigned char *data; + char *data; int length; int ret; size_t ret_length; @@ -267,7 +267,7 @@ static void test_gb18030_utf8tosb(int index) { int length = data[i].length == -1 ? (int) strlen(data[i].data) : data[i].length; size_t ret_length = length; - ret = gb18030_utf8tosb(data[i].eci, data[i].data, &ret_length, gbdata, data[i].full_multibyte); + ret = gb18030_utf8tosb(data[i].eci, (unsigned char *) data[i].data, &ret_length, gbdata, data[i].full_multibyte); assert_equal(ret, data[i].ret, "i:%d ret %d != %d\n", i, ret, data[i].ret); if (ret == 0) { assert_equal(ret_length, data[i].ret_length, "i:%d ret_length %zu != %zu\n", i, ret_length, data[i].ret_length); @@ -284,10 +284,9 @@ static void test_gb18030_cpy(int index) { testStart(""); - int ret; struct item { int full_multibyte; - unsigned char *data; + char *data; int length; int ret; size_t ret_length; @@ -319,7 +318,7 @@ static void test_gb18030_cpy(int index) { int length = data[i].length == -1 ? (int) strlen(data[i].data) : data[i].length; size_t ret_length = length; - gb18030_cpy(data[i].data, &ret_length, gbdata, data[i].full_multibyte); + gb18030_cpy((unsigned char *) data[i].data, &ret_length, gbdata, data[i].full_multibyte); assert_equal(ret_length, data[i].ret_length, "i:%d ret_length %zu != %zu\n", i, ret_length, data[i].ret_length); for (int j = 0; j < (int) ret_length; j++) { assert_equal(gbdata[j], data[i].expected_gbdata[j], "i:%d gbdata[%d] %04X != %04X\n", i, j, gbdata[j], data[i].expected_gbdata[j]); diff --git a/backend/tests/test_gb2312.c b/backend/tests/test_gb2312.c index 0f62998c..56871c58 100644 --- a/backend/tests/test_gb2312.c +++ b/backend/tests/test_gb2312.c @@ -55,7 +55,6 @@ static void test_gb2312_wctomb_zint(void) { testStart(""); int ret, ret2; - unsigned char buf[2], buf2[2]; unsigned int val, val2; for (unsigned int i = 0; i < 0xFFFE; i++) { @@ -93,7 +92,7 @@ static void test_gb2312_utf8tomb(int index) { int ret; struct item { - unsigned char *data; + char *data; int length; int ret; size_t ret_length; @@ -133,7 +132,7 @@ static void test_gb2312_utf8tomb(int index) { int length = data[i].length == -1 ? (int) strlen(data[i].data) : data[i].length; size_t ret_length = length; - ret = gb2312_utf8tomb(&symbol, data[i].data, &ret_length, gbdata); + ret = gb2312_utf8tomb(&symbol, (unsigned char *) data[i].data, &ret_length, gbdata); assert_equal(ret, data[i].ret, "i:%d ret %d != %d (%s)\n", i, ret, data[i].ret, symbol.errtxt); if (ret == 0) { assert_equal(ret_length, data[i].ret_length, "i:%d ret_length %zu != %zu\n", i, ret_length, data[i].ret_length); @@ -154,7 +153,7 @@ static void test_gb2312_utf8tosb(int index) { struct item { int eci; int full_multibyte; - unsigned char *data; + char *data; int length; int ret; size_t ret_length; @@ -206,7 +205,7 @@ static void test_gb2312_utf8tosb(int index) { int length = data[i].length == -1 ? (int) strlen(data[i].data) : data[i].length; size_t ret_length = length; - ret = gb2312_utf8tosb(data[i].eci, data[i].data, &ret_length, gbdata, data[i].full_multibyte); + ret = gb2312_utf8tosb(data[i].eci, (unsigned char *) data[i].data, &ret_length, gbdata, data[i].full_multibyte); assert_equal(ret, data[i].ret, "i:%d ret %d != %d\n", i, ret, data[i].ret); if (ret == 0) { assert_equal(ret_length, data[i].ret_length, "i:%d ret_length %zu != %zu\n", i, ret_length, data[i].ret_length); @@ -223,10 +222,9 @@ static void test_gb2312_cpy(int index) { testStart(""); - int ret; struct item { int full_multibyte; - unsigned char *data; + char *data; int length; int ret; size_t ret_length; @@ -258,7 +256,7 @@ static void test_gb2312_cpy(int index) { int length = data[i].length == -1 ? (int) strlen(data[i].data) : data[i].length; size_t ret_length = length; - gb2312_cpy(data[i].data, &ret_length, gbdata, data[i].full_multibyte); + gb2312_cpy((unsigned char *) data[i].data, &ret_length, gbdata, data[i].full_multibyte); assert_equal(ret_length, data[i].ret_length, "i:%d ret_length %zu != %zu\n", i, ret_length, data[i].ret_length); for (int j = 0; j < (int) ret_length; j++) { assert_equal(gbdata[j], data[i].expected_gbdata[j], "i:%d gbdata[%d] %04X != %04X\n", i, j, gbdata[j], data[i].expected_gbdata[j]); diff --git a/backend/tests/test_gif.c b/backend/tests/test_gif.c index 6a9bc3ae..c3d4f654 100644 --- a/backend/tests/test_gif.c +++ b/backend/tests/test_gif.c @@ -46,7 +46,7 @@ static void test_pixel_plot(int index, int debug) { struct item { int width; int height; - unsigned char *pattern; + char *pattern; int repeat; }; // s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<")) @@ -65,8 +65,6 @@ static void test_pixel_plot(int index, int debug) { int data_size = ARRAY_SIZE(data); char *gif = "out.gif"; - char escaped[1024]; - int escaped_size = 1024; char data_buf[19 * 32 + 1]; // 19 * 32 == 608 @@ -93,7 +91,7 @@ static void test_pixel_plot(int index, int debug) { } assert_equal(size, (int) strlen(data_buf), "i:%d gif_pixel_plot size %d != strlen(data_buf) %d\n", i, size, (int) strlen(data_buf)); - symbol->bitmap = data_buf; + symbol->bitmap = (unsigned char *) data_buf; ret = gif_pixel_plot(symbol, data_buf); assert_zero(ret, "i:%d gif_pixel_plot ret %d != 0 (%s)\n", i, ret, symbol->errtxt); diff --git a/backend/tests/test_gridmtx.c b/backend/tests/test_gridmtx.c index ce5d62b5..719b117b 100644 --- a/backend/tests/test_gridmtx.c +++ b/backend/tests/test_gridmtx.c @@ -37,7 +37,7 @@ static void test_large(int index, int debug) { int ret; struct item { - unsigned char *pattern; + char *pattern; int length; int ret; int expected_rows; @@ -68,7 +68,7 @@ static void test_large(int index, int debug) { int length = testUtilSetSymbol(symbol, BARCODE_GRIDMATRIX, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data_buf, data[i].length, debug); - ret = ZBarcode_Encode(symbol, data_buf, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (ret < 5) { @@ -88,7 +88,7 @@ static void test_options(int index, int debug) { int ret; struct item { - unsigned char *data; + char *data; int option_1; int option_2; int ret_encode; @@ -126,7 +126,7 @@ static void test_options(int index, int debug) { int length = strlen(data[i].data); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret_encode, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret_encode, symbol->errtxt); if (data[i].ret_vector != -1) { @@ -151,7 +151,7 @@ static void test_input(int index, int generate, int debug) { int input_mode; int eci; int option_3; - unsigned char *data; + char *data; int ret; int expected_eci; char *expected; @@ -238,7 +238,7 @@ static void test_input(int index, int generate, int debug) { int length = strlen(data[i].data); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d\n", i, ret, data[i].ret); if (generate) { @@ -249,7 +249,7 @@ static void test_input(int index, int generate, int debug) { if (ret < 5) { assert_equal(symbol->eci, data[i].expected_eci, "i:%d eci %d != %d\n", i, symbol->eci, data[i].expected_eci); - assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected); + assert_zero(strcmp((char *) symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected); } } @@ -265,7 +265,7 @@ static void test_encode(int index, int generate, int debug) { int ret; struct item { - unsigned char *data; + char *data; int input_mode; int option_1; int option_2; @@ -395,7 +395,7 @@ static void test_encode(int index, int generate, int debug) { int length = strlen(data[i].data); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { diff --git a/backend/tests/test_gs1.c b/backend/tests/test_gs1.c index 54976636..8db0009f 100644 --- a/backend/tests/test_gs1.c +++ b/backend/tests/test_gs1.c @@ -44,12 +44,12 @@ static void test_gs1_reduce(int index, int generate, int debug) { struct item { int symbology; int input_mode; - unsigned char *data; - unsigned char *composite; + char *data; + char *composite; int ret; char *comment; - unsigned char *expected; + char *expected; }; struct item data[] = { /* 0*/ { BARCODE_GS1_128, -1, "12345678901234", "", ZINT_ERROR_INVALID_DATA, "GS1 data required", "" }, @@ -193,7 +193,7 @@ static void test_gs1_reduce(int index, int generate, int debug) { } int length = strlen(text); - ret = ZBarcode_Encode(symbol, text, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) text, length); if (generate) { if (data[i].ret == 0) { @@ -237,10 +237,10 @@ static void test_hrt(int index, int debug) { int ret; struct item { int symbology; - unsigned char *data; - unsigned char *composite; + char *data; + char *composite; - unsigned char *expected; + char *expected; }; // s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<")) struct item data[] = { @@ -275,10 +275,10 @@ static void test_hrt(int index, int debug) { } int length = strlen(text); - ret = ZBarcode_Encode(symbol, text, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) text, length); assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 %s\n", i, ret, symbol->errtxt); - assert_zero(strcmp(symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->text, data[i].expected); + assert_zero(strcmp((char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->text, data[i].expected); ZBarcode_Delete(symbol); } @@ -294,7 +294,7 @@ static void test_gs1_verify(int index) { int ret; struct item { - unsigned char *data; + char *data; int ret; char *expected; }; @@ -801,7 +801,7 @@ static void test_gs1_verify(int index) { int length = strlen(data[i].data); - ret = gs1_verify(symbol, data[i].data, length, reduced); + ret = gs1_verify(symbol, (unsigned char *) data[i].data, length, reduced); assert_equal(ret, data[i].ret, "i:%d ret %d != %d (length %d \"%s\") %s\n", i, ret, data[i].ret, length, data[i].data, symbol->errtxt); if (ret == 0) { @@ -821,8 +821,8 @@ static void test_input_mode(int index, int debug) { int ret; struct item { int symbology; - unsigned char *data; - unsigned char *composite; + char *data; + char *composite; int input_mode; int output_options; int ret; @@ -894,7 +894,7 @@ static void test_input_mode(int index, int debug) { } int length = strlen(text); - ret = ZBarcode_Encode(symbol, text, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) text, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d %s\n", i, ret, data[i].ret, symbol->errtxt); if (index == -1 && data[i].compare_previous) { ret = testUtilSymbolCmp(symbol, &previous_symbol); diff --git a/backend/tests/test_hanxin.c b/backend/tests/test_hanxin.c index 6d907045..d9568ffd 100644 --- a/backend/tests/test_hanxin.c +++ b/backend/tests/test_hanxin.c @@ -37,7 +37,7 @@ static void test_large(int index, int debug) { int ret; struct item { - unsigned char *pattern; + char *pattern; int length; int ret; int expected_rows; @@ -68,7 +68,7 @@ static void test_large(int index, int debug) { int length = testUtilSetSymbol(symbol, BARCODE_HANXIN, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data_buf, data[i].length, debug); - ret = ZBarcode_Encode(symbol, data_buf, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (ret < 5) { @@ -88,7 +88,7 @@ static void test_options(int index, int debug) { int ret; struct item { - unsigned char *data; + char *data; int option_1; int option_2; int ret_encode; @@ -130,7 +130,7 @@ static void test_options(int index, int debug) { int length = strlen(data[i].data); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret_encode, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret_encode, symbol->errtxt); if (data[i].ret_vector != -1) { @@ -155,7 +155,7 @@ static void test_input(int index, int generate, int debug) { int input_mode; int eci; int option_3; - unsigned char *data; + char *data; int length; int ret; int expected_eci; @@ -229,7 +229,7 @@ static void test_input(int index, int generate, int debug) { int length = data[i].length == -1 ? (int) strlen(data[i].data) : data[i].length; - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { @@ -255,7 +255,7 @@ static void test_encode(int index, int generate, int debug) { int ret; struct item { - unsigned char *data; + char *data; int input_mode; int option_1; int option_2; @@ -439,7 +439,7 @@ static void test_encode(int index, int generate, int debug) { int length = strlen(data[i].data); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { diff --git a/backend/tests/test_imail.c b/backend/tests/test_imail.c index c8f84e0d..d8a79c41 100644 --- a/backend/tests/test_imail.c +++ b/backend/tests/test_imail.c @@ -53,7 +53,6 @@ static void test_csv(int index, int debug) { char actual_daft[70]; int ret; - int i; int lc = 0; while (fgets(buffer, sizeof(buffer), fd) != NULL) { @@ -101,7 +100,7 @@ static void test_csv(int index, int debug) { symbol->symbology = BARCODE_USPS_IMAIL; symbol->debug |= debug; - ret = ZBarcode_Encode(symbol, data, strlen(data)); + ret = ZBarcode_Encode(symbol, (unsigned char *) data, strlen(data)); if (strcmp(return_code, "00") == 0) { @@ -130,8 +129,8 @@ static void test_hrt(int index, int debug) { int ret; struct item { - unsigned char *data; - unsigned char *expected; + char *data; + char *expected; }; // s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<")) struct item data[] = { @@ -139,8 +138,6 @@ static void test_hrt(int index, int debug) { }; int data_size = ARRAY_SIZE(data); - char *text; - for (int i = 0; i < data_size; i++) { if (index != -1 && i != index) continue; @@ -150,10 +147,10 @@ static void test_hrt(int index, int debug) { int length = testUtilSetSymbol(symbol, BARCODE_USPS_IMAIL, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 %s\n", i, ret, symbol->errtxt); - assert_zero(strcmp(symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->text, data[i].expected); + assert_zero(strcmp((char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->text, data[i].expected); ZBarcode_Delete(symbol); } @@ -167,7 +164,7 @@ static void test_input(int index, int debug) { int ret; struct item { - unsigned char *data; + char *data; int ret; int expected_rows; int expected_width; @@ -199,7 +196,7 @@ static void test_input(int index, int debug) { int length = testUtilSetSymbol(symbol, BARCODE_USPS_IMAIL, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (ret < 5) { @@ -221,7 +218,7 @@ static void test_encode(int index, int generate, int debug) { int ret; struct item { - unsigned char *data; + char *data; int ret; int expected_rows; @@ -251,7 +248,7 @@ static void test_encode(int index, int generate, int debug) { int length = testUtilSetSymbol(symbol, BARCODE_USPS_IMAIL, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { diff --git a/backend/tests/test_large.c b/backend/tests/test_large.c index 8f876376..fcb016b5 100644 --- a/backend/tests/test_large.c +++ b/backend/tests/test_large.c @@ -36,7 +36,7 @@ int clz_u64(uint64_t x); -static void test_clz_u64(int index, int debug) { +static void test_clz_u64(int index) { testStart(""); @@ -187,11 +187,10 @@ static void test_clz_u64(int index, int debug) { testFinish(); } -static void test_load(int index, int debug) { +static void test_load(int index) { testStart(""); - int ret; struct item { large_int t; large_int s; @@ -224,14 +223,13 @@ static void test_load(int index, int debug) { testFinish(); } -static void test_load_str_u64(int index, int debug) { +static void test_load_str_u64(int index) { testStart(""); - int ret; struct item { large_int t; - const unsigned char *s; + const char *s; int length; large_int expected; }; @@ -254,7 +252,7 @@ static void test_load_str_u64(int index, int debug) { if (index != -1 && i != index) continue; - large_load_str_u64(&data[i].t, data[i].s, data[i].length == -1 ? (int) strlen(data[i].s) : data[i].length); + large_load_str_u64(&data[i].t, (unsigned char *) data[i].s, data[i].length == -1 ? (int) strlen(data[i].s) : data[i].length); assert_equal(data[i].t.lo, data[i].expected.lo, "i:%d lo 0x%lX (%s) != expected lo 0x%lX (%s)\n", i, data[i].t.lo, large_dump(&data[i].t, t_dump), data[i].expected.lo, large_dump(&data[i].expected, expected_dump)); @@ -265,11 +263,10 @@ static void test_load_str_u64(int index, int debug) { testFinish(); } -static void test_add_u64(int index, int debug) { +static void test_add_u64(int index) { testStart(""); - int ret; struct item { large_int t; uint64_t s; @@ -309,11 +306,10 @@ static void test_add_u64(int index, int debug) { testFinish(); } -static void test_sub_u64(int index, int debug) { +static void test_sub_u64(int index) { testStart(""); - int ret; struct item { large_int t; uint64_t s; @@ -353,11 +349,10 @@ static void test_sub_u64(int index, int debug) { testFinish(); } -static void test_mul_u64(int index, int debug) { +static void test_mul_u64(int index) { testStart(""); - int ret; struct item { large_int t; uint64_t s; @@ -410,7 +405,7 @@ static void test_mul_u64(int index, int debug) { testFinish(); } -static void test_div_u64(int index, int debug) { +static void test_div_u64(int index) { testStart(""); @@ -535,11 +530,10 @@ static void test_div_u64(int index, int debug) { testFinish(); } -static void test_unset_bit(int index, int debug) { +static void test_unset_bit(int index) { testStart(""); - int ret; struct item { large_int t; int s; @@ -699,11 +693,10 @@ static void test_unset_bit(int index, int debug) { testFinish(); } -static void test_uint_array(int index, int debug) { +static void test_uint_array(int index) { testStart(""); - int ret; struct item { large_int t; int size; @@ -784,11 +777,10 @@ static void test_uint_array(int index, int debug) { testFinish(); } -static void test_dump(int index, int debug) { +static void test_dump(int index) { testStart(""); - int ret; struct item { large_int t; char *expected; @@ -863,16 +855,16 @@ static void test_dump(int index, int debug) { int main(int argc, char *argv[]) { testFunction funcs[] = { /* name, func, has_index, has_generate, has_debug */ - { "test_clz_u64", test_clz_u64, 1, 0, 1 }, - { "test_load", test_load, 1, 0, 1 }, - { "test_load_str_u64", test_load_str_u64, 1, 0, 1 }, - { "test_add_u64", test_add_u64, 1, 0, 1 }, - { "test_sub_u64", test_sub_u64, 1, 0, 1 }, - { "test_mul_u64", test_mul_u64, 1, 0, 1 }, - { "test_div_u64", test_div_u64, 1, 0, 1 }, - { "test_unset_bit", test_unset_bit, 1, 0, 1 }, - { "test_uint_array", test_uint_array, 1, 0, 1 }, - { "test_dump", test_dump, 1, 0, 1 }, + { "test_clz_u64", test_clz_u64, 1, 0, 0 }, + { "test_load", test_load, 1, 0, 0 }, + { "test_load_str_u64", test_load_str_u64, 1, 0, 0 }, + { "test_add_u64", test_add_u64, 1, 0, 0 }, + { "test_sub_u64", test_sub_u64, 1, 0, 0 }, + { "test_mul_u64", test_mul_u64, 1, 0, 0 }, + { "test_div_u64", test_div_u64, 1, 0, 0 }, + { "test_unset_bit", test_unset_bit, 1, 0, 0 }, + { "test_uint_array", test_uint_array, 1, 0, 0 }, + { "test_dump", test_dump, 1, 0, 0 }, }; testRun(argc, argv, funcs, ARRAY_SIZE(funcs)); diff --git a/backend/tests/test_library.c b/backend/tests/test_library.c index 2d3a4597..144e06fc 100644 --- a/backend/tests/test_library.c +++ b/backend/tests/test_library.c @@ -41,7 +41,7 @@ static void test_checks(int index, int debug) { int ret; struct item { int symbology; - unsigned char *data; + char *data; int length; int input_mode; int eci; @@ -65,10 +65,6 @@ static void test_checks(int index, int debug) { }; int data_size = sizeof(data) / sizeof(struct item); - char *text; - char *primary; - char escaped_primary[1024]; - for (int i = 0; i < data_size; i++) { if (index != -1 && i != index) continue; @@ -90,7 +86,7 @@ static void test_checks(int index, int debug) { int length = data[i].length == -1 ? (int) strlen(data[i].data) : data[i].length; - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, 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); @@ -108,7 +104,7 @@ static void test_input_mode(int index, int debug) { int ret; struct item { - unsigned char *data; + char *data; int input_mode; int ret; @@ -143,7 +139,7 @@ static void test_input_mode(int index, int debug) { int length = strlen(data[i].data); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); 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); @@ -160,7 +156,7 @@ static void test_escape_char_process(int index, int generate, int debug) { int ret; struct item { int input_mode; - unsigned char *data; + char *data; int ret; int expected_width; char *expected; @@ -199,7 +195,7 @@ static void test_escape_char_process(int index, int generate, int debug) { int length = testUtilSetSymbol(symbol, BARCODE_CODE128, data[i].input_mode | ESCAPE_MODE, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { @@ -219,7 +215,7 @@ static void test_escape_char_process(int index, int generate, int debug) { testFinish(); } -static void test_cap(int index, int debug) { +static void test_cap(int index) { testStart(""); @@ -288,7 +284,6 @@ static void test_encode_file_directory(void) { int ret; char dirname[] = "in_dir"; - int fd; struct zint_symbol *symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); @@ -331,12 +326,12 @@ static void test_bad_args(void) { assert_zero(ret, "ZBarcode_Cap(10, ~0) ret 0x%X != 0\n", ret); // NULL symbol - assert_equal(ZBarcode_Encode(NULL, data, 1), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode(NULL, data, 1) != ZINT_ERROR_INVALID_DATA\n"); + assert_equal(ZBarcode_Encode(NULL, (unsigned char *) data, 1), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode(NULL, data, 1) != ZINT_ERROR_INVALID_DATA\n"); 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"); - assert_equal(ZBarcode_Encode_and_Print(NULL, data, 1, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_and_Print(NULL, data, 1, 0) != ZINT_ERROR_INVALID_DATA\n"); - assert_equal(ZBarcode_Encode_and_Buffer(NULL, data, 1, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_and_Buffer(NULL, data, 1, 0) != ZINT_ERROR_INVALID_DATA\n"); + assert_equal(ZBarcode_Encode_and_Print(NULL, (unsigned char *) data, 1, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_and_Print(NULL, data, 1, 0) != ZINT_ERROR_INVALID_DATA\n"); + assert_equal(ZBarcode_Encode_and_Buffer(NULL, (unsigned char *) data, 1, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_and_Buffer(NULL, data, 1, 0) != ZINT_ERROR_INVALID_DATA\n"); 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"); @@ -366,13 +361,13 @@ static void test_bad_args(void) { // Empty data/filename symbol->errtxt[0] = '\0'; - assert_equal(ZBarcode_Encode(symbol, empty, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode(symbol, empty, 0) != ZINT_ERROR_INVALID_DATA\n"); + assert_equal(ZBarcode_Encode(symbol, (unsigned char *) empty, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode(symbol, empty, 0) != ZINT_ERROR_INVALID_DATA\n"); assert_nonzero(strlen(symbol->errtxt), "ZBarcode_Encode(symbol, empty, 0) no errtxt\n"); symbol->errtxt[0] = '\0'; - assert_equal(ZBarcode_Encode_and_Print(symbol, empty, 0, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_and_Print(symbol, empty, 0, 0) != ZINT_ERROR_INVALID_DATA\n"); + assert_equal(ZBarcode_Encode_and_Print(symbol, (unsigned char *) empty, 0, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_and_Print(symbol, empty, 0, 0) != ZINT_ERROR_INVALID_DATA\n"); assert_nonzero(strlen(symbol->errtxt), "ZBarcode_Encode_and_Print(symbol, empty, 0, 0) no errtxt\n"); symbol->errtxt[0] = '\0'; - assert_equal(ZBarcode_Encode_and_Buffer(symbol, empty, 0, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_and_Buffer(symbol, empty, 0, 0) != ZINT_ERROR_INVALID_DATA\n"); + assert_equal(ZBarcode_Encode_and_Buffer(symbol, (unsigned char *) empty, 0, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_and_Buffer(symbol, empty, 0, 0) != ZINT_ERROR_INVALID_DATA\n"); assert_nonzero(strlen(symbol->errtxt), "ZBarcode_Encode_and_Buffer(symbol, empty, 0, 0) no errtxt\n"); symbol->errtxt[0] = '\0'; assert_equal(ZBarcode_Encode_File(symbol, empty), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_File(symbol, empty) != ZINT_ERROR_INVALID_DATA\n"); @@ -395,7 +390,7 @@ int main(int argc, char *argv[]) { { "test_checks", test_checks, 1, 0, 1 }, { "test_input_mode", test_input_mode, 1, 0, 1 }, { "test_escape_char_process", test_escape_char_process, 1, 1, 1 }, - { "test_cap", test_cap, 1, 0, 1 }, + { "test_cap", test_cap, 1, 0, 0 }, { "test_encode_file_zero_length", test_encode_file_zero_length, 0, 0, 0 }, { "test_encode_file_directory", test_encode_file_directory, 0, 0, 0 }, { "test_bad_args", test_bad_args, 0, 0, 0 }, diff --git a/backend/tests/test_mailmark.c b/backend/tests/test_mailmark.c index d4d098da..db61a0a9 100644 --- a/backend/tests/test_mailmark.c +++ b/backend/tests/test_mailmark.c @@ -36,7 +36,7 @@ static void test_input(int index, int debug) { int ret; struct item { - unsigned char *data; + char *data; int ret; int expected_rows; int expected_width; @@ -109,7 +109,7 @@ static void test_input(int index, int debug) { int length = testUtilSetSymbol(symbol, BARCODE_MAILMARK, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (ret < 5) { @@ -133,12 +133,12 @@ static void test_encode_vector(int index, int debug) { int ret; struct item { - unsigned char *data; + char *data; int ret_encode; float w; float h; int ret_vector; - unsigned char *expected_daft; + char *expected_daft; }; // s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<")) struct item data[] = { @@ -179,7 +179,7 @@ static void test_encode_vector(int index, int debug) { int length = strlen(data[i].data); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret_encode, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret_encode, symbol->errtxt); assert_equal(symbol->rows, 3, "i:%d symbol->rows %d != 3\n", i, symbol->rows); @@ -203,7 +203,7 @@ static void test_encode(int index, int generate, int debug) { int ret; struct item { - unsigned char *data; + char *data; int ret; int expected_rows; @@ -231,7 +231,7 @@ static void test_encode(int index, int generate, int debug) { int length = testUtilSetSymbol(symbol, BARCODE_MAILMARK, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { diff --git a/backend/tests/test_maxicode.c b/backend/tests/test_maxicode.c index 003c6520..8e00eaf1 100644 --- a/backend/tests/test_maxicode.c +++ b/backend/tests/test_maxicode.c @@ -38,7 +38,7 @@ static void test_large(int index, int debug) { int ret; struct item { int option_1; - unsigned char *pattern; + char *pattern; int length; char* primary; int ret; @@ -73,7 +73,7 @@ static void test_large(int index, int debug) { int length = testUtilSetSymbol(symbol, BARCODE_MAXICODE, -1 /*input_mode*/, -1 /*eci*/, data[i].option_1, -1, -1, -1 /*output_options*/, data_buf, data[i].length, debug); strcpy(symbol->primary, data[i].primary); - ret = ZBarcode_Encode(symbol, data_buf, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (ret < 5) { @@ -95,7 +95,7 @@ static void test_encode(int index, int generate, int debug) { struct item { int input_mode; int option_1; - unsigned char *data; + char *data; char* primary; int ret; @@ -190,7 +190,7 @@ static void test_encode(int index, int generate, int debug) { int length = testUtilSetSymbol(symbol, BARCODE_MAXICODE, data[i].input_mode, -1 /*eci*/, data[i].option_1, -1, -1, -1 /*output_options*/, data[i].data, -1, debug); strcpy(symbol->primary, data[i].primary); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { @@ -224,7 +224,7 @@ static void test_best_supported_set(int index, int generate, int debug) { int ret; struct item { - unsigned char *data; + char *data; int ret; float w; float h; @@ -233,7 +233,7 @@ static void test_best_supported_set(int index, int generate, int debug) { int expected_rows; int expected_width; char *comment; - unsigned char *expected; + char *expected; }; struct item data[] = { /* 0*/ { "am.//ab,\034TA# z\015!", 0, 100, 100, 0, 33, 30, "TODO: Better data and verify expected", @@ -288,7 +288,7 @@ static void test_best_supported_set(int index, int generate, int debug) { int length = strlen(data[i].data); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d\n", i, ret, data[i].ret); if (generate) { @@ -322,7 +322,7 @@ static void test_fuzz(int index, int debug) { int ret; struct item { - unsigned char *data; + char *data; int length; int ret; }; @@ -351,7 +351,7 @@ static void test_fuzz(int index, int debug) { length = strlen(data[i].data); } - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); ZBarcode_Delete(symbol); diff --git a/backend/tests/test_medical.c b/backend/tests/test_medical.c index d21342fe..76e81785 100644 --- a/backend/tests/test_medical.c +++ b/backend/tests/test_medical.c @@ -39,7 +39,7 @@ static void test_large(int index, int debug) { struct item { int symbology; int option_2; - unsigned char *pattern; + char *pattern; int length; int ret; int expected_rows; @@ -74,7 +74,7 @@ static void test_large(int index, int debug) { int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data_buf, data[i].length, debug); - ret = ZBarcode_Encode(symbol, data_buf, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (ret < 5) { @@ -96,9 +96,9 @@ static void test_hrt(int index, int debug) { struct item { int symbology; int option_2; - unsigned char *data; + char *data; - unsigned char *expected; + char *expected; }; // s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<")) struct item data[] = { @@ -112,8 +112,6 @@ static void test_hrt(int index, int debug) { }; int data_size = ARRAY_SIZE(data); - char *text; - for (int i = 0; i < data_size; i++) { if (index != -1 && i != index) continue; @@ -123,10 +121,10 @@ static void test_hrt(int index, int debug) { int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 %s\n", i, ret, symbol->errtxt); - assert_zero(strcmp(symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->text, data[i].expected); + assert_zero(strcmp((char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->text, data[i].expected); ZBarcode_Delete(symbol); } @@ -141,7 +139,7 @@ static void test_input(int index, int debug) { int ret; struct item { int symbology; - unsigned char *data; + char *data; int ret; int expected_rows; int expected_width; @@ -186,7 +184,7 @@ static void test_input(int index, int debug) { int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (ret < 5) { @@ -210,7 +208,7 @@ static void test_encode(int index, int generate, int debug) { struct item { int symbology; int option_2; - unsigned char *data; + char *data; int ret; int expected_rows; @@ -267,7 +265,7 @@ static void test_encode(int index, int generate, int debug) { int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { diff --git a/backend/tests/test_pcx.c b/backend/tests/test_pcx.c index a150b5bc..cfdb852a 100644 --- a/backend/tests/test_pcx.c +++ b/backend/tests/test_pcx.c @@ -48,7 +48,7 @@ static void test_pcx(int index, int debug) { char *fgcolour; char *bgcolour; float scale; - unsigned char *data; + char *data; }; // s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<")) struct item data[] = { @@ -92,7 +92,7 @@ static void test_pcx(int index, int debug) { int length = strlen(data[i].data); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) 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); char *filename = "out.pcx"; diff --git a/backend/tests/test_pdf417.c b/backend/tests/test_pdf417.c index ef36de7e..d94fd103 100644 --- a/backend/tests/test_pdf417.c +++ b/backend/tests/test_pdf417.c @@ -41,7 +41,7 @@ static void test_options(int index, int debug) { int option_1; int option_2; int option_3; - unsigned char *data; + char *data; int ret_encode; int ret_vector; @@ -80,7 +80,7 @@ static void test_options(int index, int debug) { int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1, data[i].option_1, data[i].option_2, data[i].option_3, -1 /*output_options*/, data[i].data, -1, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret_encode, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret_encode, symbol->errtxt); assert_equal(symbol->option_1, data[i].expected_option_1, "i:%d symbol->option_1 %d != %d (%d) (%s)\n", i, symbol->option_1, data[i].expected_option_1, data[i].option_1, symbol->errtxt); @@ -120,7 +120,7 @@ static void test_reader_init(int index, int generate, int debug) { int symbology; int input_mode; int output_options; - unsigned char *data; + char *data; int ret; int expected_rows; int expected_width; @@ -146,7 +146,7 @@ static void test_reader_init(int index, int generate, int debug) { int length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1 /*option_2*/, -1, data[i].output_options, data[i].data, -1, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { @@ -177,7 +177,7 @@ static void test_input(int index, int generate, int debug) { int symbology; int input_mode; int eci; - unsigned char *data; + char *data; int ret; int expected_eci; int expected_rows; @@ -229,7 +229,7 @@ static void test_input(int index, int generate, int debug) { int length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, data[i].eci, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { @@ -264,7 +264,7 @@ static void test_encode(int index, int generate, int debug) { int input_mode; int option_1; int option_2; - unsigned char *data; + char *data; int ret; int expected_rows; @@ -622,7 +622,7 @@ static void test_encode(int index, int generate, int debug) { int length = strlen(data[i].data); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { @@ -670,7 +670,7 @@ static void test_fuzz(int index, int debug) { int ret; struct item { int symbology; - unsigned char *data; + char *data; int length; int option_1; int ret; @@ -951,7 +951,7 @@ static void test_fuzz(int index, int debug) { length = strlen(data[i].data); } - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); ZBarcode_Delete(symbol); diff --git a/backend/tests/test_plessey.c b/backend/tests/test_plessey.c index d453ef2b..a574a8de 100644 --- a/backend/tests/test_plessey.c +++ b/backend/tests/test_plessey.c @@ -39,7 +39,7 @@ static void test_large(int index, int debug) { struct item { int symbology; int option_2; - unsigned char *pattern; + char *pattern; int length; int ret; int expected_rows; @@ -76,7 +76,7 @@ static void test_large(int index, int debug) { int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data_buf, data[i].length, debug); - ret = ZBarcode_Encode(symbol, data_buf, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (ret < 5) { @@ -98,9 +98,9 @@ static void test_hrt(int index, int debug) { struct item { int symbology; int option_2; - unsigned char *data; + char *data; - unsigned char *expected; + char *expected; }; // s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<")) struct item data[] = { @@ -120,8 +120,6 @@ static void test_hrt(int index, int debug) { }; int data_size = ARRAY_SIZE(data); - char *text; - for (int i = 0; i < data_size; i++) { if (index != -1 && i != index) continue; @@ -131,10 +129,10 @@ static void test_hrt(int index, int debug) { int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 %s\n", i, ret, symbol->errtxt); - assert_zero(strcmp(symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->text, data[i].expected); + assert_zero(strcmp((char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->text, data[i].expected); ZBarcode_Delete(symbol); } @@ -150,7 +148,7 @@ static void test_input(int index, int debug) { struct item { int symbology; int option_2; - unsigned char *data; + char *data; int ret; int expected_rows; int expected_width; @@ -173,7 +171,7 @@ static void test_input(int index, int debug) { int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (ret < 5) { @@ -195,7 +193,7 @@ static void test_encode(int index, int generate, int debug) { struct item { int symbology; int option_2; - unsigned char *data; + char *data; int ret; int expected_rows; @@ -242,7 +240,7 @@ static void test_encode(int index, int generate, int debug) { int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { diff --git a/backend/tests/test_png.c b/backend/tests/test_png.c index a33df6a1..1eefb5a3 100644 --- a/backend/tests/test_png.c +++ b/backend/tests/test_png.c @@ -47,7 +47,7 @@ static void test_pixel_plot(int index, int debug) { struct item { int width; int height; - unsigned char *pattern; + char *pattern; int repeat; }; // s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<")) @@ -63,8 +63,6 @@ static void test_pixel_plot(int index, int debug) { int data_size = ARRAY_SIZE(data); char *png = "out.png"; - char escaped[1024]; - int escaped_size = 1024; char data_buf[8 * 2 + 1]; @@ -91,7 +89,7 @@ static void test_pixel_plot(int index, int debug) { } assert_equal(size, (int) strlen(data_buf), "i:%d png_pixel_plot size %d != strlen(data_buf) %d\n", i, size, (int) strlen(data_buf)); - symbol->bitmap = data_buf; + symbol->bitmap = (unsigned char *) data_buf; ret = png_pixel_plot(symbol, data_buf); assert_zero(ret, "i:%d png_pixel_plot ret %d != 0 (%s)\n", i, ret, symbol->errtxt); @@ -125,7 +123,7 @@ static void test_print(int index, int generate, int debug) { int option_2; int height; float scale; - unsigned char *data; + char *data; char *composite; char *expected_file; char *comment; @@ -205,7 +203,7 @@ static void test_print(int index, int generate, int debug) { } int text_length = strlen(text); - ret = ZBarcode_Encode(symbol, text, text_length); + ret = ZBarcode_Encode(symbol, (unsigned char *) text, text_length); assert_zero(ret, "i:%d %s ZBarcode_Encode ret %d != 0 %s\n", i, testUtilBarcodeName(data[i].symbology), ret, symbol->errtxt); strcpy(symbol->outfile, png); diff --git a/backend/tests/test_postal.c b/backend/tests/test_postal.c index 9c5ac147..6638ba6d 100644 --- a/backend/tests/test_postal.c +++ b/backend/tests/test_postal.c @@ -42,7 +42,7 @@ static void test_large(int index, int debug) { int ret; struct item { int symbology; - unsigned char *pattern; + char *pattern; int length; int ret; int expected_rows; @@ -85,7 +85,7 @@ static void test_large(int index, int debug) { int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data_buf, data[i].length, debug); - ret = ZBarcode_Encode(symbol, data_buf, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (ret < 5) { @@ -105,7 +105,7 @@ static void test_koreapost(int index, int debug) { int ret; struct item { - unsigned char *data; + char *data; int ret_encode; int ret_vector; @@ -130,7 +130,7 @@ static void test_koreapost(int index, int debug) { int length = strlen(data[i].data); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret_encode, "i:%d ZBarcode_Encode ret %d != %d\n", i, ret, data[i].ret_encode); if (data[i].ret_vector != -1) { @@ -154,7 +154,7 @@ static void test_japanpost(int index, int debug) { int ret; struct item { - unsigned char *data; + char *data; int ret_encode; int ret_vector; @@ -182,7 +182,7 @@ static void test_japanpost(int index, int debug) { int length = strlen(data[i].data); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret_encode, "i:%d ZBarcode_Encode ret %d != %d\n", i, ret, data[i].ret_encode); if (data[i].ret_vector != -1) { @@ -207,7 +207,7 @@ static void test_input(int index, int debug) { int ret; struct item { int symbology; - unsigned char *data; + char *data; int ret; int expected_rows; int expected_width; @@ -261,7 +261,7 @@ static void test_input(int index, int debug) { int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (ret < 5) { @@ -284,7 +284,7 @@ static void test_encode(int index, int generate, int debug) { int ret; struct item { int symbology; - unsigned char *data; + char *data; int ret; int expected_rows; @@ -388,7 +388,7 @@ static void test_encode(int index, int generate, int debug) { int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { diff --git a/backend/tests/test_print.c b/backend/tests/test_print.c index 148f6486..a81721a8 100644 --- a/backend/tests/test_print.c +++ b/backend/tests/test_print.c @@ -38,9 +38,16 @@ static void test_print(int index, int generate, int debug) { testStart(""); - int have_identify = testUtilHaveIdentify(); - int have_inkscape = testUtilHaveInkscape(); - int have_ghostscript = testUtilHaveGhostscript(); + int have_identify = 0; + int have_libreoffice = 0; + int have_ghostscript = 0; + int have_vnu = 0; + if (generate) { + have_identify = testUtilHaveIdentify(); + have_libreoffice = testUtilHaveLibreOffice(); + have_ghostscript = testUtilHaveGhostscript(); + have_vnu = testUtilHaveVnu(); + } int ret; struct item { @@ -48,7 +55,7 @@ static void test_print(int index, int generate, int debug) { int option_1; int option_2; float scale; - unsigned char *data; + char *data; char *expected_file; }; struct item data[] = { @@ -104,7 +111,7 @@ static void test_print(int index, int generate, int debug) { symbol->scale = data[i].scale; } - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) 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); strcpy(symbol->outfile, "out."); @@ -134,9 +141,13 @@ static void test_print(int index, int generate, int debug) { assert_zero(ret, "i:%d %s ghostscript %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), expected_file, ret); } } else if (strcmp(exts[j], "svg") == 0 || strcmp(exts[j], "emf") == 0) { - if (have_inkscape) { - ret = testUtilVerifyInkscape(expected_file, debug); - assert_zero(ret, "i:%d %s inkscape %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), expected_file, ret); + if (have_libreoffice) { + ret = testUtilVerifyLibreOffice(expected_file, debug); // Slow + assert_zero(ret, "i:%d %s libreoffice %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), expected_file, ret); + } + if (have_vnu && strcmp(exts[j], "svg") == 0) { + ret = testUtilVerifyVnu(expected_file, debug); // Very slow + assert_zero(ret, "i:%d %s vnu %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), expected_file, ret); } } else if (strcmp(exts[j], "txt") != 0) { // I.e. rasters if (have_identify) { diff --git a/backend/tests/test_ps.c b/backend/tests/test_ps.c index 95f4922b..a3a076ef 100644 --- a/backend/tests/test_ps.c +++ b/backend/tests/test_ps.c @@ -36,7 +36,7 @@ static void test_print(int index, int generate, int debug) { testStart(""); - int have_inkscape = testUtilHaveInkscape(); + int have_ghostscript = testUtilHaveGhostscript(); int ret; struct item { @@ -48,7 +48,7 @@ static void test_print(int index, int generate, int debug) { int option_2; char *fgcolour; char *bgcolour; - unsigned char *data; + char *data; char *expected_file; }; struct item data[] = { @@ -94,7 +94,7 @@ static void test_print(int index, int generate, int debug) { strcpy(symbol->bgcolour, data[i].bgcolour); } - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) 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); strcpy(symbol->outfile, eps); @@ -107,9 +107,9 @@ static void test_print(int index, int generate, int debug) { data[i].option_1, data[i].option_2, data[i].fgcolour, data[i].bgcolour, testUtilEscape(data[i].data, length, escaped, escaped_size), data[i].expected_file); ret = rename(symbol->outfile, data[i].expected_file); assert_zero(ret, "i:%d rename(%s, %s) ret %d != 0\n", i, symbol->outfile, data[i].expected_file, ret); - if (have_inkscape) { - ret = testUtilVerifyInkscape(data[i].expected_file, debug); - assert_zero(ret, "i:%d %s inkscape %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), data[i].expected_file, ret); + if (have_ghostscript) { + ret = testUtilVerifyGhostscript(data[i].expected_file, debug); + assert_zero(ret, "i:%d %s ghostscript %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), data[i].expected_file, ret); } } else { assert_nonzero(testUtilExists(symbol->outfile), "i:%d testUtilExists(%s) == 0\n", i, symbol->outfile); @@ -128,14 +128,13 @@ static void test_print(int index, int generate, int debug) { void ps_convert(const unsigned char *string, unsigned char *ps_string); -static void test_ps_convert(int index, int debug) { +static void test_ps_convert(int index) { testStart(""); - int ret; struct item { - unsigned char *data; - unsigned char *expected; + char *data; + char *expected; }; struct item data[] = { /* 0*/ { "1\\(é)2€3", "1\\\\\\(\351\\)23" }, @@ -148,8 +147,8 @@ static void test_ps_convert(int index, int debug) { if (index != -1 && i != index) continue; - ps_convert(data[i].data, converted); - assert_zero(strcmp(converted, data[i].expected), "i:%d ps_convert(%s) %s != %s\n", i, data[i].data, converted, data[i].expected); + ps_convert((unsigned char *) data[i].data, converted); + assert_zero(strcmp((char *) converted, data[i].expected), "i:%d ps_convert(%s) %s != %s\n", i, data[i].data, converted, data[i].expected); } testFinish(); @@ -159,7 +158,7 @@ int main(int argc, char *argv[]) { testFunction funcs[] = { /* name, func, has_index, has_generate, has_debug */ { "test_print", test_print, 1, 1, 1 }, - { "test_ps_convert", test_ps_convert, 1, 0, 1 }, + { "test_ps_convert", test_ps_convert, 1, 0, 0 }, }; testRun(argc, argv, funcs, ARRAY_SIZE(funcs)); diff --git a/backend/tests/test_qr.c b/backend/tests/test_qr.c index c8f20eae..ac506ae5 100644 --- a/backend/tests/test_qr.c +++ b/backend/tests/test_qr.c @@ -37,7 +37,7 @@ static void test_qr_options(int index, int debug) { int ret; struct item { - unsigned char *data; + char *data; int option_1; int option_2; int ret_encode; @@ -102,7 +102,7 @@ static void test_qr_options(int index, int debug) { int length = strlen(data[i].data); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret_encode, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret_encode, symbol->errtxt); if (index == -1 && data[i].compare_previous != -1) { ret = testUtilSymbolCmp(symbol, &previous_symbol); @@ -132,7 +132,7 @@ static void test_qr_input(int index, int generate, int debug) { int input_mode; int eci; int option_3; - unsigned char *data; + char *data; int ret; int expected_eci; char *expected; @@ -265,7 +265,7 @@ static void test_qr_input(int index, int generate, int debug) { int length = strlen(data[i].data); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d\n", i, ret, data[i].ret); if (generate) { @@ -292,7 +292,7 @@ static void test_qr_gs1(int index, int generate, int debug) { int ret; struct item { - unsigned char *data; + char *data; int ret; char *expected; char *comment; @@ -327,7 +327,7 @@ static void test_qr_gs1(int index, int generate, int debug) { int length = strlen(data[i].data); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d\n", i, ret, data[i].ret); if (generate) { @@ -352,7 +352,7 @@ static void test_qr_optimize(int index, int generate, int debug) { int ret; struct item { int input_mode; - unsigned char *data; + char *data; int option_1; int ret; char *expected; @@ -412,7 +412,7 @@ static void test_qr_optimize(int index, int generate, int debug) { int length = strlen(data[i].data); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d\n", i, ret, data[i].ret); if (generate) { @@ -436,7 +436,7 @@ static void test_qr_encode(int index, int generate, int debug) { int ret; struct item { int input_mode; - unsigned char *data; + char *data; int option_1; int option_2; int ret; @@ -935,7 +935,7 @@ static void test_qr_encode(int index, int generate, int debug) { int length = strlen(data[i].data); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { @@ -969,7 +969,7 @@ static void test_microqr_options(int index, int debug) { int ret; struct item { - unsigned char *data; + char *data; int option_1; int option_2; int ret_encode; @@ -1051,7 +1051,7 @@ static void test_microqr_options(int index, int debug) { int length = strlen(data[i].data); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret_encode, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret_encode, symbol->errtxt); if (index == -1 && data[i].compare_previous != -1) { ret = testUtilSymbolCmp(symbol, &previous_symbol); @@ -1080,7 +1080,7 @@ static void test_microqr_input(int index, int generate, int debug) { struct item { int input_mode; int option_3; - unsigned char *data; + char *data; int ret; char *expected; char *comment; @@ -1162,7 +1162,7 @@ static void test_microqr_input(int index, int generate, int debug) { int length = strlen(data[i].data); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d\n", i, ret, data[i].ret); if (generate) { @@ -1188,7 +1188,7 @@ static void test_microqr_padding(int index, int generate, int debug) { int ret; struct item { - unsigned char *data; + char *data; int option_1; int ret; char *expected; @@ -1242,7 +1242,7 @@ static void test_microqr_padding(int index, int generate, int debug) { int length = strlen(data[i].data); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { @@ -1268,7 +1268,7 @@ static void test_microqr_optimize(int index, int generate, int debug) { int ret; struct item { int input_mode; - unsigned char *data; + char *data; int option_1; int option_2; int ret; @@ -1312,7 +1312,7 @@ static void test_microqr_optimize(int index, int generate, int debug) { int length = strlen(data[i].data); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { @@ -1336,7 +1336,7 @@ static void test_microqr_encode(int index, int generate, int debug) { int ret; struct item { int input_mode; - unsigned char *data; + char *data; int option_1; int option_2; int ret; @@ -1522,7 +1522,7 @@ static void test_microqr_encode(int index, int generate, int debug) { int length = strlen(data[i].data); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { @@ -1557,7 +1557,7 @@ static void test_upnqr_input(int index, int generate, int debug) { int ret; struct item { int input_mode; - unsigned char *data; + char *data; int ret; char *expected; char *comment; @@ -1589,7 +1589,7 @@ static void test_upnqr_input(int index, int generate, int debug) { int length = strlen(data[i].data); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d\n", i, ret, data[i].ret); assert_equal(symbol->eci, 4, "i:%d ZBarcode_Encode symbol->eci %d != 4\n", i, symbol->eci); @@ -1616,7 +1616,7 @@ static void test_upnqr_encode(int index, int generate, int debug) { int ret; struct item { int input_mode; - unsigned char *data; + char *data; int option_1; int option_2; int ret; @@ -1729,7 +1729,7 @@ static void test_upnqr_encode(int index, int generate, int debug) { int length = strlen(data[i].data); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { @@ -1763,7 +1763,7 @@ static void test_rmqr_options(int index, int debug) { int ret; struct item { - unsigned char *data; + char *data; int option_1; int option_2; int ret_encode; @@ -1861,7 +1861,7 @@ static void test_rmqr_options(int index, int debug) { int length = strlen(data[i].data); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret_encode, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret_encode, symbol->errtxt); if (data[i].ret_vector != -1) { @@ -1885,7 +1885,7 @@ static void test_rmqr_input(int index, int generate, int debug) { struct item { int input_mode; int option_3; - unsigned char *data; + char *data; int ret; char *expected; char *comment; @@ -1933,7 +1933,7 @@ static void test_rmqr_input(int index, int generate, int debug) { int length = strlen(data[i].data); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d\n", i, ret, data[i].ret); if (generate) { @@ -1958,7 +1958,7 @@ static void test_rmqr_gs1(int index, int generate, int debug) { int ret; struct item { - unsigned char *data; + char *data; int ret; char *expected; char *comment; @@ -1994,7 +1994,7 @@ static void test_rmqr_gs1(int index, int generate, int debug) { int length = strlen(data[i].data); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d\n", i, ret, data[i].ret); if (generate) { @@ -2019,7 +2019,7 @@ static void test_rmqr_optimize(int index, int generate, int debug) { int ret; struct item { int input_mode; - unsigned char *data; + char *data; int option_1; int ret; char *expected; @@ -2071,7 +2071,7 @@ static void test_rmqr_optimize(int index, int generate, int debug) { int length = strlen(data[i].data); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { @@ -2095,7 +2095,7 @@ static void test_rmqr_encode(int index, int generate, int debug) { int ret; struct item { int input_mode; - unsigned char *data; + char *data; int option_1; int option_2; int ret; @@ -2156,7 +2156,7 @@ static void test_rmqr_encode(int index, int generate, int debug) { int length = strlen(data[i].data); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { diff --git a/backend/tests/test_raster.c b/backend/tests/test_raster.c index ae50690f..3cc32e1a 100644 --- a/backend/tests/test_raster.c +++ b/backend/tests/test_raster.c @@ -51,7 +51,7 @@ static void test_options(int index, int debug) { char *fgcolour; char *bgcolour; int rotate_angle; - unsigned char *data; + char *data; int ret; int expected_rows; int expected_width; @@ -88,7 +88,7 @@ static void test_options(int index, int debug) { strcpy(symbol->bgcolour, data[i].bgcolour); } - ret = ZBarcode_Encode_and_Buffer(symbol, data[i].data, length, data[i].rotate_angle); + ret = ZBarcode_Encode_and_Buffer(symbol, (unsigned char *) data[i].data, length, data[i].rotate_angle); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (ret < 5) { @@ -111,7 +111,7 @@ static void test_buffer(int index, int generate, int debug) { int ret; struct item { int symbology; - unsigned char *data; + char *data; char *composite; int expected_height; @@ -274,7 +274,7 @@ static void test_buffer(int index, int generate, int debug) { } int length = strlen(text); - ret = ZBarcode_Encode(symbol, text, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) text, length); assert_zero(ret, "i:%d ZBarcode_Encode(%s) ret %d != 0 (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, symbol->errtxt); ret = ZBarcode_Buffer(symbol, 0); @@ -311,7 +311,7 @@ static void test_upcean_hrt(int index, int debug) { struct item { int symbology; int show_hrt; - unsigned char *data; + char *data; int ret; int expected_height; @@ -379,7 +379,7 @@ static void test_upcean_hrt(int index, int debug) { int length = strlen(data[i].data); - ret = ZBarcode_Encode_and_Buffer(symbol, data[i].data, length, 0); + ret = ZBarcode_Encode_and_Buffer(symbol, (unsigned char *) data[i].data, length, 0); assert_equal(ret, data[i].ret, "i:%d ret %d != %d\n", i, ret, data[i].ret); assert_nonnull(symbol->bitmap, "i:%d (%d) symbol->bitmap NULL\n", i, data[i].symbology); @@ -448,7 +448,7 @@ static void test_row_separator(int index, int debug) { int border_width; int option_1; int option_3; - unsigned char *data; + char *data; int ret; int expected_height; @@ -486,7 +486,7 @@ static void test_row_separator(int index, int debug) { symbol->border_width = data[i].border_width; } - ret = ZBarcode_Encode_and_Buffer(symbol, data[i].data, length, 0); + ret = ZBarcode_Encode_and_Buffer(symbol, (unsigned char *) data[i].data, length, 0); assert_equal(ret, data[i].ret, "i:%d ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); assert_nonnull(symbol->bitmap, "i:%d (%s) symbol->bitmap NULL\n", i, testUtilBarcodeName(data[i].symbology)); @@ -533,8 +533,8 @@ static void test_stacking(int index, int debug) { int output_options; int option_1; int option_3; - unsigned char *data; - unsigned char *data2; + char *data; + char *data2; int expected_height; int expected_rows; @@ -561,11 +561,11 @@ static void test_stacking(int index, int debug) { assert_nonnull(symbol, "Symbol not created\n"); int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, data[i].option_1, -1, data[i].option_3, data[i].output_options, data[i].data, -1, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_zero(ret, "i:%d ret %d != zero\n", i, ret); int length2 = strlen(data[i].data2); - ret = ZBarcode_Encode(symbol, data[i].data2, length2); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data2, length2); assert_zero(ret, "i:%d ret %d != zero\n", i, ret); ret = ZBarcode_Buffer(symbol, 0); @@ -616,7 +616,7 @@ static void test_output_options(int index, int debug) { int border_width; int output_options; int rotate_angle; - unsigned char *data; + char *data; int ret; int expected_height; @@ -692,8 +692,6 @@ static void test_output_options(int index, int debug) { }; int data_size = ARRAY_SIZE(data); - struct zint_vector_rect *rect; - for (int i = 0; i < data_size; i++) { if (index != -1 && i != index) continue; @@ -709,7 +707,7 @@ static void test_output_options(int index, int debug) { symbol->border_width = data[i].border_width; } - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_zero(ret, "i:%d ZBarcode_Encode(%s) ret %d != 0 (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, symbol->errtxt); ret = ZBarcode_Buffer(symbol, data[i].rotate_angle); @@ -754,8 +752,8 @@ static void test_draw_string_wrap(int index, int debug) { struct item { int symbology; int output_options; - unsigned char *data; - unsigned char* text; + char *data; + char* text; int expected_height; int expected_rows; @@ -782,11 +780,11 @@ static void test_draw_string_wrap(int index, int debug) { int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, data[i].output_options, data[i].data, -1, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_zero(ret, "i:%d ZBarcode_Encode(%d) ret %d != 0 (%s)\n", i, data[i].symbology, ret, symbol->errtxt); // Cheat by overwriting text - strcpy(symbol->text, data[i].text); + strcpy((char *) symbol->text, data[i].text); ret = ZBarcode_Buffer(symbol, 0); assert_zero(ret, "i:%d ZBarcode_Buffer(%d) ret %d != 0 (%s)\n", i, data[i].symbology, ret, symbol->errtxt); @@ -825,7 +823,7 @@ static void test_code128_utf8(int index, int debug) { int ret; struct item { - unsigned char *data; + char *data; int expected_height; int expected_rows; @@ -851,7 +849,7 @@ static void test_code128_utf8(int index, int debug) { int length = testUtilSetSymbol(symbol, BARCODE_CODE128, UNICODE_MODE, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_zero(ret, "i:%d ZBarcode_Encode(%d) ret %d != 0 %s\n", i, BARCODE_CODE128, ret, symbol->errtxt); ret = ZBarcode_Buffer(symbol, 0); @@ -895,7 +893,7 @@ static void test_scale(int index, int debug) { int border_width; int output_options; float scale; - unsigned char *data; + char *data; char *composite; int expected_height; @@ -961,7 +959,7 @@ static void test_scale(int index, int debug) { } int length = strlen(text); - ret = ZBarcode_Encode(symbol, text, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) text, length); assert_zero(ret, "i:%d ZBarcode_Encode(%d) ret %d != 0 %s\n", i, data[i].symbology, ret, symbol->errtxt); ret = ZBarcode_Buffer(symbol, 0); diff --git a/backend/tests/test_rss.c b/backend/tests/test_rss.c index 899bb1d4..6999cf49 100644 --- a/backend/tests/test_rss.c +++ b/backend/tests/test_rss.c @@ -1059,8 +1059,6 @@ static void test_hrt(int index, int debug) { }; int data_size = ARRAY_SIZE(data); - char *text; - for (int i = 0; i < data_size; i++) { if (index != -1 && i != index) continue; diff --git a/backend/tests/test_sjis.c b/backend/tests/test_sjis.c index ab70131c..ea003c46 100644 --- a/backend/tests/test_sjis.c +++ b/backend/tests/test_sjis.c @@ -112,7 +112,7 @@ static void test_sjis_utf8tomb(int index) { int ret; struct item { - unsigned char *data; + char *data; int length; int ret; size_t ret_length; @@ -151,7 +151,7 @@ static void test_sjis_utf8tomb(int index) { int length = data[i].length == -1 ? (int) strlen(data[i].data) : data[i].length; size_t ret_length = length; - ret = sjis_utf8tomb(&symbol, data[i].data, &ret_length, jisdata); + ret = sjis_utf8tomb(&symbol, (unsigned char *) data[i].data, &ret_length, jisdata); assert_equal(ret, data[i].ret, "i:%d ret %d != %d (%s)\n", i, ret, data[i].ret, symbol.errtxt); if (ret == 0) { assert_equal(ret_length, data[i].ret_length, "i:%d ret_length %zu != %zu\n", i, ret_length, data[i].ret_length); @@ -172,7 +172,7 @@ static void test_sjis_utf8tosb(int index) { struct item { int eci; int full_multibyte; - unsigned char *data; + char *data; int length; int ret; size_t ret_length; @@ -217,7 +217,7 @@ static void test_sjis_utf8tosb(int index) { int length = data[i].length == -1 ? (int) strlen(data[i].data) : data[i].length; size_t ret_length = length; - ret = sjis_utf8tosb(data[i].eci, data[i].data, &ret_length, jisdata, data[i].full_multibyte); + ret = sjis_utf8tosb(data[i].eci, (unsigned char *) data[i].data, &ret_length, jisdata, data[i].full_multibyte); assert_equal(ret, data[i].ret, "i:%d ret %d != %d\n", i, ret, data[i].ret); if (ret == 0) { assert_equal(ret_length, data[i].ret_length, "i:%d ret_length %zu != %zu\n", i, ret_length, data[i].ret_length); @@ -234,10 +234,9 @@ static void test_sjis_cpy(int index) { testStart(""); - int ret; struct item { int full_multibyte; - unsigned char *data; + char *data; int length; int ret; size_t ret_length; @@ -268,7 +267,7 @@ static void test_sjis_cpy(int index) { int length = data[i].length == -1 ? (int) strlen(data[i].data) : data[i].length; size_t ret_length = length; - sjis_cpy(data[i].data, &ret_length, jisdata, data[i].full_multibyte); + sjis_cpy((unsigned char *) data[i].data, &ret_length, jisdata, data[i].full_multibyte); assert_equal(ret_length, data[i].ret_length, "i:%d ret_length %zu != %zu\n", i, ret_length, data[i].ret_length); for (int j = 0; j < (int) ret_length; j++) { assert_equal(jisdata[j], data[i].expected_jisdata[j], "i:%d jisdata[%d] %04X != %04X\n", i, j, jisdata[j], data[i].expected_jisdata[j]); diff --git a/backend/tests/test_svg.c b/backend/tests/test_svg.c index 78eb54fe..2b8a3c92 100644 --- a/backend/tests/test_svg.c +++ b/backend/tests/test_svg.c @@ -36,53 +36,59 @@ static void test_print(int index, int generate, int debug) { testStart(""); - int have_inkscape = testUtilHaveInkscape(); + 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; + int border_width; int output_options; int show_hrt; int option_1; int option_2; - unsigned char *data; + char *data; char *composite; char *expected_file; }; struct item data[] = { - /* 0*/ { BARCODE_CODE128, -1, -1, -1, -1, -1, "<>\"&'", "", "../data/svg/code128_amperands.svg" }, - /* 1*/ { BARCODE_CODE128, UNICODE_MODE, BOLD_TEXT, -1, -1, -1, "Égjpqy", "", "../data/svg/code128_egrave_bold.svg" }, - /* 2*/ { BARCODE_CODE128, UNICODE_MODE, BOLD_TEXT | BARCODE_BOX, -1, -1, -1, "Égjpqy", "", "../data/svg/code128_egrave_bold_box3.svg" }, - /* 3*/ { BARCODE_GS1_128_CC, -1, -1, -1, 3, -1, "[00]030123456789012340", "[02]13012345678909[37]24[10]1234567ABCDEFG", "../data/svg/gs1_128_cc_fig12.svg" }, - /* 4*/ { BARCODE_CODABLOCKF, -1, -1, -1, 3, -1, "AAAAAAAAA", "", "../data/svg/codablockf_3rows.svg" }, - /* 5*/ { BARCODE_EANX, -1, -1, -1, -1, -1, "9771384524017+12", "", "../data/svg/ean13_2addon_ggs_5.2.2.5.1-2.svg" }, - /* 6*/ { BARCODE_EANX, -1, -1, -1, -1, -1, "9780877799306+54321", "", "../data/svg/ean13_5addon_ggs_5.2.2.5.2-2.svg" }, - /* 7*/ { BARCODE_EANX_CC, -1, -1, -1, 1, -1, "123456789012+12", "[91]123456789012345678901", "../data/svg/ean13_cc_2addon_cca_4x4.svg" }, - /* 8*/ { BARCODE_EANX_CC, -1, -1, -1, 2, -1, "123456789012+54321", "[91]1234567890", "../data/svg/ean13_cc_5addon_ccb_3x4.svg" }, - /* 9*/ { BARCODE_EANX_CC, -1, -1, 0, 2, -1, "123456789012+54321", "[91]1234567890", "../data/svg/ean13_cc_5addon_ccb_3x4_notext.svg" }, - /* 10*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, "012345678905+24", "", "../data/svg/upca_2addon_ggs_5.2.6.6-5.svg" }, - /* 11*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, "614141234417+12345", "", "../data/svg/upca_5addon.svg" }, - /* 12*/ { BARCODE_UPCA, -1, BARCODE_BIND, -1, -1, -1, "614141234417+12345", "", "../data/svg/upca_5addon_bind3.svg" }, - /* 13*/ { BARCODE_UPCA, -1, SMALL_TEXT | BOLD_TEXT, -1, -1, -1, "614141234417+12345", "", "../data/svg/upca_5addon_small_bold.svg" }, - /* 14*/ { BARCODE_UPCA_CC, -1, -1, -1, 1, -1, "12345678901+12", "[91]123456789", "../data/svg/upca_cc_2addon_cca_3x4.svg" }, - /* 15*/ { BARCODE_UPCA_CC, -1, -1, -1, 2, -1, "12345678901+12121", "[91]1234567890123", "../data/svg/upca_cc_5addon_ccb_4x4.svg" }, - /* 16*/ { BARCODE_UPCA_CC, -1, -1, 0, 2, -1, "12345678901+12121", "[91]1234567890123", "../data/svg/upca_cc_5addon_ccb_4x4_notext.svg" }, - /* 17*/ { BARCODE_UPCA_CC, -1, BARCODE_BIND, -1, 2, -1, "12345678901+12121", "[91]1234567890123", "../data/svg/upca_cc_5addon_ccb_4x4_bind3.svg" }, - /* 18*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, "1234567+12", "", "../data/svg/upce_2addon.svg" }, - /* 19*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, "1234567+12345", "", "../data/svg/upce_5addon.svg" }, - /* 20*/ { BARCODE_UPCE, -1, -1, 0, -1, -1, "1234567+12345", "", "../data/svg/upce_5addon_notext.svg" }, - /* 21*/ { BARCODE_UPCE_CC, -1, -1, -1, 1, -1, "0654321+89", "[91]1", "../data/svg/upce_cc_2addon_cca_5x2.svg" }, - /* 22*/ { BARCODE_UPCE_CC, -1, -1, -1, 2, -1, "1876543+56789", "[91]12345", "../data/svg/upce_cc_5addon_ccb_8x2.svg" }, - /* 23*/ { BARCODE_UPCE_CC, -1, -1, 0, 2, -1, "1876543+56789", "[91]12345", "../data/svg/upce_cc_5addon_ccb_8x2_notext.svg" }, - /* 24*/ { BARCODE_EANX, -1, -1, -1, -1, -1, "1234567+12", "", "../data/svg/ean8_2addon.svg" }, - /* 25*/ { BARCODE_EANX, -1, -1, -1, -1, -1, "1234567+12345", "", "../data/svg/ean8_5addon.svg" }, - /* 26*/ { BARCODE_EANX_CC, -1, -1, -1, 1, -1, "9876543+65", "[91]1234567", "../data/svg/ean8_cc_2addon_cca_4x3.svg" }, - /* 27*/ { BARCODE_EANX_CC, -1, -1, -1, 2, -1, "9876543+74083", "[91]123456789012345678", "../data/svg/ean8_cc_5addon_ccb_8x3.svg" }, - /* 28*/ { BARCODE_EANX, -1, -1, -1, -1, -1, "12345", "", "../data/svg/ean5.svg" }, - /* 29*/ { BARCODE_EANX, -1, -1, -1, -1, -1, "12", "", "../data/svg/ean2.svg" }, - /* 30*/ { BARCODE_CODE39, -1, SMALL_TEXT, -1, -1, -1, "123", "", "../data/svg/code39_small.svg" }, - /* 31*/ { BARCODE_POSTNET, -1, -1, -1, -1, -1, "12345", "", "../data/svg/postnet_zip.svg" }, + /* 0*/ { BARCODE_CODE128, -1, -1, -1, -1, -1, -1, "<>\"&'", "", "../data/svg/code128_amperands.svg" }, + /* 1*/ { BARCODE_CODE128, UNICODE_MODE, -1, BOLD_TEXT, -1, -1, -1, "Égjpqy", "", "../data/svg/code128_egrave_bold.svg" }, + /* 2*/ { BARCODE_CODE128, UNICODE_MODE, 3, BOLD_TEXT | BARCODE_BOX, -1, -1, -1, "Égjpqy", "", "../data/svg/code128_egrave_bold_box3.svg" }, + /* 3*/ { BARCODE_GS1_128_CC, -1, -1, -1, -1, 3, -1, "[00]030123456789012340", "[02]13012345678909[37]24[10]1234567ABCDEFG", "../data/svg/gs1_128_cc_fig12.svg" }, + /* 4*/ { BARCODE_CODABLOCKF, -1, -1, -1, -1, 3, -1, "AAAAAAAAA", "", "../data/svg/codablockf_3rows.svg" }, + /* 5*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, "9771384524017+12", "", "../data/svg/ean13_2addon_ggs_5.2.2.5.1-2.svg" }, + /* 6*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, "9780877799306+54321", "", "../data/svg/ean13_5addon_ggs_5.2.2.5.2-2.svg" }, + /* 7*/ { BARCODE_EANX_CC, -1, -1, -1, -1, 1, -1, "123456789012+12", "[91]123456789012345678901", "../data/svg/ean13_cc_2addon_cca_4x4.svg" }, + /* 8*/ { BARCODE_EANX_CC, -1, -1, -1, -1, 2, -1, "123456789012+54321", "[91]1234567890", "../data/svg/ean13_cc_5addon_ccb_3x4.svg" }, + /* 9*/ { BARCODE_EANX_CC, -1, -1, -1, 0, 2, -1, "123456789012+54321", "[91]1234567890", "../data/svg/ean13_cc_5addon_ccb_3x4_notext.svg" }, + /* 10*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, -1, "012345678905+24", "", "../data/svg/upca_2addon_ggs_5.2.6.6-5.svg" }, + /* 11*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, -1, "614141234417+12345", "", "../data/svg/upca_5addon.svg" }, + /* 12*/ { BARCODE_UPCA, -1, 3, BARCODE_BIND, -1, -1, -1, "614141234417+12345", "", "../data/svg/upca_5addon_bind3.svg" }, + /* 13*/ { BARCODE_UPCA, -1, -1, SMALL_TEXT | BOLD_TEXT, -1, -1, -1, "614141234417+12345", "", "../data/svg/upca_5addon_small_bold.svg" }, + /* 14*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, 1, -1, "12345678901+12", "[91]123456789", "../data/svg/upca_cc_2addon_cca_3x4.svg" }, + /* 15*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, 2, -1, "12345678901+12121", "[91]1234567890123", "../data/svg/upca_cc_5addon_ccb_4x4.svg" }, + /* 16*/ { BARCODE_UPCA_CC, -1, -1, -1, 0, 2, -1, "12345678901+12121", "[91]1234567890123", "../data/svg/upca_cc_5addon_ccb_4x4_notext.svg" }, + /* 17*/ { BARCODE_UPCA_CC, -1, 3, BARCODE_BIND, -1, 2, -1, "12345678901+12121", "[91]1234567890123", "../data/svg/upca_cc_5addon_ccb_4x4_bind3.svg" }, + /* 18*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, -1, "1234567+12", "", "../data/svg/upce_2addon.svg" }, + /* 19*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, -1, "1234567+12345", "", "../data/svg/upce_5addon.svg" }, + /* 20*/ { BARCODE_UPCE, -1, -1, -1, 0, -1, -1, "1234567+12345", "", "../data/svg/upce_5addon_notext.svg" }, + /* 21*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, 1, -1, "0654321+89", "[91]1", "../data/svg/upce_cc_2addon_cca_5x2.svg" }, + /* 22*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, 2, -1, "1876543+56789", "[91]12345", "../data/svg/upce_cc_5addon_ccb_8x2.svg" }, + /* 23*/ { BARCODE_UPCE_CC, -1, -1, -1, 0, 2, -1, "1876543+56789", "[91]12345", "../data/svg/upce_cc_5addon_ccb_8x2_notext.svg" }, + /* 24*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, "1234567+12", "", "../data/svg/ean8_2addon.svg" }, + /* 25*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, "1234567+12345", "", "../data/svg/ean8_5addon.svg" }, + /* 26*/ { BARCODE_EANX_CC, -1, -1, -1, -1, 1, -1, "9876543+65", "[91]1234567", "../data/svg/ean8_cc_2addon_cca_4x3.svg" }, + /* 27*/ { BARCODE_EANX_CC, -1, -1, -1, -1, 2, -1, "9876543+74083", "[91]123456789012345678", "../data/svg/ean8_cc_5addon_ccb_8x3.svg" }, + /* 28*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, "12345", "", "../data/svg/ean5.svg" }, + /* 29*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, "12", "", "../data/svg/ean2.svg" }, + /* 30*/ { BARCODE_CODE39, -1, -1, SMALL_TEXT, -1, -1, -1, "123", "", "../data/svg/code39_small.svg" }, + /* 31*/ { BARCODE_POSTNET, -1, -1, -1, -1, -1, -1, "12345", "", "../data/svg/postnet_zip.svg" }, }; int data_size = ARRAY_SIZE(data); @@ -110,8 +116,8 @@ static void test_print(int index, int generate, int debug) { if (data[i].show_hrt != -1) { symbol->show_hrt = data[i].show_hrt; } - if (data[i].output_options & (BARCODE_BOX | BARCODE_BIND)) { - symbol->border_width = 3; + if (data[i].border_width != -1) { + symbol->border_width = data[i].border_width; } if (strlen(data[i].composite)) { text = data[i].composite; @@ -121,7 +127,7 @@ static void test_print(int index, int generate, int debug) { } int text_length = strlen(text); - ret = ZBarcode_Encode(symbol, text, text_length); + ret = ZBarcode_Encode(symbol, (unsigned char *) text, text_length); assert_zero(ret, "i:%d %s ZBarcode_Encode ret %d != 0 %s\n", i, testUtilBarcodeName(data[i].symbology), ret, symbol->errtxt); strcpy(symbol->outfile, svg); @@ -129,14 +135,18 @@ static void test_print(int index, int generate, int debug) { assert_zero(ret, "i:%d %s ZBarcode_Print %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret); if (generate) { - printf(" /*%3d*/ { %s, %s, %s, %d, %d, %d, \"%s\", \"%s\", \"%s\" },\n", - i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), testUtilOutputOptionsName(data[i].output_options), + printf(" /*%3d*/ { %s, %s, %d, %s, %d, %d, %d, \"%s\", \"%s\", \"%s\" },\n", + i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), data[i].border_width, testUtilOutputOptionsName(data[i].output_options), data[i].show_hrt, data[i].option_1, data[i].option_2, testUtilEscape(data[i].data, length, escaped, escaped_size), data[i].composite, data[i].expected_file); ret = rename(symbol->outfile, data[i].expected_file); assert_zero(ret, "i:%d rename(%s, %s) ret %d != 0\n", i, symbol->outfile, data[i].expected_file, ret); - if (have_inkscape) { - ret = testUtilVerifyInkscape(data[i].expected_file, debug); - assert_zero(ret, "i:%d %s inkscape %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), data[i].expected_file, ret); + if (have_libreoffice) { + ret = testUtilVerifyLibreOffice(data[i].expected_file, debug); + assert_zero(ret, "i:%d %s libreoffice %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), data[i].expected_file, ret); + } + if (have_vnu) { + ret = testUtilVerifyVnu(data[i].expected_file, debug); // Very slow + assert_zero(ret, "i:%d %s vnu libreoffice %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), data[i].expected_file, ret); } } else { assert_nonzero(testUtilExists(symbol->outfile), "i:%d testUtilExists(%s) == 0\n", i, symbol->outfile); diff --git a/backend/tests/test_telepen.c b/backend/tests/test_telepen.c index 6c83d87c..148040fb 100644 --- a/backend/tests/test_telepen.c +++ b/backend/tests/test_telepen.c @@ -38,7 +38,7 @@ static void test_large(int index, int debug) { int ret; struct item { int symbology; - unsigned char *pattern; + char *pattern; int length; int ret; int expected_rows; @@ -67,7 +67,7 @@ static void test_large(int index, int debug) { int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data_buf, data[i].length, debug); - ret = ZBarcode_Encode(symbol, data_buf, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (ret < 5) { @@ -88,10 +88,10 @@ static void test_hrt(int index, int debug) { int ret; struct item { int symbology; - unsigned char *data; + char *data; int length; - unsigned char *expected; + char *expected; }; // s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<")) struct item data[] = { @@ -106,8 +106,6 @@ static void test_hrt(int index, int debug) { }; int data_size = ARRAY_SIZE(data); - char *text; - for (int i = 0; i < data_size; i++) { if (index != -1 && i != index) continue; @@ -117,10 +115,10 @@ static void test_hrt(int index, int debug) { int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, data[i].length, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 %s\n", i, ret, symbol->errtxt); - assert_zero(strcmp(symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->text, data[i].expected); + assert_zero(strcmp((char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->text, data[i].expected); ZBarcode_Delete(symbol); } @@ -135,7 +133,7 @@ static void test_input(int index, int debug) { int ret; struct item { int symbology; - unsigned char *data; + char *data; int length; int ret; int expected_rows; @@ -164,7 +162,7 @@ static void test_input(int index, int debug) { int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, data[i].length, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (ret < 5) { @@ -189,7 +187,7 @@ static void test_encode(int index, int generate, int debug) { int ret; struct item { int symbology; - unsigned char *data; + char *data; int length; int ret; @@ -242,7 +240,7 @@ static void test_encode(int index, int generate, int debug) { int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, data[i].length, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { @@ -285,7 +283,7 @@ static void test_fuzz(int index, int debug) { int ret; struct item { int symbology; - unsigned char *data; + char *data; int length; int ret; }; @@ -314,7 +312,7 @@ static void test_fuzz(int index, int debug) { int length = data[i].length == -1 ? (int) strlen(data[i].data) : data[i].length; - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); ZBarcode_Delete(symbol); diff --git a/backend/tests/test_tif.c b/backend/tests/test_tif.c index 96d85f83..344370a4 100644 --- a/backend/tests/test_tif.c +++ b/backend/tests/test_tif.c @@ -47,7 +47,7 @@ static void test_pixel_plot(int index, int debug) { struct item { int width; int height; - unsigned char *pattern; + char *pattern; int repeat; }; // s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<")) @@ -84,8 +84,6 @@ static void test_pixel_plot(int index, int debug) { int data_size = ARRAY_SIZE(data); char *tif = "out.tif"; - char escaped[1024]; - int escaped_size = 1024; char data_buf[2731 * 4 + 1]; @@ -112,7 +110,7 @@ static void test_pixel_plot(int index, int debug) { } assert_equal(size, (int) strlen(data_buf), "i:%d tif_pixel_plot size %d != strlen(data_buf) %d\n", i, size, (int) strlen(data_buf)); - symbol->bitmap = data_buf; + symbol->bitmap = (unsigned char *) data_buf; ret = tif_pixel_plot(symbol, data_buf); assert_zero(ret, "i:%d tif_pixel_plot ret %d != 0 (%s)\n", i, ret, symbol->errtxt); diff --git a/backend/tests/test_ultra.c b/backend/tests/test_ultra.c index 067affff..83f7b035 100644 --- a/backend/tests/test_ultra.c +++ b/backend/tests/test_ultra.c @@ -41,7 +41,7 @@ static void test_input(int index, int generate, int debug) { int eci; int option_1; int option_3; - unsigned char *data; + char *data; int ret; char *expected; char *comment; @@ -108,7 +108,7 @@ static void test_input(int index, int generate, int debug) { int length = testUtilSetSymbol(symbol, BARCODE_ULTRA, data[i].input_mode, data[i].eci, data[i].option_1, -1, data[i].option_3, -1 /*output_options*/, data[i].data, -1, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d\n", i, ret, data[i].ret); if (generate) { @@ -137,7 +137,7 @@ static void test_encode(int index, int generate, int debug) { int eci; int option_1; int option_3; - unsigned char *data; + char *data; int ret; int expected_rows; @@ -433,7 +433,7 @@ static void test_encode(int index, int generate, int debug) { int length = testUtilSetSymbol(symbol, BARCODE_ULTRA, data[i].input_mode, data[i].eci, data[i].option_1, -1, data[i].option_3, -1 /*output_options*/, data[i].data, -1, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { diff --git a/backend/tests/test_upcean.c b/backend/tests/test_upcean.c index 4e974c05..a80a9812 100644 --- a/backend/tests/test_upcean.c +++ b/backend/tests/test_upcean.c @@ -38,7 +38,7 @@ static void test_upce_length(int index, int debug) { int ret; struct item { int symbology; - unsigned char *data; + char *data; int ret; }; // s/\/\*[ 0-9]*\*\//\=printf("\/*%2d*\/", line(".") - line("'<")) @@ -73,7 +73,7 @@ static void test_upce_length(int index, int debug) { int length = strlen(data[i].data); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); ZBarcode_Delete(symbol); @@ -90,7 +90,7 @@ static void test_upca_print(int index, int debug) { int ret; struct item { int symbology; - unsigned char *data; + char *data; int ret; }; // s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<")) @@ -111,7 +111,7 @@ static void test_upca_print(int index, int debug) { int length = strlen(data[i].data); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); strcpy(symbol->outfile, "out.gif"); @@ -132,7 +132,7 @@ static void test_isbn(int index, int debug) { int ret; struct item { - unsigned char *data; + char *data; int ret_encode; int ret_vector; }; @@ -196,7 +196,7 @@ static void test_isbn(int index, int debug) { int length = strlen(data[i].data); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret_encode, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret_encode, symbol->errtxt); if (data[i].ret_vector != -1) { @@ -217,7 +217,7 @@ static void test_vector_same(int index, int debug) { int ret; struct item { int symbology; - unsigned char *data; + char *data; int ret_encode; int ret_vector; }; @@ -244,7 +244,7 @@ static void test_vector_same(int index, int debug) { int length = strlen(data[i].data); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret_encode, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret_encode, symbol->errtxt); ret = ZBarcode_Buffer_Vector(symbol, 0); @@ -283,7 +283,7 @@ static void test_encode(int index, int generate, int debug) { struct item { int symbology; int option_2; - unsigned char *data; + char *data; int ret; int expected_rows; @@ -415,7 +415,7 @@ static void test_encode(int index, int generate, int debug) { int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (generate) { @@ -457,7 +457,7 @@ static void test_fuzz(int index, int debug) { int ret; struct item { int symbology; - unsigned char *data; + char *data; int length; int ret; }; @@ -491,7 +491,7 @@ static void test_fuzz(int index, int debug) { length = strlen(data[i].data); } - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); ZBarcode_Delete(symbol); diff --git a/backend/tests/test_vector.c b/backend/tests/test_vector.c index 0e0097a4..ef13283f 100644 --- a/backend/tests/test_vector.c +++ b/backend/tests/test_vector.c @@ -70,7 +70,7 @@ static void test_options(int index, int debug) { char *fgcolour; char *bgcolour; int rotate_angle; - unsigned char *data; + char *data; int ret; int expected_rows; int expected_width; @@ -103,7 +103,7 @@ static void test_options(int index, int debug) { strcpy(symbol->bgcolour, data[i].bgcolour); } - ret = ZBarcode_Encode_and_Buffer_Vector(symbol, data[i].data, length, data[i].rotate_angle); + ret = ZBarcode_Encode_and_Buffer_Vector(symbol, (unsigned char *) data[i].data, length, data[i].rotate_angle); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (ret < 5) { @@ -128,7 +128,7 @@ static void test_buffer_vector(int index, int generate, int debug) { int ret; struct item { int symbology; - unsigned char *data; + char *data; char *composite; int expected_height; @@ -289,7 +289,7 @@ static void test_buffer_vector(int index, int generate, int debug) { } int length = strlen(text); - ret = ZBarcode_Encode(symbol, text, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) text, length); assert_zero(ret, "i:%d ZBarcode_Encode(%d) ret %d != 0 %s\n", i, data[i].symbology, ret, symbol->errtxt); ret = ZBarcode_Buffer_Vector(symbol, 0); @@ -324,7 +324,7 @@ static void test_upcean_hrt(int index, int debug) { struct item { int symbology; int show_hrt; - unsigned char *data; + char *data; int ret; int expected_height; @@ -395,7 +395,7 @@ static void test_upcean_hrt(int index, int debug) { int length = strlen(data[i].data); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_zero(ret, "i:%d ZBarcode_Encode(%d) ret %d != 0 %s\n", i, data[i].symbology, ret, symbol->errtxt); ret = ZBarcode_Buffer_Vector(symbol, 0); @@ -446,7 +446,7 @@ static void test_row_separator(int index, int debug) { int border_width; int option_1; int option_3; - unsigned char *data; + char *data; int ret; int expected_height; @@ -484,7 +484,7 @@ static void test_row_separator(int index, int debug) { symbol->border_width = data[i].border_width; } - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_zero(ret, "i:%d ZBarcode_Encode(%d) ret %d != 0 %s\n", i, data[i].symbology, ret, symbol->errtxt); ret = ZBarcode_Buffer_Vector(symbol, 0); @@ -514,8 +514,8 @@ static void test_stacking(int index, int debug) { int output_options; int option_1; int option_3; - unsigned char *data; - unsigned char *data2; + char *data; + char *data2; int expected_height; int expected_rows; @@ -544,11 +544,11 @@ static void test_stacking(int index, int debug) { assert_nonnull(symbol, "Symbol not created\n"); int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, data[i].option_1, -1, data[i].option_3, data[i].output_options, data[i].data, -1, debug); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_zero(ret, "i:%d ret %d != zero\n", i, ret); int length2 = strlen(data[i].data2); - ret = ZBarcode_Encode(symbol, data[i].data2, length2); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data2, length2); assert_zero(ret, "i:%d ret %d != zero\n", i, ret); ret = ZBarcode_Buffer(symbol, 0); @@ -593,7 +593,7 @@ static void test_output_options(int index, int debug) { int whitespace_width; int border_width; int output_options; - unsigned char *data; + char *data; int ret; int expected_height; @@ -666,7 +666,7 @@ static void test_output_options(int index, int debug) { symbol->border_width = data[i].border_width; } - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_zero(ret, "i:%d ZBarcode_Encode(%d) ret %d != 0 %s\n", i, data[i].symbology, ret, symbol->errtxt); ret = ZBarcode_Buffer_Vector(symbol, 0); @@ -713,7 +713,7 @@ static void test_noncomposite_string_x(int index, int debug) { int ret; struct item { int symbology; - unsigned char *data; + char *data; int expected_width; float expected_string_x; @@ -739,7 +739,7 @@ static void test_noncomposite_string_x(int index, int debug) { int length = strlen(data[i].data); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_zero(ret, "i:%d ZBarcode_Encode(%d) ret %d != 0 %s\n", i, data[i].symbology, ret, symbol->errtxt); ret = ZBarcode_Buffer_Vector(symbol, 0); @@ -765,7 +765,7 @@ static void test_upcean_whitespace_width(int index, int debug) { int ret; struct item { int symbology; - unsigned char *data; + char *data; int whitespace_width; int expected_width; @@ -799,7 +799,7 @@ static void test_upcean_whitespace_width(int index, int debug) { int length = strlen(data[i].data); - ret = ZBarcode_Encode(symbol, data[i].data, length); + ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_zero(ret, "i:%d ZBarcode_Encode(%d) ret %d != 0 %s\n", i, data[i].symbology, ret, symbol->errtxt); ret = ZBarcode_Buffer_Vector(symbol, 0); diff --git a/backend/tests/testcommon.c b/backend/tests/testcommon.c index 208edf35..ea71faf1 100644 --- a/backend/tests/testcommon.c +++ b/backend/tests/testcommon.c @@ -1397,8 +1397,7 @@ int testUtilHaveIdentify() { } int testUtilVerifyIdentify(char *filename, int debug) { - int ret; - char buf[512 + 128]; + char cmd[512 + 128]; if (strlen(filename) > 512) { return -1; @@ -1407,36 +1406,90 @@ int testUtilVerifyIdentify(char *filename, int debug) { if (debug & ZINT_DEBUG_TEST_PRINT) { // Verbose very noisy though so for quick check just return default output if (debug & ZINT_DEBUG_TEST_LESS_NOISY) { - sprintf(buf, "identify %s", filename); + sprintf(cmd, "identify %s", filename); } else { - sprintf(buf, "identify -verbose %s", filename); + sprintf(cmd, "identify -verbose %s", filename); } } else { - sprintf(buf, "identify -verbose %s > /dev/null", filename); + sprintf(cmd, "identify -verbose %s > /dev/null", filename); } - return system(buf); + return system(cmd); } -int testUtilHaveInkscape() { - return system("inkscape -z -V > /dev/null") == 0; +int testUtilHaveLibreOffice() { + return system("libreoffice --version > /dev/null") == 0; } -int testUtilVerifyInkscape(char *filename, int debug) { - int ret; - char buf[512 + 128]; +int testUtilVerifyLibreOffice(char *filename, int debug) { + char cmd[512 + 128]; + char svg[512]; + char *slash, *dot; + char buf[32768]; + char *b = buf, *be = buf + sizeof(buf) - 1; + FILE *fp; + int len; + /* Hack to read SVG produced by LibreOffice and search for 'x="-32767"' which indicates it didn't load barcode file */ if (strlen(filename) > 512) { return -1; } - if (debug & ZINT_DEBUG_TEST_PRINT) { - sprintf(buf, "inkscape -z -f %s", filename); // Prints nothing unless bad - printf("%s\n", buf); + slash = strrchr(filename, '/'); + if (slash) { + strcpy(svg, slash + 1); } else { - sprintf(buf, "inkscape -z -f %s > /dev/null", filename); + strcpy(svg, filename); + } + dot = strrchr(svg, '.'); + if (dot) { + strcpy(dot, ".svg"); + } else { + strcat(svg, ".svg"); + } + if (strcmp(svg, filename) == 0) { + fprintf(stderr, "testUtilVerifyLibreOffice: input '%s' same as svg '%s'\n", filename, svg); + return -1; } - return system(buf); + sprintf(cmd, "libreoffice --convert-to svg %s > /dev/null 2>&1", filename); + if (debug & ZINT_DEBUG_TEST_PRINT) { + printf("%s\n", cmd); + } + if (system(cmd) != 0) { + fprintf(stderr, "testUtilVerifyLibreOffice: failed to run '%s'\n", cmd); + return -1; + } + + fp = fopen(svg, "r"); + if (!fp) { + fprintf(stderr, "testUtilVerifyLibreOffice: failed to open '%s' (%s)\n", svg, cmd); + return -1; + } + while (!feof(fp) && b < be) { + if (fgets(b, be - b, fp) == NULL) { + fprintf(stderr, "testUtilVerifyLibreOffice: failed to get line from '%s' (%s)\n", svg, cmd); + fclose(fp); + return -1; + } + len = (int) strlen(b); + if (len == 0) { + break; + } + b += len; + } + *b = '\0'; + fclose(fp); + + if (strlen(buf) < 1024) { + fprintf(stderr, "testUtilVerifyLibreOffice: failed to get much input from '%s' (%s)\n", svg, cmd); + return -1; + } + if (strstr(buf, "x=\"-32767\"") != NULL) { + return -1; + } + remove(svg); + + return 0; } int testUtilHaveGhostscript() { @@ -1444,17 +1497,38 @@ int testUtilHaveGhostscript() { } int testUtilVerifyGhostscript(char *filename, int debug) { - int ret; + char cmd[512 + 128]; + + if (strlen(filename) > 512) { + return -1; + } + if (debug & ZINT_DEBUG_TEST_PRINT) { + sprintf(cmd, "gs -dNOPAUSE -dBATCH -dNODISPLAY -q %s", filename); // Prints nothing of interest with or without -q unless bad + printf("%s\n", cmd); + } else { + sprintf(cmd, "gs -dNOPAUSE -dBATCH -dNODISPLAY -q %s", filename); + } + + return system(cmd); +} + +/* v.Nu https://github.com/validator/validator + * Needs "$INSTALL_DIR/vnu-runtime-image/bin" in PATH */ +int testUtilHaveVnu() { + return system("vnu --version > /dev/null") == 0; +} + +int testUtilVerifyVnu(char *filename, int debug) { char buf[512 + 128]; if (strlen(filename) > 512) { return -1; } if (debug & ZINT_DEBUG_TEST_PRINT) { - sprintf(buf, "gs -dNOPAUSE -dBATCH -dNODISPLAY -q %s", filename); // Prints nothing of interest with or without -q unless bad + sprintf(buf, "vnu --svg --verbose %s", filename); printf("%s\n", buf); } else { - sprintf(buf, "gs -dNOPAUSE -dBATCH -dNODISPLAY -q %s", filename); + sprintf(buf, "vnu --svg %s", filename); } return system(buf); @@ -1764,7 +1838,6 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int int r, h; int parse; - int composite = is_composite(symbology); int upcean = is_extendable(symbology); int upca = symbology == BARCODE_UPCA || symbology == BARCODE_UPCA_CHK || symbology == BARCODE_UPCA_CC; int addon_posn; @@ -1902,7 +1975,7 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int || symbology == BARCODE_DAFT || symbology == BARCODE_USPS_IMAIL || symbology == BARCODE_AUSPOST || symbology == BARCODE_PHARMA_TWO) { for (r = 0; r < symbol->rows; r++) bwipp_row_height[r] = 1; /* Zap */ if (symbology == BARCODE_KIX) { - to_upper(bwipp_data); + to_upper((unsigned char *) bwipp_data); } else if (symbology == BARCODE_USPS_IMAIL) { char *dash = strchr(bwipp_data, '-'); if (dash) { diff --git a/backend/tests/testcommon.h b/backend/tests/testcommon.h index 505680c1..4d4de826 100644 --- a/backend/tests/testcommon.h +++ b/backend/tests/testcommon.h @@ -106,10 +106,12 @@ int testUtilCmpSvgs(char *svg1, char *svg2); int testUtilCmpEpss(char *eps1, char *eps2); int testUtilHaveIdentify(); int testUtilVerifyIdentify(char *filename, int debug); -int testUtilHaveInkscape(); -int testUtilVerifyInkscape(char *filename, int debug); +int testUtilHaveLibreOffice(); +int testUtilVerifyLibreOffice(char *filename, int debug); int testUtilHaveGhostscript(); int testUtilVerifyGhostscript(char *filename, int debug); +int testUtilHaveVnu(); +int testUtilVerifyVnu(char *filename, int debug); int testUtilCanBwipp(int symbology, int option_1, int option_2, int option_3, int debug); int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int option_2, int option_3, const char *data, int length, const char *primary, char *buffer, int buffer_size); int testUtilBwippCmp(const struct zint_symbol *symbol, char *msg, const char *bwipp_buf, const char *expected); diff --git a/backend/tests/tools/bwipp_dump-barcode.ps.diff b/backend/tests/tools/bwipp_dump-barcode.ps.diff index fe2a392c..cfa936d0 100644 --- a/backend/tests/tools/bwipp_dump-barcode.ps.diff +++ b/backend/tests/tools/bwipp_dump-barcode.ps.diff @@ -1,5 +1,5 @@ ---- ../../../../postscriptbarcode/build/monolithic/barcode.ps 2020-09-18 02:41:06.166708679 +0100 -+++ ../tools/bwipp_dump.ps 2020-09-18 03:56:06.144846176 +0100 +--- ../../../../postscriptbarcode/build/monolithic/barcode.ps 2020-10-02 20:03:59.411955883 +0100 ++++ ../tools/bwipp_dump.ps 2020-10-03 01:47:30.454223200 +0100 @@ -29,6 +29,8 @@ % CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS % IN THE SOFTWARE. @@ -9,7 +9,7 @@ % --BEGIN TEMPLATE-- % --BEGIN RESOURCE preamble-- -@@ -25403,34 +25405,80 @@ +@@ -25404,34 +25406,80 @@ pop } ifelse @@ -109,7 +109,7 @@ end -@@ -25489,7 +25537,7 @@ +@@ -25490,7 +25538,7 @@ pop } ifelse @@ -118,7 +118,7 @@ % Get the result of encoding with ean8 and gs1-cc options (lintype) (ean8) put -@@ -25497,29 +25545,75 @@ +@@ -25498,29 +25546,75 @@ options (dontdraw) true put % Plot the linear part @@ -214,7 +214,7 @@ end -@@ -25578,34 +25672,80 @@ +@@ -25579,34 +25673,80 @@ pop } ifelse @@ -314,7 +314,7 @@ end -@@ -25679,34 +25819,80 @@ +@@ -25680,34 +25820,80 @@ /opt options >> def @@ -414,7 +414,7 @@ end -@@ -25765,7 +25951,7 @@ +@@ -25766,7 +25952,7 @@ pop } ifelse @@ -423,7 +423,7 @@ options (lintype) (databaromni) put options (linkage) true put -@@ -25776,7 +25962,7 @@ +@@ -25777,7 +25963,7 @@ linear options //databaromni exec dup (sbs) get /linsbs exch def dup (bhs) get 0 get 72 mul /linheight exch def @@ -432,7 +432,7 @@ % Plot the separator /sepfinder { -@@ -25807,20 +25993,66 @@ +@@ -25808,20 +25994,66 @@ sep 0 [0 0 0] putinterval sep sep length 4 sub [0 0 0 0] putinterval 18 sepfinder 64 sepfinder @@ -511,7 +511,7 @@ end -@@ -25878,7 +26110,7 @@ +@@ -25879,7 +26111,7 @@ pop } ifelse @@ -520,7 +520,7 @@ options (lintype) (databarstacked) put options (linkage) true put -@@ -25889,7 +26121,7 @@ +@@ -25890,7 +26122,7 @@ linear options //databarstacked exec dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def dup (pixy) get /linheight exch def @@ -529,7 +529,7 @@ % Plot the separator /sepfinder { -@@ -25917,20 +26149,52 @@ +@@ -25918,20 +26150,52 @@ sep 0 [ 0 0 0 0 ] putinterval sep sep length 4 sub [ 0 0 0 0 ] putinterval 18 sepfinder @@ -594,7 +594,7 @@ end -@@ -25988,7 +26252,7 @@ +@@ -25989,7 +26253,7 @@ pop } ifelse @@ -603,7 +603,7 @@ options (lintype) (databarstackedomni) put options (linkage) true put -@@ -25999,7 +26263,7 @@ +@@ -26000,7 +26264,7 @@ linear options //databarstackedomni exec dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def dup (pixy) get /linheight exch def @@ -612,7 +612,7 @@ % Plot the separator /sepfinder { -@@ -26027,20 +26291,52 @@ +@@ -26028,20 +26292,52 @@ sep 0 [ 0 0 0 0 ] putinterval sep sep length 4 sub [ 0 0 0 0 ] putinterval 18 sepfinder @@ -677,7 +677,7 @@ end -@@ -26213,7 +26509,7 @@ +@@ -26214,7 +26510,7 @@ pop } ifelse @@ -686,7 +686,7 @@ options (lintype) (databarlimited) put options (linkage) true put -@@ -26224,7 +26520,7 @@ +@@ -26225,7 +26521,7 @@ linear options //databarlimited exec dup (sbs) get /linsbs exch def dup (bhs) get 0 get 72 mul /linheight exch def @@ -695,7 +695,7 @@ % Plot the separator mark -@@ -26232,22 +26528,68 @@ +@@ -26233,22 +26529,68 @@ counttomark 1 sub array astore /sep exch def pop pop sep 0 [0 0 0] putinterval sep sep length 9 sub [0 0 0 0 0 0 0 0 0] putinterval % 4 + 5 right guard spaces @@ -778,7 +778,7 @@ end -@@ -26306,7 +26648,7 @@ +@@ -26307,7 +26649,7 @@ pop } ifelse @@ -787,7 +787,7 @@ options (lintype) (databarexpanded) put options (linkage) true put -@@ -26317,7 +26659,7 @@ +@@ -26318,7 +26660,7 @@ linear options //databarexpanded exec dup (sbs) get /linsbs exch def dup (bhs) get 0 get 72 mul /linheight exch def @@ -796,7 +796,7 @@ % Plot the separator /sepfinder { -@@ -26346,20 +26688,60 @@ +@@ -26347,20 +26689,60 @@ 18 98 bot length 13 sub {} for 69 98 bot length 13 sub {} for ] {sepfinder} forall @@ -869,7 +869,7 @@ end -@@ -26417,7 +26799,7 @@ +@@ -26418,7 +26800,7 @@ pop } ifelse @@ -878,7 +878,7 @@ options (lintype) (databarexpandedstacked) put options (linkage) true put -@@ -26428,7 +26810,7 @@ +@@ -26429,7 +26811,7 @@ linear options //databarexpandedstacked exec dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def dup (pixy) get /linheight exch def @@ -887,7 +887,7 @@ % Plot the separator /sepfinder { -@@ -26448,27 +26830,55 @@ +@@ -26449,27 +26831,55 @@ } for } bind def /sep [ bot {1 exch sub} forall ] def @@ -957,7 +957,7 @@ end -@@ -26527,7 +26937,7 @@ +@@ -26528,7 +26938,7 @@ pop } ifelse @@ -966,7 +966,7 @@ options (inkspread) (0) put options (dontdraw) true put -@@ -26554,35 +26964,87 @@ +@@ -26555,35 +26965,87 @@ linear << options {} forall >> //gs1-128 exec dup (sbs) get /linsbs exch def dup (bhs) get 0 get 72 mul /linheight exch def @@ -1068,7 +1068,7 @@ end -@@ -27880,3 +28342,176 @@ +@@ -27881,3 +28343,176 @@ % --END ENCODER hibcazteccode-- % --END TEMPLATE-- diff --git a/backend/tests/tools/bwipp_dump.ps.tar.xz b/backend/tests/tools/bwipp_dump.ps.tar.xz index e6df65e2..38fc9caa 100644 Binary files a/backend/tests/tools/bwipp_dump.ps.tar.xz and b/backend/tests/tools/bwipp_dump.ps.tar.xz differ diff --git a/backend/zint.h b/backend/zint.h index 99a27952..ae27702d 100644 --- a/backend/zint.h +++ b/backend/zint.h @@ -48,7 +48,7 @@ extern "C" { float width; /* Suggested string width, may be 0 if none recommended */ int length; int rotation; - int halign; /* Horizontal alignment: 0 for centre (middle, 1 for left (start), 2 for right (end) */ + int halign; /* Horizontal alignment: 0 for centre (middle), 1 for left (start), 2 for right (end) */ unsigned char *text; struct zint_vector_string *next; /* Pointer to next character */ }; @@ -274,7 +274,7 @@ extern "C" { #define ZINT_WARN_NONCOMPLIANT 4 #define ZINT_ERROR 5 /* Warn/error marker, not returned */ #define ZINT_ERROR_TOO_LONG 5 -#define ZINT_ERROR_INVALID_DATA 6 +#define ZINT_ERROR_INVALID_DATA 6 #define ZINT_ERROR_INVALID_CHECK 7 #define ZINT_ERROR_INVALID_OPTION 8 #define ZINT_ERROR_ENCODING_PROBLEM 9 diff --git a/backend_tcl/zint.c b/backend_tcl/zint.c index e04eef44..59bf724b 100644 --- a/backend_tcl/zint.c +++ b/backend_tcl/zint.c @@ -189,7 +189,7 @@ static char *s_code_list[] = { "UPC-A+Check", "UPC-E", "UPC-E+Check", - "Postnet", + "POSTNET", "MSIPlessey", "FIM", "Logmars", @@ -217,7 +217,7 @@ static char *s_code_list[] = { "GS1DataBarStacked", "GS1DataBarSstackedOmni", "GS1DataBarExpandedStacked", - "Planet", + "PLANET", "DPDCode", "MicroPDF417", "USPSIntelligentMail", diff --git a/docs/manual.txt b/docs/manual.txt index f0817730..07931114 100644 --- a/docs/manual.txt +++ b/docs/manual.txt @@ -284,7 +284,7 @@ Numeric Value | Barcode Name 35 | UPC-A + Check Digit 37 | UPC-E 38 | UPC-E + Check Digit -40 | PostNet +40 | POSTNET 47 | MSI Plessey 49 | FIM 50 | LOGMARS @@ -946,7 +946,7 @@ plotted in green. int main(int argc, char **argv) { struct zint_symbol *my_symbol; - my_symbol = ZBarcode_Create(); + my_symbol = ZBarcode_Create(); strcpy(my_symbol->fgcolour, "00ff00"); my_symbol->height = 400; ZBarcode_Encode_and_Print(my_symbol, argv[1], 0, 0); @@ -982,7 +982,7 @@ ZINT_WARN_NONCOMPLIANT | The symbol was created but is not compliant with | (e.g. height, GS1 AI data lengths). ZINT_ERROR | Marks the divide between warnings and errors. | For return values greater than or equal to - | this no symbol is generated. + | this no symbol is generated. ZINT_ERROR_TOO_LONG | The input data is too long or too short for the | selected symbology. No symbol has been | generated. @@ -1081,7 +1081,7 @@ Value | 35 | BARCODE_UPCA_CHK | UPC-A + Check Digit 37 | BARCODE_UPCE | UPC-E 38 | BARCODE_UPCE_CHK | UPC-E + Check Digit -40 | BARCODE_POSTNET | PostNet +40 | BARCODE_POSTNET | POSTNET 47 | BARCODE_MSI_PLESSEY | MSI Plessey 49 | BARCODE_FIM | FIM 50 | BARCODE_LOGMARS | LOGMARS @@ -1284,7 +1284,7 @@ int ZBarcode_Version(); The version parts are separated by hundreds. For instance, version "2.9.1" is returned as "20901". -[1] This value is ignored for Australia Post 4-State Barcodes, PostNet, PLANET, +[1] This value is ignored for Australia Post 4-State Barcodes, POSTNET, PLANET, USPS Intelligent Mail, RM4SCC, PDF417, Data Matrix, Maxicode, QR Code, GS1 DataBar Stacked, PDF417 and MicroPDF417 - all of which have a fixed height. @@ -1587,8 +1587,8 @@ Latin-1 character set is shown in Appendix A. 6.1.11.2 Code 128 Subset B -------------------------- It is sometimes advantageous to stop Code 128 from using subset mode C which -compresses numerical data. The BARCODE_CODE128B option (symbology 60) -suppresses mode C in favour of mode B. +compresses numerical data. The BARCODE_CODE128B option (symbology 60) suppresses +mode C in favour of mode B. 6.1.11.3 GS1-128 ---------------- @@ -1903,11 +1903,11 @@ Developed by Laetus, Pharmacode Two-Track is an alternative system to Pharmacode One-Track used for the identification of pharmaceuticals. The symbology is able to encode whole numbers between 4 and 64570080. -6.4.2 PostNet +6.4.2 POSTNET ------------- -Used by the United States Postal Service until 2009, the PostNet barcode was -used for encoding zip-codes on mail items. PostNet uses numerical input data -and includes a modulo-10 check digit. While Zint will encode PostNet symbols of +Used by the United States Postal Service until 2009, the POSTNET barcode was +used for encoding zip-codes on mail items. POSTNET uses numerical input data +and includes a modulo-10 check digit. While Zint will encode POSTNET symbols of any length, standard lengths as used by USPS were PostNet6 (5 digits ZIP input), PostNet10 (5 digit ZIP + 4 digit user data) and PostNet12 (5 digit ZIP + 6 digit user data). @@ -1987,7 +1987,7 @@ the input data. 6.5.5 USPS Intelligent Mail --------------------------- Also known as the OneCode barcode and used in the US by the United States Postal -Service (USPS), the Intelligent Mail system replaced the PostNet and PLANET +Service (USPS), the Intelligent Mail system replaced the POSTNET and PLANET symbologies in 2009. Intelligent Mail is a fixed length (65-bar) symbol which combines routing and customer information in a single symbol. Input data consists of a 20 digit tracking code, followed by a dash (-), followed by a @@ -2661,7 +2661,7 @@ generated using the characters A-D as shown in the table below. Code Letter | Usage ---------------------------------------------------------------------------- A | Used for courtesy reply mail and metered reply mail with a - | pre-printed PostNet symbol. + | pre-printed POSTNET symbol. B | Used for business reply mail without a pre-printed zip code. C | Used for business reply mail with a pre-printed zip code. D | Used for Information Based Indicia (IBI) postage. @@ -2817,7 +2817,7 @@ Code. Rearranged symbology numbers to match Tbarcode v8. Corrected a never ending loop bug in EAN-128. 29/9/2008 v2.0 beta r2 - Many corrections and bugfixes. (Code 11, Code 128, EAN-128, -Aztec Code, Codablock-F, Code 16k, Postnet, PLANET, NVE-18, PZN, Data Matrix +Aztec Code, Codablock-F, Code 16k, POSTNET, PLANET, NVE-18, PZN, Data Matrix ECC200, Maxicode and QR Code) v2.0 - Made corrections to Aztec Code and tested output with bcTester. Added diff --git a/frontend/main.c b/frontend/main.c index ff5c0d44..91dfa27f 100644 --- a/frontend/main.c +++ b/frontend/main.c @@ -63,11 +63,11 @@ static void types(void) { "30: GS1 DataBar Ltd 79: GS1 DataBar Stack 135: Comp UPC-A\n" "31: GS1 DataBar Exp 80: GS1 DataBar Stack Omni 136: Comp UPC-E\n" "32: Telepen Alpha 81: GS1 DataBar Exp Stack 137: Comp DataBar Stack\n" - "34: UPC-A 82: Planet 138: Comp DataBar Stack Omni\n" + "34: UPC-A 82: PLANET 138: Comp DataBar Stack Omni\n" "35: UPC-A + Check 84: MicroPDF 139: Comp DataBar Exp Stack\n" "37: UPC-E 85: USPS Intelligent Mail 140: Channel Code\n" "38: UPC-E + Check 86: UK Plessey 141: Code One\n" - "40: Postnet 87: Telepen Numeric 142: Grid Matrix\n" + "40: POSTNET 87: Telepen Numeric 142: Grid Matrix\n" "47: MSI Plessey 89: ITF-14 143: UPNQR\n" "49: FIM 90: KIX Code 144: Ultracode\n" "50: Logmars 92: Aztec Code 145: rMQR\n" diff --git a/frontend/tests/CMakeLists.txt b/frontend/tests/CMakeLists.txt index 66bc0dcf..218f5879 100644 --- a/frontend/tests/CMakeLists.txt +++ b/frontend/tests/CMakeLists.txt @@ -4,6 +4,7 @@ # vim: set ts=4 sw=4 et : cmake_minimum_required(VERSION 3.9) +project(zint_frontend_tests) enable_testing() @@ -15,14 +16,31 @@ set(ZINT_SANITIZE FALSE CACHE BOOL "Set sanitize compile/link flags") find_package(LibZint REQUIRED) find_package(PNG REQUIRED) -if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") - if(ZINT_DEBUG) +include(CheckCCompilerFlag) + +check_c_compiler_flag(-Wall C_COMPILER_FLAG_WALL) +if(C_COMPILER_FLAG_WALL) + add_compile_options("-Wall") +endif() + +check_c_compiler_flag(-Wextra C_COMPILER_FLAG_WEXTRA) +if(C_COMPILER_FLAG_WEXTRA) + add_compile_options("-Wextra") +endif() + +if(ZINT_DEBUG) + check_c_compiler_flag(-g C_COMPILER_FLAG_G) + if(C_COMPILER_FLAG_G) add_compile_options("-g") endif() - if(ZINT_SANITIZE) +endif() + +if(ZINT_SANITIZE) + # check_c_compiler_flag fails for -fsanitize + if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU") add_compile_options("-fsanitize=undefined") add_compile_options("-fsanitize=address") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined -fsanitize=address") + link_libraries("-fsanitize=undefined -fsanitize=address") endif() endif() diff --git a/frontend/tests/test_args.c b/frontend/tests/test_args.c index a025a618..4ffc6dea 100644 --- a/frontend/tests/test_args.c +++ b/frontend/tests/test_args.c @@ -161,7 +161,6 @@ static void test_dump_args(int index, int debug) { testStart(""); - int ret; struct item { int b; char *data; @@ -280,7 +279,6 @@ static void test_input(int index, int debug) { testStart(""); - int ret; struct item { int b; int batch; @@ -351,7 +349,6 @@ static void test_batch_input(int index, int debug) { testStart(""); - int ret; struct item { int b; char *data; @@ -410,7 +407,6 @@ static void test_batch_large(int index, int debug) { testStart(""); - int ret; struct item { int b; int mirror; @@ -469,7 +465,6 @@ static void test_checks(int index, int debug) { testStart(""); - int ret; struct item { int addongap; int border; diff --git a/frontend_qt/CMakeLists.txt b/frontend_qt/CMakeLists.txt index cf8090e6..a18c13fa 100644 --- a/frontend_qt/CMakeLists.txt +++ b/frontend_qt/CMakeLists.txt @@ -8,11 +8,11 @@ set(zint-qt_SRCS barcodeitem.cpp main.cpp mainwindow.cpp datawindow.cpp sequen QT5_WRAP_CPP(zint-qt_SRCS mainwindow.h datawindow.h sequencewindow.h exportwindow.h) QT5_WRAP_UI(zint-qt_SRCS mainWindow.ui extData.ui extSequence.ui extExport.ui) -# grpAztec.ui grpC49.ui grpDBExtend.ui grpLOGMARS.ui grpPDF417.ui grpUPCA.ui -# grpC11.ui grpChannel.ui grpDM.ui grpMaxicode.ui grpPZN.ui grpUPCEAN.ui -# grpC128.ui grpCodabar.ui grpDotCode.ui grpMicroPDF.ui grpQR.ui grpVIN.ui -# grpC16k.ui grpCodablockF.ui grpGrid.ui grpMQR.ui grpRMQR.ui -# grpC39.ui grpCodeOne.ui grpHX.ui grpMSICheck.ui grpUltra.ui +# grpAztec.ui grpC49.ui grpDBExtend.ui grpLOGMARS.ui grpPDF417.ui grpUPCEAN.ui +# grpC11.ui grpChannel.ui grpDM.ui grpMaxicode.ui grpQR.ui grpVIN.ui +# grpC128.ui grpCodabar.ui grpDotCode.ui grpMicroPDF.ui grpRMQR.ui +# grpC16k.ui grpCodablockF.ui grpGrid.ui grpMQR.ui grpUltra.ui +# grpC39.ui grpCodeOne.ui grpHX.ui grpMSICheck.ui grpUPCA.ui QT5_ADD_RESOURCES(zint-qt_SRCS resources.qrc) diff --git a/frontend_qt/extData.ui b/frontend_qt/extData.ui index 4ba04790..933a114d 100644 --- a/frontend_qt/extData.ui +++ b/frontend_qt/extData.ui @@ -24,7 +24,14 @@ - Data + &Data + + + Input data. Newlines (Line Feeds (0xA0)) +will be converted to spaces + + + txtDataInput @@ -46,14 +53,34 @@ - From File... + &From File... + + + Get input data from a file. Certain characters <br/>will be converted to escape sequences +<table cellpadding="3"> +<tr><td>End of Transmission (0x04)</td><td>\E</td></tr> +<tr><td>Bell (0x07)</td><td>\a</td></tr> +<tr><td>Backspace (0x08)</td><td>\b</td></tr> +<tr><td>Horizontal Tab (0x09)</td><td>\t</td></tr> +<tr><td>Vertical Tab (0x0B)</td><td>\v</td></tr> +<tr><td>Form Feed (0x0C)</td><td>\f</td></tr> +<tr><td>Carriage Return (0x0D)</td><td>\r</td></tr> +<tr><td>Escape (0x1B)</td><td>\e</td></tr> +<tr><td>Group Selector (0x1D)</td><td>\G</td></tr> +<tr><td>Record Selector (0x1E)</td><td>\R</td></tr> +<tr><td>Backslash (0x5C)</td><td>\\</td></tr> +</table> +Note that newlines (Line Feed (0x0A)) are <br/>not included - Reset + &Reset + + + Clear data window @@ -73,14 +100,20 @@ - OK + &OK + + + Close window and update input data - Cancel + &Cancel + + + Close window without updating input data diff --git a/frontend_qt/extExport.ui b/frontend_qt/extExport.ui index cbdb5054..f8f3f1bb 100644 --- a/frontend_qt/extExport.ui +++ b/frontend_qt/extExport.ui @@ -74,7 +74,7 @@ - Sat the naming convention used by the files + Set the naming convention used by the files @@ -153,7 +153,7 @@ Find a destination for your files - ... + &... @@ -166,7 +166,13 @@ - Destination Path: + &Destination Path: + + + Destination folder + + + linDestPath @@ -179,7 +185,13 @@ - File Name Prefix: + File Name &Prefix: + + + The first part of the filenames + + + linPrefix @@ -192,7 +204,13 @@ - File Name: + File &Name: + + + Set the naming convention used by the files + + + cmbFileName @@ -205,7 +223,13 @@ - File Format: + File &Format: + + + The type of file which you want to create + + + cmbFileFormat @@ -218,7 +242,10 @@ - Close + &Close + + + Close window @@ -231,23 +258,26 @@ - Export + &Export + + + Create files - 0 + 10 180 - 441 - 321 + 430 + 315 - 0 + 10 160 101 17 diff --git a/frontend_qt/extSequence.ui b/frontend_qt/extSequence.ui index 830bfb5d..8bcadfbf 100644 --- a/frontend_qt/extSequence.ui +++ b/frontend_qt/extSequence.ui @@ -42,28 +42,57 @@ - Start Value: + &Start Value: + + + linStartVal + + + Start sequence at this value - End Value: + End &Value: + + + linEndVal + + + End sequence at this value - Increment By: + Increment &By: + + + linIncVal + + + Go from start to end in steps of this amount - Format: + &Format: + + + linFormat + + + Format sequence using special characters<table cellpadding="3"> +<tr><td>#</td><td>Number or space</td></tr> +<tr><td>$</td><td>Number or '0'</td></tr> +<tr><td>*</td><td>Number or '*'</td></tr> +<tr><td>Other</td><td>Insert literally</td></tr> +</table> @@ -72,6 +101,9 @@ Sequence: + + Create a data sequence + @@ -79,13 +111,22 @@ Sequence File: + + Get a data sequence from a file + - + Generate Bar Codes: + + false + + + Save the symbols to files + @@ -100,6 +141,9 @@ true + + Start sequence at this value + @@ -107,6 +151,9 @@ 10 + + End sequence at this value + @@ -114,6 +161,9 @@ 1 + + Go from start to end in steps of this amount + @@ -121,6 +171,14 @@ $$$$$$ + + Format sequence using special characters<table cellpadding="3"> +<tr><td>#</td><td>Number or space</td></tr> +<tr><td>$</td><td>Number or '0'</td></tr> +<tr><td>*</td><td>Number or '*'</td></tr> +<tr><td>Other</td><td>Insert literally</td></tr> +</table> + @@ -129,17 +187,17 @@ Create a data sequence - Create + Crea&te - Get a data sequence from file + Get a data sequence from a file - Import... + &Import... @@ -149,10 +207,10 @@ false - Save the symbols to file + Save the symbols to files - Export... + &Export... @@ -172,7 +230,10 @@ - Sequence Preview + Sequence &Data + + + The data to be encoded, one line per symbol Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter @@ -212,14 +273,20 @@ - Reset + &Reset + + + Clear the sequence data - Close + &Close + + + Close window diff --git a/frontend_qt/grpAztec.ui b/frontend_qt/grpAztec.ui index 84053d09..30d66307 100644 --- a/frontend_qt/grpAztec.ui +++ b/frontend_qt/grpAztec.ui @@ -25,7 +25,7 @@ - Automatic Resizing + Auto&matic Resizing true @@ -35,7 +35,7 @@ - Adjust Size To: + Adjust Si&ze To: @@ -229,7 +229,7 @@ - Add Minimum Error Correction: + Add Minimum E&rror Correction: @@ -274,7 +274,7 @@ - Standard Mode + S&tandard Mode true @@ -284,14 +284,14 @@ - GS1 Data Mode + GS&1 Data Mode - HIBC Aztec Code + H&IBC Aztec Code diff --git a/frontend_qt/grpC11.ui b/frontend_qt/grpC11.ui index 34bbe746..f967186b 100644 --- a/frontend_qt/grpC11.ui +++ b/frontend_qt/grpC11.ui @@ -29,7 +29,7 @@ - Two (Mod-11) + &Two (Mod-11) true @@ -39,14 +39,14 @@ - One (Mod-11) + &One (Mod-11) - No Check Digit + &No Check Digit diff --git a/frontend_qt/grpC128.ui b/frontend_qt/grpC128.ui index 97d18bcd..1746b789 100644 --- a/frontend_qt/grpC128.ui +++ b/frontend_qt/grpC128.ui @@ -32,7 +32,7 @@ - Standard Mode + S&tandard Mode true @@ -42,21 +42,21 @@ - Subset C Supression + Subset &C Suppression - GS1-128 + GS&1-128 - HIBC 128 + H&IBC 128 diff --git a/frontend_qt/grpC16k.ui b/frontend_qt/grpC16k.ui index df574456..b74f400a 100644 --- a/frontend_qt/grpC16k.ui +++ b/frontend_qt/grpC16k.ui @@ -25,7 +25,7 @@ - Row Separator Height: + &Row Separator Height: cmbC16kRowSepHeight @@ -70,7 +70,7 @@ - Standard Mode + S&tandard Mode true @@ -80,7 +80,7 @@ - GS1 Data Mode + GS&1 Data Mode diff --git a/frontend_qt/grpC39.ui b/frontend_qt/grpC39.ui index 3e1a7525..5abde122 100644 --- a/frontend_qt/grpC39.ui +++ b/frontend_qt/grpC39.ui @@ -25,7 +25,7 @@ - No Check Digit + &No Check Digit true @@ -35,14 +35,14 @@ - HIBC 39 + H&IBC 39 - Mod-43 Check Digit + &Mod-43 Check Digit diff --git a/frontend_qt/grpC49.ui b/frontend_qt/grpC49.ui index 05369469..80152dfa 100644 --- a/frontend_qt/grpC49.ui +++ b/frontend_qt/grpC49.ui @@ -25,7 +25,7 @@ - Row Separator Height: + &Row Separator Height: cmbC49RowSepHeight @@ -70,7 +70,7 @@ - Standard Mode + S&tandard Mode true @@ -80,7 +80,7 @@ - GS1 Data Mode + GS&1 Data Mode diff --git a/frontend_qt/grpCodabar.ui b/frontend_qt/grpCodabar.ui index dae8192d..d8e1007c 100644 --- a/frontend_qt/grpCodabar.ui +++ b/frontend_qt/grpCodabar.ui @@ -17,7 +17,7 @@ - Add Check Character (Mod-16) + Add &Check Character (Mod-16) false diff --git a/frontend_qt/grpCodablockF.ui b/frontend_qt/grpCodablockF.ui index cd033450..7259c1a8 100644 --- a/frontend_qt/grpCodablockF.ui +++ b/frontend_qt/grpCodablockF.ui @@ -25,7 +25,7 @@ - Symbol Width (Columns): + Symbol &Width (Columns): cmbCbfWidth @@ -342,7 +342,7 @@ - Symbol Height (Rows): + Symbol &Height (Rows): cmbCbfHeight @@ -584,7 +584,7 @@ - Row Separator Height: + &Row Separator Height: cmbCbfRowSepHeight @@ -629,7 +629,7 @@ - Standard Mode + S&tandard Mode true @@ -639,7 +639,7 @@ - HIBC Codablock-F + H&IBC Codablock-F diff --git a/frontend_qt/grpCodeOne.ui b/frontend_qt/grpCodeOne.ui index 934da91d..6349ed8a 100644 --- a/frontend_qt/grpCodeOne.ui +++ b/frontend_qt/grpCodeOne.ui @@ -25,7 +25,7 @@ - Symbol Size: + Symbol Si&ze: Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter @@ -108,7 +108,7 @@ - Standard Mode + S&tandard Mode true @@ -118,7 +118,7 @@ - GS1 Data Mode + GS&1 Data Mode diff --git a/frontend_qt/grpDM.ui b/frontend_qt/grpDM.ui index 954efeaa..bb64bbb5 100644 --- a/frontend_qt/grpDM.ui +++ b/frontend_qt/grpDM.ui @@ -25,7 +25,7 @@ - Size: + Si&ze: cmbDM200Size @@ -298,7 +298,7 @@ - Standard Mode + S&tandard Mode true @@ -308,14 +308,14 @@ - GS1 Data Mode + GS&1 Data Mode - HIBC Data Matrix + H&IBC Data Matrix @@ -325,7 +325,7 @@ - Suppress Rectangular Symbols in Automatic Mode + Suppress &Rectangular Symbols in Automatic Mode true @@ -335,7 +335,7 @@ - Allow DMRE in Automatic Mode + Allo&w DMRE in Automatic Mode false @@ -345,7 +345,7 @@ - Use separator GS for GS1 + &Use separator GS for GS1 false diff --git a/frontend_qt/grpDotCode.ui b/frontend_qt/grpDotCode.ui index e9b9dc59..209cb8e2 100644 --- a/frontend_qt/grpDotCode.ui +++ b/frontend_qt/grpDotCode.ui @@ -321,7 +321,7 @@ - &GS1 Data Mode + GS&1 Data Mode diff --git a/frontend_qt/grpGrid.ui b/frontend_qt/grpGrid.ui index 8ffb14c6..6dbce5d5 100644 --- a/frontend_qt/grpGrid.ui +++ b/frontend_qt/grpGrid.ui @@ -25,7 +25,7 @@ - Size: + Si&ze: cmbGridSize @@ -109,7 +109,7 @@ - Error Correction: + E&rror Correction: cmbGridECC @@ -182,7 +182,7 @@ - Full Multibyte + &Full Multibyte false diff --git a/frontend_qt/grpHX.ui b/frontend_qt/grpHX.ui index 05279122..5effb1a8 100644 --- a/frontend_qt/grpHX.ui +++ b/frontend_qt/grpHX.ui @@ -25,7 +25,7 @@ - Size: + Si&ze: cmbHXSize @@ -467,7 +467,7 @@ - Error Correction: + E&rror Correction: cmbHXECC @@ -508,7 +508,7 @@ - Full Multibyte + &Full Multibyte false diff --git a/frontend_qt/grpLOGMARS.ui b/frontend_qt/grpLOGMARS.ui index 7fd52619..72618208 100644 --- a/frontend_qt/grpLOGMARS.ui +++ b/frontend_qt/grpLOGMARS.ui @@ -29,7 +29,7 @@ - No Check Digit + &No Check Digit true @@ -39,7 +39,7 @@ - One (Mod-43) + &One (Mod-43) diff --git a/frontend_qt/grpMQR.ui b/frontend_qt/grpMQR.ui index 15304601..377497a8 100644 --- a/frontend_qt/grpMQR.ui +++ b/frontend_qt/grpMQR.ui @@ -24,7 +24,7 @@ - Size: + Si&ze: cmbMQRSize @@ -63,7 +63,7 @@ - Error Correction: + E&rror Correction: cmbMQRECC @@ -99,7 +99,7 @@ - Full Multibyte + &Full Multibyte false diff --git a/frontend_qt/grpMaxicode.ui b/frontend_qt/grpMaxicode.ui index ed31b0fb..0fbe86ed 100644 --- a/frontend_qt/grpMaxicode.ui +++ b/frontend_qt/grpMaxicode.ui @@ -41,7 +41,7 @@ false - &Primary Message: + P&rimary Message: Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter diff --git a/frontend_qt/grpMicroPDF.ui b/frontend_qt/grpMicroPDF.ui index 1050bc7e..dd27e0b3 100644 --- a/frontend_qt/grpMicroPDF.ui +++ b/frontend_qt/grpMicroPDF.ui @@ -78,7 +78,7 @@ - Standard Mode + S&tandard Mode true @@ -88,7 +88,7 @@ - HIBC MicroPDF417 + H&IBC MicroPDF417 diff --git a/frontend_qt/grpPDF417.ui b/frontend_qt/grpPDF417.ui index 50c7d903..501b4e22 100644 --- a/frontend_qt/grpPDF417.ui +++ b/frontend_qt/grpPDF417.ui @@ -146,7 +146,7 @@ - &Error Correction Capacity: + E&rror Correction Capacity: Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter @@ -224,7 +224,7 @@ - Standard Mode + S&tandard Mode true @@ -234,7 +234,7 @@ - HIBC PDF417 + H&IBC PDF417 diff --git a/frontend_qt/grpQR.ui b/frontend_qt/grpQR.ui index d7e6fa3a..2b0651bd 100644 --- a/frontend_qt/grpQR.ui +++ b/frontend_qt/grpQR.ui @@ -25,7 +25,7 @@ - Size: + Si&ze: cmbQRSize @@ -247,7 +247,7 @@ - Error Correction: + E&rror Correction: cmbQRECC @@ -297,7 +297,7 @@ - Standard Mode + S&tandard Mode true @@ -307,14 +307,14 @@ - GS1 Data Mode + GS&1 Data Mode - HIBC QR Code + H&IBC QR Code @@ -324,7 +324,7 @@ - Full Multibyte + &Full Multibyte false diff --git a/frontend_qt/grpRMQR.ui b/frontend_qt/grpRMQR.ui index 081553bd..74481c05 100644 --- a/frontend_qt/grpRMQR.ui +++ b/frontend_qt/grpRMQR.ui @@ -25,7 +25,7 @@ - Size: + Si&ze: cmbRMQRSize @@ -237,7 +237,7 @@ - Error Correction: + E&rror Correction: cmbRMQRECC @@ -277,7 +277,7 @@ - Standard Mode + S&tandard Mode true @@ -287,7 +287,7 @@ - GS1 Data Mode + GS&1 Data Mode @@ -297,7 +297,7 @@ - Full Multibyte + &Full Multibyte false diff --git a/frontend_qt/grpUPCA.ui b/frontend_qt/grpUPCA.ui index 3e9361f6..1686b44d 100644 --- a/frontend_qt/grpUPCA.ui +++ b/frontend_qt/grpUPCA.ui @@ -25,7 +25,7 @@ - &Add-on Gap: + A&dd-on Gap: Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter diff --git a/frontend_qt/grpUPCEAN.ui b/frontend_qt/grpUPCEAN.ui index d520fa9f..3718f2d7 100644 --- a/frontend_qt/grpUPCEAN.ui +++ b/frontend_qt/grpUPCEAN.ui @@ -25,7 +25,7 @@ - &Add-on Gap: + A&dd-on Gap: Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter diff --git a/frontend_qt/grpUltra.ui b/frontend_qt/grpUltra.ui index 2f77e918..f066a3d9 100644 --- a/frontend_qt/grpUltra.ui +++ b/frontend_qt/grpUltra.ui @@ -25,13 +25,20 @@ - A&utomatic Resizing + Auto&matic Resizing true + + + + E&rror Correction Level: + + + @@ -72,13 +79,6 @@ - - - - Error Correction Level: - - - @@ -93,7 +93,7 @@ - Standard Mode + S&tandard Mode true @@ -103,7 +103,7 @@ - GS1 Data Mode + GS&1 Data Mode diff --git a/frontend_qt/grpVIN.ui b/frontend_qt/grpVIN.ui index 082b23ff..25b8a412 100644 --- a/frontend_qt/grpVIN.ui +++ b/frontend_qt/grpVIN.ui @@ -25,7 +25,7 @@ - Import Character Prefix + &Import Character Prefix false diff --git a/frontend_qt/mainWindow.ui b/frontend_qt/mainWindow.ui index 4147696f..42f3ab1a 100644 --- a/frontend_qt/mainWindow.ui +++ b/frontend_qt/mainWindow.ui @@ -129,7 +129,7 @@ - General + &General @@ -167,7 +167,7 @@ or import from file - ... + &... @@ -301,7 +301,7 @@ or import from file false - &2D Component Data: + 2D &Component Data: txtComposite @@ -540,22 +540,23 @@ p, li { white-space: pre-wrap; } - Process escape sequences in input data -\0 - NUL character (0x00) -\E - End of Transmission (0x04) -\a - Bell (0x07) -\b - Backspace (0x08) -\t - Horizontal Tab (0x09) -\n - Line Feed (0x0A) -\v - Vertical Tab (0x0B) -\f - Form Feed (0x0C) -\r - Carriage Return (0x0D) -\e - Escape (0x1B) -\G - Group Selector (0x1D) -\R - Record Selector (0x1E) -\\ - Backslash (0x5C) -\xNN - 8-bit character (N hex) -\uNNNN - 16-bit Unicode (N hex) + Process escape sequences in input data<table cellpadding="3"> +<tr><td>\0</td><td>NUL character (0x00)</td></tr> +<tr><td>\E</td><td>End of Transmission (0x04)</td></tr> +<tr><td>\a</td><td>Bell (0x07)</td></tr> +<tr><td>\b</td><td>Backspace (0x08)</td></tr> +<tr><td>\t</td><td>Horizontal Tab (0x09)</td></tr> +<tr><td>\n</td><td>Line Feed (0x0A)</td></tr> +<tr><td>\v</td><td>Vertical Tab (0x0B)</td></tr> +<tr><td>\f</td><td>Form Feed (0x0C)</td></tr> +<tr><td>\r</td><td>Carriage Return (0x0D)</td></tr> +<tr><td>\e</td><td>Escape (0x1B)</td></tr> +<tr><td>\G</td><td>Group Selector (0x1D)</td></tr> +<tr><td>\R</td><td>Record Selector (0x1E)</td></tr> +<tr><td>\\</td><td>Backslash (0x5C)</td></tr> +<tr><td>\xNN</td><td>8-bit character (N hex)</td></tr> +<tr><td>\uNNNN</td><td>16-bit Unicode (N hex)</td></tr> +</table> &Parse Escapes @@ -605,7 +606,7 @@ p, li { white-space: pre-wrap; } - Appearance + A&ppearance @@ -773,7 +774,7 @@ p, li { white-space: pre-wrap; } - &Printing Scale: + Printing Sca&le: Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter @@ -874,7 +875,7 @@ p, li { white-space: pre-wrap; } true - Colour: + Colour: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -1003,7 +1004,7 @@ p, li { white-space: pre-wrap; } false - &Dot Size: + Dot S&ize: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -1123,13 +1124,6 @@ p, li { white-space: pre-wrap; } - - tabMain - txtData - chkComposite - cmbCompType - txtComposite - diff --git a/frontend_qt/mainwindow.cpp b/frontend_qt/mainwindow.cpp index 1897aba9..b428a027 100644 --- a/frontend_qt/mainwindow.cpp +++ b/frontend_qt/mainwindow.cpp @@ -52,27 +52,27 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags fl) "Australia Post Reply-Paid", "Australia Post Routing Code", "Australia Post Standard Customer", - "Aztec Code (ISO 24778)", + "Aztec Code (ISO 24778) (and HIBC)", "Aztec Runes", "Channel Code", "Codabar", - "Codablock-F", + "Codablock-F (and HIBC)", "Code 11", - "Code 128 (ISO 15417)", + "Code 128 (ISO 15417) (and GS1-128 and HIBC)", "Code 16k", "Code 2 of 5 Data Logic", "Code 2 of 5 IATA", "Code 2 of 5 Industrial", "Code 2 of 5 Interleaved", - "Code 2 of 5 Standard", + "Code 2 of 5 Standard (Matrix)", "Code 32 (Italian Pharmacode)", - "Code 39 (ISO 16388)", + "Code 39 (ISO 16388) (and HIBC)", "Code 39 Extended", "Code 49", "Code 93", "Code One", "DAFT Code", - "Data Matrix (ISO 16022)", + "Data Matrix (ISO 16022) (and HIBC)", "Deutsche Post Identcode", "Deutsche Post Leitcode", "DotCode", @@ -96,17 +96,17 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags fl) "Korean Postal Barcode", "LOGMARS", "Maxicode (ISO 16023)", - "MicroPDF417 (ISO 24728)", + "MicroPDF417 (ISO 24728) (and HIBC)", "Micro QR Code", "MSI Plessey", "NVE-18 (SSCC-18)", - "PDF417 (ISO 15438)", + "PDF417 (ISO 15438) (and Compact and HIBC)", "Pharmacode", "Pharmacode 2-track", "Pharma Zentralnummer (PZN)", "PLANET", - "Postnet", - "QR Code (ISO 18004)", + "POSTNET", + "QR Code (ISO 18004) (and HIBC)", "Rectangular Micro QR (rMQR)", "Royal Mail 4-state Barcode", "Royal Mail 4-state Mailmark", @@ -217,7 +217,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags fl) connect(&m_bc.bc, SIGNAL(encoded()), SLOT(on_encoded())); - QShortcut *ctrl_q = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); + QShortcut *ctrl_q = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this); connect(ctrl_q, SIGNAL(activated()), SLOT(quit_now())); } @@ -582,7 +582,7 @@ void MainWindow::change_options() if (tabMain->count()==3) tabMain->removeTab(1); - chkComposite->setText(tr("Add 2D Component")); + chkComposite->setText(tr("Add &2D Component")); btype->setItemText(0, tr("No border")); combobox_item_enabled(cmbFontSetting, 1, true); cmbFontSetting->setItemText(2, tr("Small")); @@ -594,8 +594,8 @@ void MainWindow::change_options() return; m_optionWidget=uiload.load(&file); file.close(); - tabMain->insertTab(1,m_optionWidget,tr("Code 128")); - chkComposite->setText(tr("Add 2D Component (GS1-128 only)")); + tabMain->insertTab(1,m_optionWidget,tr("Cod&e 128")); + chkComposite->setText(tr("Add &2D Component (GS1-128 only)")); connect(m_optionWidget->findChild("radC128EAN"), SIGNAL(toggled( bool )), SLOT(composite_ean_check())); connect(m_optionWidget->findChild("radC128Stand"), SIGNAL(clicked( bool )), SLOT(update_preview())); connect(m_optionWidget->findChild("radC128CSup"), SIGNAL(clicked( bool )), SLOT(update_preview())); @@ -610,7 +610,7 @@ void MainWindow::change_options() return; m_optionWidget=uiload.load(&file); file.close(); - tabMain->insertTab(1,m_optionWidget,tr("PDF417")); + tabMain->insertTab(1,m_optionWidget,tr("PDF41&7")); connect(m_optionWidget->findChild("cmbPDFECC"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); connect(m_optionWidget->findChild("cmbPDFCols"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); connect(m_optionWidget->findChild("radPDFTruncated"), SIGNAL(clicked( bool )), SLOT(update_preview())); @@ -626,7 +626,7 @@ void MainWindow::change_options() return; m_optionWidget=uiload.load(&file); file.close(); - tabMain->insertTab(1,m_optionWidget,tr("Micro PDF417")); + tabMain->insertTab(1,m_optionWidget,tr("Micro PDF41&7")); connect(m_optionWidget->findChild("cmbMPDFCols"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); connect(m_optionWidget->findChild("radMPDFStand"), SIGNAL(toggled( bool )), SLOT(update_preview())); } @@ -638,7 +638,7 @@ void MainWindow::change_options() return; m_optionWidget=uiload.load(&file); file.close(); - tabMain->insertTab(1,m_optionWidget,tr("DotCode")); + tabMain->insertTab(1,m_optionWidget,tr("DotCod&e")); connect(m_optionWidget->findChild("cmbDotCols"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); connect(m_optionWidget->findChild("radDotStand"), SIGNAL(clicked( bool )), SLOT(update_preview())); connect(m_optionWidget->findChild("radDotGS1"), SIGNAL(clicked( bool )), SLOT(update_preview())); @@ -651,7 +651,7 @@ void MainWindow::change_options() return; m_optionWidget=uiload.load(&file); file.close(); - tabMain->insertTab(1,m_optionWidget,tr("Aztec Code")); + tabMain->insertTab(1,m_optionWidget,tr("Aztec Cod&e")); connect(m_optionWidget->findChild("radAztecAuto"), SIGNAL(clicked( bool )), SLOT(update_preview())); connect(m_optionWidget->findChild("radAztecSize"), SIGNAL(clicked( bool )), SLOT(update_preview())); connect(m_optionWidget->findChild("radAztecECC"), SIGNAL(clicked( bool )), SLOT(update_preview())); @@ -669,7 +669,7 @@ void MainWindow::change_options() return; m_optionWidget=uiload.load(&file); file.close(); - tabMain->insertTab(1,m_optionWidget,tr("MSI Plessey")); + tabMain->insertTab(1,m_optionWidget,tr("MSI Pless&ey")); connect(m_optionWidget->findChild("cmbMSICheck"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); } @@ -680,7 +680,7 @@ void MainWindow::change_options() return; m_optionWidget=uiload.load(&file); file.close(); - tabMain->insertTab(1,m_optionWidget,tr("Code 11")); + tabMain->insertTab(1,m_optionWidget,tr("Cod&e 11")); connect(m_optionWidget->findChild("radC11TwoCheckDigits"), SIGNAL(clicked( bool )), SLOT(update_preview())); connect(m_optionWidget->findChild("radC11OneCheckDigit"), SIGNAL(clicked( bool )), SLOT(update_preview())); connect(m_optionWidget->findChild("radC11NoCheckDigits"), SIGNAL(clicked( bool )), SLOT(update_preview())); @@ -698,7 +698,7 @@ void MainWindow::change_options() connect(m_optionWidget->findChild("radC39HIBC"), SIGNAL(clicked( bool )), SLOT(update_preview())); if (symbology == BARCODE_EXCODE39) { - tabMain->insertTab(1,m_optionWidget,tr("Code 39 Extended")); + tabMain->insertTab(1,m_optionWidget,tr("Cod&e 39 Extended")); if(m_optionWidget->findChild("radC39HIBC")->isChecked() == true) { m_optionWidget->findChild("radC39HIBC")->setChecked(false); @@ -707,7 +707,7 @@ void MainWindow::change_options() m_optionWidget->findChild("radC39HIBC")->setEnabled(false); } else { - tabMain->insertTab(1,m_optionWidget,tr("Code 39")); + tabMain->insertTab(1,m_optionWidget,tr("Cod&e 39")); m_optionWidget->findChild("radC39HIBC")->setEnabled(true); } } @@ -731,7 +731,7 @@ void MainWindow::change_options() return; m_optionWidget=uiload.load(&file); file.close(); - tabMain->insertTab(1,m_optionWidget,tr("Code 16K")); + tabMain->insertTab(1,m_optionWidget,tr("Cod&e 16K")); btype->setItemText(0, tr("Default (bind)")); connect(m_optionWidget->findChild("cmbC16kRowSepHeight"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); connect(m_optionWidget->findChild("radC16kStand"), SIGNAL(toggled( bool )), SLOT(update_preview())); @@ -755,7 +755,7 @@ void MainWindow::change_options() return; m_optionWidget=uiload.load(&file); file.close(); - tabMain->insertTab(1,m_optionWidget,tr("Codablock-F")); + tabMain->insertTab(1,m_optionWidget,tr("Codablock&-F")); btype->setItemText(0, tr("Default (bind)")); connect(m_optionWidget->findChild("cmbCbfWidth"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); connect(m_optionWidget->findChild("cmbCbfHeight"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); @@ -793,7 +793,7 @@ void MainWindow::change_options() return; m_optionWidget=uiload.load(&file); file.close(); - tabMain->insertTab(1,m_optionWidget,tr("QR Code")); + tabMain->insertTab(1,m_optionWidget,tr("QR Cod&e")); connect(m_optionWidget->findChild("cmbQRSize"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); connect(m_optionWidget->findChild("cmbQRECC"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); connect(m_optionWidget->findChild("radQRStand"), SIGNAL(clicked( bool )), SLOT(update_preview())); @@ -809,7 +809,7 @@ void MainWindow::change_options() return; m_optionWidget=uiload.load(&file); file.close(); - tabMain->insertTab(1,m_optionWidget,tr("rMQR Code")); + tabMain->insertTab(1,m_optionWidget,tr("rMQR Cod&e")); connect(m_optionWidget->findChild("cmbRMQRSize"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); connect(m_optionWidget->findChild("cmbRMQRECC"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); connect(m_optionWidget->findChild("radRMQRStand"), SIGNAL(clicked( bool )), SLOT(update_preview())); @@ -824,7 +824,7 @@ void MainWindow::change_options() return; m_optionWidget=uiload.load(&file); file.close(); - tabMain->insertTab(1,m_optionWidget,tr("Han Xin Code")); + tabMain->insertTab(1,m_optionWidget,tr("Han Xin Cod&e")); connect(m_optionWidget->findChild("cmbHXSize"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); connect(m_optionWidget->findChild("cmbHXECC"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); connect(m_optionWidget->findChild("chkHXFullMultibyte"), SIGNAL(stateChanged( int )), SLOT(update_preview())); @@ -837,7 +837,7 @@ void MainWindow::change_options() return; m_optionWidget=uiload.load(&file); file.close(); - tabMain->insertTab(1,m_optionWidget,tr("Micro QR Code")); + tabMain->insertTab(1,m_optionWidget,tr("Micro QR Cod&e")); connect(m_optionWidget->findChild("cmbMQRSize"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); connect(m_optionWidget->findChild("cmbMQRECC"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); connect(m_optionWidget->findChild("chkMQRFullMultibyte"), SIGNAL(stateChanged( int )), SLOT(update_preview())); @@ -863,7 +863,7 @@ void MainWindow::change_options() return; m_optionWidget=uiload.load(&file); file.close(); - tabMain->insertTab(1,m_optionWidget,tr("Maxicode")); + tabMain->insertTab(1,m_optionWidget,tr("Maxicod&e")); connect(m_optionWidget->findChild("cmbMaxiMode"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); connect(m_optionWidget->findChild("cmbMaxiMode"), SIGNAL(currentIndexChanged( int )), SLOT(maxi_primary())); connect(m_optionWidget->findChild("txtMaxiPrimary"), SIGNAL(textChanged( const QString& )), SLOT(update_preview())); @@ -876,7 +876,7 @@ void MainWindow::change_options() return; m_optionWidget=uiload.load(&file); file.close(); - tabMain->insertTab(1,m_optionWidget,tr("Channel Code")); + tabMain->insertTab(1,m_optionWidget,tr("Channel Cod&e")); connect(m_optionWidget->findChild("cmbChannel"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); } @@ -887,7 +887,7 @@ void MainWindow::change_options() return; m_optionWidget=uiload.load(&file); file.close(); - tabMain->insertTab(1,m_optionWidget,tr("Code One")); + tabMain->insertTab(1,m_optionWidget,tr("Code On&e")); connect(m_optionWidget->findChild("cmbC1Size"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); connect(m_optionWidget->findChild("radC1GS1"), SIGNAL(toggled( bool )), SLOT(update_preview())); } @@ -899,7 +899,7 @@ void MainWindow::change_options() return; m_optionWidget=uiload.load(&file); file.close(); - tabMain->insertTab(1,m_optionWidget,tr("Code 49")); + tabMain->insertTab(1,m_optionWidget,tr("Cod&e 49")); connect(m_optionWidget->findChild("cmbC49RowSepHeight"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); connect(m_optionWidget->findChild("radC49GS1"), SIGNAL(toggled( bool )), SLOT(update_preview())); } @@ -911,7 +911,7 @@ void MainWindow::change_options() return; m_optionWidget=uiload.load(&file); file.close(); - tabMain->insertTab(1,m_optionWidget,tr("GS1 DataBar Stacked")); + tabMain->insertTab(1,m_optionWidget,tr("GS1 DataBar Stack&ed")); connect(m_optionWidget->findChild("cmbCols"), SIGNAL(currentIndexChanged ( int )), SLOT(update_preview())); } @@ -922,7 +922,7 @@ void MainWindow::change_options() return; m_optionWidget=uiload.load(&file); file.close(); - tabMain->insertTab(1,m_optionWidget,tr("Ultracode")); + tabMain->insertTab(1,m_optionWidget,tr("Ultracod&e")); connect(m_optionWidget->findChild("radUltraAuto"), SIGNAL(clicked( bool )), SLOT(update_preview())); connect(m_optionWidget->findChild("radUltraEcc"), SIGNAL(clicked( bool )), SLOT(update_preview())); connect(m_optionWidget->findChild("cmbUltraEcc"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); @@ -956,11 +956,11 @@ void MainWindow::change_options() m_optionWidget=uiload.load(&file); file.close(); if (symbology == BARCODE_UPCE || symbology == BARCODE_UPCE_CHK || symbology == BARCODE_UPCE_CC) { - tabMain->insertTab(1, m_optionWidget, tr("UPC-E")); + tabMain->insertTab(1, m_optionWidget, tr("UPC-&E")); } else if (symbology == BARCODE_ISBNX) { tabMain->insertTab(1, m_optionWidget, tr("ISBN")); } else { - tabMain->insertTab(1, m_optionWidget, tr("EAN")); + tabMain->insertTab(1, m_optionWidget, tr("&EAN")); } combobox_item_enabled(cmbFontSetting, 1, false); if (cmbFontSetting->currentIndex() == 1) { @@ -977,7 +977,7 @@ void MainWindow::change_options() return; m_optionWidget=uiload.load(&file); file.close(); - tabMain->insertTab(1,m_optionWidget,tr("VIN")); + tabMain->insertTab(1,m_optionWidget,tr("&VIN")); connect(m_optionWidget->findChild("chkVINImportChar"), SIGNAL(clicked( bool )), SLOT(update_preview())); } diff --git a/frontend_qt/mainwindow.h b/frontend_qt/mainwindow.h index e17759a4..93f4befd 100644 --- a/frontend_qt/mainwindow.h +++ b/frontend_qt/mainwindow.h @@ -25,10 +25,7 @@ #include "ui_mainWindow.h" #include "barcodeitem.h" -class QAction; -class QActionGroup; class QLabel; -class QMenu; class MainWindow : public QWidget, private Ui::mainWindow { @@ -138,8 +135,6 @@ protected: void combobox_item_enabled(QComboBox *comboBox, int index, bool enabled); void upcean_addon_gap(QComboBox *comboBox, QLabel *label, int base); void set_gs1_mode(bool gs1_mode); - bool fixed_height(); - bool no_hrt(); const char *get_setting_name(int symbology); int get_button_group_index(const QStringList &children); void set_radiobutton_from_setting(QSettings &settings, const QString &setting, const QStringList &children, int default_val = 0); diff --git a/frontend_qt/sequencewindow.cpp b/frontend_qt/sequencewindow.cpp index 70db763d..10070f45 100644 --- a/frontend_qt/sequencewindow.cpp +++ b/frontend_qt/sequencewindow.cpp @@ -158,8 +158,10 @@ void SequenceWindow::check_generate() preview_copy = txtPreview->toPlainText(); if(preview_copy.isEmpty()) { btnExport->setEnabled(false); + lblExport->setEnabled(false); } else { btnExport->setEnabled(true); + lblExport->setEnabled(true); } }