1
0
mirror of https://git.code.sf.net/p/zint/code synced 2026-06-10 07:33:43 +00:00

CLI: fix bug in "--scalexdimdp" in converting from "in" to "mm"

(was dividing instead of multiplying doh);
  make "--scalexdimdp" units check error messages better;
  add more "--test" tests & have `validate_units()` etc take
  `errbuf` arg to make them more test-friendly
GUI: `copy_to_clipboard()` unshadow `data` -> `fdata`
test suite: make `utf8_to_wide()` same as "backend/output.c" & fix
  return vals;
  add `QZint::save_to_memfile()` test
This commit is contained in:
gitlost
2025-12-31 14:57:13 +00:00
parent b434202817
commit 848b364df0
8 changed files with 687 additions and 144 deletions
+6 -1
View File
@@ -1,4 +1,4 @@
Version 2.16.0.9 (dev) not released yet (2025-12-29) Version 2.16.0.9 (dev) not released yet (2025-12-31)
==================================================== ====================================================
**Incompatible changes** **Incompatible changes**
@@ -13,6 +13,11 @@ Changes
- CLI: allow "tiff" as filetype (saved as ".tif"); - CLI: allow "tiff" as filetype (saved as ".tif");
add `ZINT_TEST`-only "--test" option to do various internal tests add `ZINT_TEST`-only "--test" option to do various internal tests
Bugs
----
- CLI: fix "--scalexdimdp" X-dim inch units being divided instead of multiplied
on conversion to mm
Version 2.16.0 (2025-12-19) Version 2.16.0 (2025-12-19)
=========================== ===========================
+1
View File
@@ -892,6 +892,7 @@ INTERNAL float zint_out_large_bar_height(struct zint_symbol *symbol, const int s
#ifdef _WIN32 #ifdef _WIN32
/* Convert UTF-8 to Windows wide chars. Ticket #288, props Marcel */ /* Convert UTF-8 to Windows wide chars. Ticket #288, props Marcel */
/* Note if change this, change versions in "frontend/main.c" and "backend/tests/testcommon.c" also */
#define utf8_to_wide(u, w, r) \ #define utf8_to_wide(u, w, r) \
{ \ { \
int lenW; /* Includes terminating NUL */ \ int lenW; /* Includes terminating NUL */ \
+20 -18
View File
@@ -124,12 +124,14 @@ void assert_notequal(int e1, int e2, const char *fmt, ...) {
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
#define utf8_to_wide(u, w) \ /* Convert UTF-8 to Windows wide chars. Ticket #288, props Marcel */
/* See "backend/output.c" */
#define utf8_to_wide(u, w, r) \
{ \ { \
int lenW; /* Includes terminating NUL */ \ int lenW; /* Includes NUL terminator */ \
if ((lenW = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, u, -1, NULL, 0)) == 0) return 0; \ if ((lenW = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, u, -1, NULL, 0)) == 0) return r; \
w = (wchar_t *) z_alloca(sizeof(wchar_t) * lenW); \ w = (wchar_t *) z_alloca(sizeof(wchar_t) * lenW); \
if (MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, u, -1, w, lenW) == 0) return 0; \ if (MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, u, -1, w, lenW) == 0) return r; \
} }
#endif #endif
@@ -1551,7 +1553,7 @@ FILE *testUtilOpen(const char *filename, const char *mode) {
return fp; return fp;
} }
/* Does file exist? */ /* Does file exist? Returns 1 if does, 0 if doesn't */
int testUtilExists(const char *filename) { int testUtilExists(const char *filename) {
FILE *fp = testUtilOpen(filename, "r"); FILE *fp = testUtilOpen(filename, "r");
if (fp == NULL) { if (fp == NULL) {
@@ -1565,21 +1567,21 @@ int testUtilExists(const char *filename) {
int testUtilRemove(const char *filename) { int testUtilRemove(const char *filename) {
#ifdef _WIN32 #ifdef _WIN32
wchar_t *filenameW; wchar_t *filenameW;
utf8_to_wide(filename, filenameW); utf8_to_wide(filename, filenameW, -1 /*fail return*/);
return DeleteFileW(filenameW) == 0; /* Non-zero on success */ return DeleteFileW(filenameW) == 0; /* Non-zero on success */
#else #else
return remove(filename); return remove(filename);
#endif #endif
} }
/* Does directory exist? (Windows compatibility) */ /* Does directory exist? (Windows compatibility). Returns 1 if does, 0 if doesn't */
int testUtilDirExists(const char *dirname) { int testUtilDirExists(const char *dirname) {
#ifdef _WIN32 #ifdef _WIN32
DWORD dwAttrib; DWORD dwAttrib;
wchar_t *dirnameW; wchar_t *dirnameW;
utf8_to_wide(dirname, dirnameW); utf8_to_wide(dirname, dirnameW, 0 /*fail return*/);
dwAttrib = GetFileAttributesW(dirnameW); dwAttrib = GetFileAttributesW(dirnameW);
return dwAttrib != (DWORD) -1 && (dwAttrib & FILE_ATTRIBUTE_DIRECTORY); return dwAttrib != (DWORD) -1 && !!(dwAttrib & FILE_ATTRIBUTE_DIRECTORY);
#else #else
return testUtilExists(dirname); return testUtilExists(dirname);
#endif #endif
@@ -1589,7 +1591,7 @@ int testUtilDirExists(const char *dirname) {
int testUtilMkDir(const char *dirname) { int testUtilMkDir(const char *dirname) {
#ifdef _WIN32 #ifdef _WIN32
wchar_t *dirnameW; wchar_t *dirnameW;
utf8_to_wide(dirname, dirnameW); utf8_to_wide(dirname, dirnameW, -1 /*fail return*/);
return CreateDirectoryW(dirnameW, NULL) == 0; return CreateDirectoryW(dirnameW, NULL) == 0;
#else #else
return mkdir(dirname, S_IRWXU); return mkdir(dirname, S_IRWXU);
@@ -1600,28 +1602,28 @@ int testUtilMkDir(const char *dirname) {
int testUtilRmDir(const char *dirname) { int testUtilRmDir(const char *dirname) {
#ifdef _WIN32 #ifdef _WIN32
wchar_t *dirnameW; wchar_t *dirnameW;
utf8_to_wide(dirname, dirnameW); utf8_to_wide(dirname, dirnameW, -1 /*fail return*/);
return RemoveDirectoryW(dirnameW) == 0; return RemoveDirectoryW(dirnameW) == 0;
#else #else
return rmdir(dirname); return rmdir(dirname);
#endif #endif
} }
/* Rename a file (Windows compatibility) */ /* Rename a file (Windows compatibility). Returns 0 if successful, non-zero if not */
int testUtilRename(const char *oldpath, const char *newpath) { int testUtilRename(const char *oldpath, const char *newpath) {
#ifdef _WIN32 #ifdef _WIN32
wchar_t *oldpathW, *newpathW; wchar_t *oldpathW, *newpathW;
int ret = testUtilRemove(newpath); int ret = testUtilRemove(newpath);
if (ret != 0) return ret; if (ret != 0) return ret;
utf8_to_wide(oldpath, oldpathW); utf8_to_wide(oldpath, oldpathW, -1 /*fail return*/);
utf8_to_wide(newpath, newpathW); utf8_to_wide(newpath, newpathW, -1 /*fail return*/);
return _wrename(oldpathW, newpathW); return _wrename(oldpathW, newpathW);
#else #else
return rename(oldpath, newpath); return rename(oldpath, newpath);
#endif #endif
} }
/* Create read-only file */ /* Create read-only file. Returns 1 if successful, 0 if not */
int testUtilCreateROFile(const char *filename) { int testUtilCreateROFile(const char *filename) {
#ifdef _WIN32 #ifdef _WIN32
wchar_t *filenameW; wchar_t *filenameW;
@@ -1634,7 +1636,7 @@ int testUtilCreateROFile(const char *filename) {
return 0; return 0;
} }
#ifdef _WIN32 #ifdef _WIN32
utf8_to_wide(filename, filenameW); utf8_to_wide(filename, filenameW, 0 /*fail return*/);
if (SetFileAttributesW(filenameW, GetFileAttributesW(filenameW) | FILE_ATTRIBUTE_READONLY) == 0) { if (SetFileAttributesW(filenameW, GetFileAttributesW(filenameW) | FILE_ATTRIBUTE_READONLY) == 0) {
return 0; return 0;
} }
@@ -1646,11 +1648,11 @@ int testUtilCreateROFile(const char *filename) {
return 1; return 1;
} }
/* Remove read-only file (Windows compatibility) */ /* Remove read-only file (Windows compatibility). Returns 0 if successful, non-zero if not */
int testUtilRmROFile(const char *filename) { int testUtilRmROFile(const char *filename) {
#ifdef _WIN32 #ifdef _WIN32
wchar_t *filenameW; wchar_t *filenameW;
utf8_to_wide(filename, filenameW); utf8_to_wide(filename, filenameW, -1 /*fail return*/);
if (SetFileAttributesW(filenameW, GetFileAttributesW(filenameW) & ~FILE_ATTRIBUTE_READONLY) == 0) { if (SetFileAttributesW(filenameW, GetFileAttributesW(filenameW) & ~FILE_ATTRIBUTE_READONLY) == 0) {
return -1; return -1;
} }
Binary file not shown.
+61 -1
View File
@@ -552,7 +552,9 @@ private slots:
QTest::newRow("BARCODE_DATAMATRIX unknown format") << BARCODE_DATAMATRIX << "1234" << "test_save_to_file.ext" << false; QTest::newRow("BARCODE_DATAMATRIX unknown format") << BARCODE_DATAMATRIX << "1234" << "test_save_to_file.ext" << false;
QTest::newRow("BARCODE_DATAMATRIX UTF8 gif") << BARCODE_DATAMATRIX << "1234" << "test_save_to_file_τ.gif" << true; QTest::newRow("BARCODE_DATAMATRIX UTF8 gif") << BARCODE_DATAMATRIX << "1234" << "test_save_to_file_τ.gif" << true;
QTest::newRow("BARCODE_DATAMATRIX too long (unknown format)") << BARCODE_DATAMATRIX << "1234" QTest::newRow("BARCODE_DATAMATRIX too long (unknown format)") << BARCODE_DATAMATRIX << "1234"
<< "test_6789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012.gif" // 256 long so should be truncated to end in ".gi" << "test_67890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
"1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
"1234567890123456789012345678901234567890123456789012.gif" // 256 long so should be truncated to end in ".gi"
<< false; << false;
} }
@@ -579,6 +581,64 @@ private slots:
} }
} }
void saveToMemfileTest_data()
{
QTest::addColumn<int>("symbology");
QTest::addColumn<QString>("text");
QTest::addColumn<QString>("fileName");
QTest::addColumn<bool>("expected_bRet");
QTest::addColumn<QString>("expected_strData");
QTest::newRow("BARCODE_DATAMATRIX gif") << BARCODE_DATAMATRIX << "1234" << "test_memfile.gif" << true
<< "47494638376114001400f00000ffffff0000002c00000000140014000002"
"3c4c00869ad7eb988c942168b2cef7eecf794e37594f776a285a862b8485"
"ea49caf66a4ef10ca7204e010a69a24f6ff7231a5f351db3580149a7d44c"
"01003b";
QTest::newRow("BARCODE_DATAMATRIX svg") << BARCODE_DATAMATRIX << "1234" << "test_memfile.svg" << true
<< "<?xml version=\"1.0\" standalone=\"no\"?>\n"
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n"
"<svg width=\"20\" height=\"20\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n"
" <desc>Zint Generated Symbol</desc>\n"
" <g id=\"barcode\" fill=\"#000000\">\n"
" <rect x=\"0\" y=\"0\" width=\"20\" height=\"20\" fill=\"#FFFFFF\"/>\n"
" <path d=\"M0 0h2v2h-2ZM4 0h2v2h-2ZM8 0h2v2h-2ZM12 0h2v2h-2ZM16 0h2v2h-2ZM0 2h4v8h-4ZM10"
" 2h10v2h-10ZM8 4h2v2h-2ZM16 4h2v2h-2ZM14 6h2v2h-2ZM18 6h2v2h-2ZM6 8h4v2h-4ZM12 8h2v2h-2ZM0"
" 10h2v4h-2ZM6 10h2v2h-2ZM10 10h2v2h-2ZM14 10h6v2h-6ZM8 12h2v2h-2ZM12 12h2v2h-2ZM0 14h8v2h-8ZM10"
" 14h2v2h-2ZM16 14h4v2h-4ZM0 16h2v2h-2ZM14 16h4v2h-4ZM0 18h20v2h-20Z\"/>\n"
" </g>\n"
"</svg>\n";
}
void saveToMemfileTest()
{
Zint::QZint bc;
bool bRet;
QFETCH(int, symbology);
QFETCH(QString, text);
QFETCH(QString, fileName);
QFETCH(bool, expected_bRet);
QFETCH(QString, expected_strData);
bc.setSymbol(symbology);
bc.setText(text);
QByteArray data;
bRet = bc.save_to_memfile(fileName, data);
QCOMPARE(bRet, expected_bRet);
if (bRet) {
QCOMPARE(bRet, true);
if (fileName.endsWith(".eps") || fileName.endsWith(".svg") || fileName.endsWith(".txt")) {
QCOMPARE(data, expected_strData);
} else {
QByteArray expected_data = QByteArray::fromHex(expected_strData.toUtf8());
QCOMPARE(data, expected_data);
}
}
}
void getAsCLITest_data() void getAsCLITest_data()
{ {
QTest::addColumn<bool>("autoHeight"); QTest::addColumn<bool>("autoHeight");
+562 -85
View File
File diff suppressed because it is too large Load Diff
+33 -35
View File
@@ -429,8 +429,8 @@ static void test_dump_segs(const testCtx *const p_ctx) {
struct item data[] = { struct item data[] = {
/* 0*/ { -1, "123", NULL, NULL, -1, -1, -1, "D3 96 72 F7 65 C9 61 8E B" }, /* 0*/ { -1, "123", NULL, NULL, -1, -1, -1, "D3 96 72 F7 65 C9 61 8E B" },
/* 1*/ { -1, "123", NULL, NULL, -1, 3, -1, "Error 166: Invalid segment argument, expect \"ECI,DATA\"" }, /* 1*/ { -1, "123", NULL, NULL, -1, 3, -1, "Error 166: Invalid segment argument, expect \"ECI,DATA\"" },
/* 2*/ { -1, "123", "456", NULL, -1, -1, -1, "Error 167: Invalid segment ECI (digits only)" }, /* 2*/ { -1, "123", "456", NULL, -1, -1, -1, "Error 166: Invalid segment ECI (digits only)" },
/* 3*/ { -1, "123", "456", NULL, -1, 1000000, -1, "Error 168: Segment ECI code '1000000' out of range (0 to 999999)" }, /* 3*/ { -1, "123", "456", NULL, -1, 1000000, -1, "Error 166: Segment ECI code '1000000' out of range (0 to 999999)" },
/* 4*/ { -1, "123", "456", NULL, -1, 3, -1, "Error 775: Symbology does not support multiple segments" }, /* 4*/ { -1, "123", "456", NULL, -1, 3, -1, "Error 775: Symbology does not support multiple segments" },
/* 5*/ { BARCODE_AZTEC, "123", "456", NULL, -1, 3, -1, "2B 7A\nC7 02\nF0 6E\n3F FE\n70 1C\nB7 D6\nB4 58\n15 54\n94 56\nB7 DC\n30 1A\n1F FC\n4C 66\n22 DA\n1E C6" }, /* 5*/ { BARCODE_AZTEC, "123", "456", NULL, -1, 3, -1, "2B 7A\nC7 02\nF0 6E\n3F FE\n70 1C\nB7 D6\nB4 58\n15 54\n94 56\nB7 DC\n30 1A\n1F FC\n4C 66\n22 DA\n1E C6" },
/* 6*/ { BARCODE_AZTEC, "123", NULL, "789", -1, -1, 3, "Error 172: Segments must be consecutive - segment 1 missing" }, /* 6*/ { BARCODE_AZTEC, "123", NULL, "789", -1, -1, 3, "Error 172: Segments must be consecutive - segment 1 missing" },
@@ -1040,39 +1040,37 @@ static void test_other_opts(const testCtx *const p_ctx) {
/* 32*/ { BARCODE_GS1_128, "[00]376104250021234569", -1, " --gs1strict", NULL, "", 0 }, /* 32*/ { BARCODE_GS1_128, "[00]376104250021234569", -1, " --gs1strict", NULL, "", 0 },
/* 33*/ { BARCODE_GS1_128, "[00]376104250021234568", -1, " --gs1strict", NULL, TEST_OTHER_OPTS_GS1STRICT_ERROR, 0 }, /* 33*/ { BARCODE_GS1_128, "[00]376104250021234568", -1, " --gs1strict", NULL, TEST_OTHER_OPTS_GS1STRICT_ERROR, 0 },
/* 34*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "1", "Error 155: Invalid Structured Append argument, expect \"index,count[,ID]\"", 0 }, /* 34*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "1", "Error 155: Invalid Structured Append argument, expect \"index,count[,ID]\"", 0 },
/* 35*/ { BARCODE_AZTEC, "1", -1, " --structapp=", ",", "Error 156: Structured Append index too short", 0 }, /* 35*/ { BARCODE_AZTEC, "1", -1, " --structapp=", ",", "Error 155: Structured Append index too short", 0 },
/* 36*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "1234567890,", "Error 156: Structured Append index too long", 0 }, /* 36*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "1234567890,", "Error 155: Structured Append index too long", 0 },
/* 37*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,", "Error 159: Structured Append count too short", 0 }, /* 37*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,", "Error 155: Structured Append count too short", 0 },
/* 38*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,1234567890", "Error 159: Structured Append count too long", 0 }, /* 38*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,1234567890", "Error 155: Structured Append count too long", 0 },
/* 39*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,123456789,", "Error 158: Structured Append ID too short", 0 }, /* 39*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,123456789,", "Error 155: Structured Append ID too short", 0 },
/* 40*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,1234567890,", "Error 157: Structured Append count too long", 0 }, /* 40*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,123456789,123456789012345678901234567890123", "Error 155: Structured Append ID too long", 0 },
/* 41*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,123456789,123456789012345678901234567890123", "Error 158: Structured Append ID too long", 0 }, /* 41*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,123456789,12345678901234567890123456789012", "Error 701: Structured Append count '123456789' out of range (2 to 26)", 0 },
/* 42*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,123456789,12345678901234567890123456789012", "Error 701: Structured Append count '123456789' out of range (2 to 26)", 0 }, /* 42*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "26,26,12345678901234567890123456789012", "", 0 },
/* 43*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "26,26,12345678901234567890123456789012", "", 0 }, /* 43*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "A,26,12345678901234567890123456789012", "Error 155: Invalid Structured Append index (digits only)", 0 },
/* 44*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "A,26,12345678901234567890123456789012", "Error 160: Invalid Structured Append index (digits only)", 0 }, /* 44*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "26,A,12345678901234567890123456789012", "Error 155: Invalid Structured Append count (digits only)", 0 },
/* 45*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "26,A,12345678901234567890123456789012", "Error 161: Invalid Structured Append count (digits only)", 0 }, /* 45*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "26,1,12345678901234567890123456789012", "Error 155: Invalid Structured Append count '1', must be greater than or equal to 2", 0 },
/* 46*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "26,1,12345678901234567890123456789012", "Error 162: Invalid Structured Append count '1', must be greater than or equal to 2", 0 }, /* 46*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "0,2,12345678901234567890123456789012", "Error 155: Structured Append index '0' out of range (1 to count '2')", 0 },
/* 47*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "0,2,12345678901234567890123456789012", "Error 163: Structured Append index '0' out of range (1 to count '2')", 0 }, /* 47*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "3,2,12345678901234567890123456789012", "Error 155: Structured Append index '3' out of range (1 to count '2')", 0 },
/* 48*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "3,2,12345678901234567890123456789012", "Error 163: Structured Append index '3' out of range (1 to count '2')", 0 }, /* 48*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "2,3,12345678901234567890123456789012", "", 0 },
/* 49*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "2,3,12345678901234567890123456789012", "", 0 }, /* 49*/ { BARCODE_PDF417, "1", -1, " --heightperrow", "", "", 0 },
/* 50*/ { BARCODE_PDF417, "1", -1, " --heightperrow", "", "", 0 }, /* 50*/ { -1, NULL, -1, " -v", NULL, "Zint version ", 1 },
/* 51*/ { -1, NULL, -1, " -v", NULL, "Zint version ", 1 }, /* 51*/ { -1, NULL, -1, " --version", NULL, "Zint version ", 1 },
/* 52*/ { -1, NULL, -1, " --version", NULL, "Zint version ", 1 }, /* 52*/ { -1, NULL, -1, " -h", NULL, "Encode input data in a barcode ", 1 },
/* 53*/ { -1, NULL, -1, " -h", NULL, "Encode input data in a barcode ", 1 }, /* 53*/ { -1, NULL, -1, " -e", NULL, "3: ISO/IEC 8859-1 ", 1 },
/* 54*/ { -1, NULL, -1, " -e", NULL, "3: ISO/IEC 8859-1 ", 1 }, /* 54*/ { -1, NULL, -1, " -t", NULL, "1 CODE11 ", 1 },
/* 55*/ { -1, NULL, -1, " -t", NULL, "1 CODE11 ", 1 }, /* 55*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "12345678", "Error 184: scalexdimdp X-dim invalid floating point: integer part must be 7 digits maximum", 0 },
/* 56*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "12345678", "Error 178: scalexdimdp X-dim invalid floating point (integer part must be 7 digits maximum)", 0 }, /* 56*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "1234567890123", "Error 184: scalexdimdp X-dim too long", 0 },
/* 57*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "1234567890123", "Error 176: scalexdimdp X-dim too long", 0 }, /* 57*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "123456.12", "Error 184: scalexdimdp X-dim invalid floating point: 7 significant digits maximum", 0 },
/* 58*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "123456.12", "Error 178: scalexdimdp X-dim invalid floating point (7 significant digits maximum)", 0 }, /* 58*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", ",12.34", "Error 184: scalexdimdp X-dim too short", 0 },
/* 59*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", ",12.34", "Error 174: scalexdimdp X-dim too short", 0 }, /* 59*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "12.34,", "Error 184: scalexdimdp resolution too short", 0 },
/* 60*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "12.34,", "Error 175: scalexdimdp resolution too short", 0 }, /* 60*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "12mm1", "Error 184: scalexdimdp X-dim unknown units: mm1", 0 },
/* 61*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "12mm1", "Error 177: scalexdimdp X-dim units must occur at end", 0 }, /* 61*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "1inc", "Error 184: scalexdimdp X-dim unknown units: inc", 0 },
/* 62*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "1inc", "Error 177: scalexdimdp X-dim units must occur at end", 0 }, /* 62*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "12.34in,123x", "Error 184: scalexdimdp resolution unknown units: x", 0 },
/* 63*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "1234x", "Error 178: scalexdimdp X-dim invalid floating point (integer part must be digits only)", 0 }, /* 63*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "12,123.45678", "Error 184: scalexdimdp resolution invalid floating point: 7 significant digits maximum", 0 },
/* 64*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "12.34in,123x", "Error 180: scalexdimdp resolution invalid floating point (integer part must be digits only)", 0 }, /* 64*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "10.1,1000", "Warning 185: scalexdimdp X-dim '10.1' out of range (greater than 10), **IGNORED**", 0 },
/* 65*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "12,123.45678", "Error 180: scalexdimdp resolution invalid floating point (7 significant digits maximum)", 0 }, /* 65*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "10,1000.1", "Warning 186: scalexdimdp resolution '1000.1' out of range (greater than 1000), **IGNORED**", 0 },
/* 66*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "10.1,1000", "Warning 185: scalexdimdp X-dim '10.1' out of range (greater than 10), **IGNORED**", 0 },
/* 67*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "10,1000.1", "Warning 186: scalexdimdp resolution '1000.1' out of range (greater than 1000), **IGNORED**", 0 },
}; };
int data_size = ARRAY_SIZE(data); int data_size = ARRAY_SIZE(data);
int i; int i;
+4 -4
View File
@@ -3588,17 +3588,17 @@ void MainWindow::copy_to_clipboard(const QString &filename, const QString& name,
{ {
QClipboard *clipboard = QGuiApplication::clipboard(); QClipboard *clipboard = QGuiApplication::clipboard();
QByteArray data; QByteArray fdata;
if (!m_bc.bc.save_to_memfile(filename, data)) { if (!m_bc.bc.save_to_memfile(filename, fdata)) {
return; return;
} }
QMimeData *mdata = new QMimeData; QMimeData *mdata = new QMimeData;
if (mimeType) { if (mimeType) {
mdata->setData(mimeType, data); mdata->setData(mimeType, fdata);
} else { } else {
QImage img; QImage img;
img.loadFromData(data); img.loadFromData(fdata);
mdata->setImageData(img); mdata->setImageData(img);
} }
clipboard->setMimeData(mdata, QClipboard::Clipboard); clipboard->setMimeData(mdata, QClipboard::Clipboard);