emf free malloc bufs; tif don't free alloca bufs (Win); -Wextra; tests
@ -455,7 +455,7 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha
|
|||||||
int input_position, array_length, i;
|
int input_position, array_length, i;
|
||||||
char encoding_mode;
|
char encoding_mode;
|
||||||
int inside_macro;
|
int inside_macro;
|
||||||
int debug = symbol->debug;
|
int debug = (symbol->debug & ZINT_DEBUG_PRINT);
|
||||||
int binary_buffer_size = 0;
|
int binary_buffer_size = 0;
|
||||||
int lawrencium[6]; // Reversed radix 103 values
|
int lawrencium[6]; // Reversed radix 103 values
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/* eci.c - Extended Channel Interpretations
|
/* eci.c - Extended Channel Interpretations
|
||||||
|
|
||||||
libzint - the open source barcode library
|
libzint - the open source barcode library
|
||||||
Copyright (C) 2009-2017 Robin Stuart <rstuart114@gmail.com>
|
Copyright (C) 2009 - 2020 Robin Stuart <rstuart114@gmail.com>
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions
|
modification, are permitted provided that the following conditions
|
||||||
@ -32,7 +32,6 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#include "eci.h"
|
#include "eci.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
@ -70,7 +69,7 @@ INTERNAL int utf_to_eci(const int eci, const unsigned char source[], unsigned ch
|
|||||||
bytelen = 2;
|
bytelen = 2;
|
||||||
glyph = (source[in_posn] & 0x1f) << 6;
|
glyph = (source[in_posn] & 0x1f) << 6;
|
||||||
|
|
||||||
if (*length < (in_posn + 2)) {
|
if ((int) *length < (in_posn + 2)) {
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,11 +85,11 @@ INTERNAL int utf_to_eci(const int eci, const unsigned char source[], unsigned ch
|
|||||||
bytelen = 3;
|
bytelen = 3;
|
||||||
glyph = (source[in_posn] & 0x0f) << 12;
|
glyph = (source[in_posn] & 0x0f) << 12;
|
||||||
|
|
||||||
if (*length < (in_posn + 2)) {
|
if ((int) *length < (in_posn + 2)) {
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*length < (in_posn + 3)) {
|
if ((int) *length < (in_posn + 3)) {
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,7 +245,7 @@ INTERNAL int utf_to_eci(const int eci, const unsigned char source[], unsigned ch
|
|||||||
|
|
||||||
in_posn += bytelen;
|
in_posn += bytelen;
|
||||||
out_posn++;
|
out_posn++;
|
||||||
} while (in_posn < *length);
|
} while (in_posn < (int) *length);
|
||||||
dest[out_posn] = '\0';
|
dest[out_posn] = '\0';
|
||||||
*length = out_posn;
|
*length = out_posn;
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/* emf.c - Support for Microsoft Enhanced Metafile Format
|
/* emf.c - Support for Microsoft Enhanced Metafile Format
|
||||||
|
|
||||||
libzint - the open source barcode library
|
libzint - the open source barcode library
|
||||||
Copyright (C) 2016-2018 Robin Stuart <rstuart114@gmail.com>
|
Copyright (C) 2016 - 2020 Robin Stuart <rstuart114@gmail.com>
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions
|
modification, are permitted provided that the following conditions
|
||||||
@ -181,10 +181,10 @@ INTERNAL int emf_plot(struct zint_symbol *symbol) {
|
|||||||
string_count = count_strings(symbol);
|
string_count = count_strings(symbol);
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
emr_rectangle_t rectangle[rectangle_count];
|
emr_rectangle_t rectangle[rectangle_count ? rectangle_count : 1]; // Avoid sanitize runtime error by making always non-zero
|
||||||
emr_ellipse_t circle[circle_count];
|
emr_ellipse_t circle[circle_count ? circle_count : 1];
|
||||||
emr_polygon_t hexagon[hexagon_count];
|
emr_polygon_t hexagon[hexagon_count ? hexagon_count : 1];
|
||||||
emr_exttextoutw_t text[string_count];
|
emr_exttextoutw_t text[string_count ? string_count: 1];
|
||||||
#else
|
#else
|
||||||
rectangle = (emr_rectangle_t*) _alloca(rectangle_count * sizeof (emr_rectangle_t));
|
rectangle = (emr_rectangle_t*) _alloca(rectangle_count * sizeof (emr_rectangle_t));
|
||||||
circle = (emr_ellipse_t*) _alloca(circle_count * sizeof (emr_ellipse_t));
|
circle = (emr_ellipse_t*) _alloca(circle_count * sizeof (emr_ellipse_t));
|
||||||
@ -509,6 +509,7 @@ INTERNAL int emf_plot(struct zint_symbol *symbol) {
|
|||||||
fwrite(&emr_selectobject_font, sizeof (emr_selectobject_t), 1, emf_file);
|
fwrite(&emr_selectobject_font, sizeof (emr_selectobject_t), 1, emf_file);
|
||||||
fwrite(&text[i], sizeof (emr_exttextoutw_t), 1, emf_file);
|
fwrite(&text[i], sizeof (emr_exttextoutw_t), 1, emf_file);
|
||||||
fwrite(this_string[i], bump_up(text[i].w_emr_text.chars + 1) * 2, 1, emf_file);
|
fwrite(this_string[i], bump_up(text[i].w_emr_text.chars + 1) * 2, 1, emf_file);
|
||||||
|
free(this_string[i]);
|
||||||
for (j = 0; j < bump_up(text[i].w_emr_text.chars + 1); j++) {
|
for (j = 0; j < bump_up(text[i].w_emr_text.chars + 1); j++) {
|
||||||
fwrite(&spacing, 4, 1, emf_file);
|
fwrite(&spacing, 4, 1, emf_file);
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
libzint - the open source barcode library
|
libzint - the open source barcode library
|
||||||
Copyright (C) 2009-2017 Robin Stuart <rstuart114@gmail.com>
|
Copyright (C) 2009 - 2020 Robin Stuart <rstuart114@gmail.com>
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions
|
modification, are permitted provided that the following conditions
|
||||||
@ -32,7 +32,6 @@
|
|||||||
/* vim: set ts=4 sw=4 et : */
|
/* vim: set ts=4 sw=4 et : */
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
@ -93,7 +92,7 @@ INTERNAL int gs1_verify(struct zint_symbol *symbol, const unsigned char source[]
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Detect extended ASCII characters */
|
/* Detect extended ASCII characters */
|
||||||
for (i = 0; i < src_len; i++) {
|
for (i = 0; i < (int) src_len; i++) {
|
||||||
if (source[i] >= 128) {
|
if (source[i] >= 128) {
|
||||||
strcpy(symbol->errtxt, "250: Extended ASCII characters are not supported by GS1");
|
strcpy(symbol->errtxt, "250: Extended ASCII characters are not supported by GS1");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
@ -121,7 +120,7 @@ INTERNAL int gs1_verify(struct zint_symbol *symbol, const unsigned char source[]
|
|||||||
min_ai_length = 5;
|
min_ai_length = 5;
|
||||||
j = 0;
|
j = 0;
|
||||||
ai_latch = 0;
|
ai_latch = 0;
|
||||||
for (i = 0; i < src_len; i++) {
|
for (i = 0; i < (int) src_len; i++) {
|
||||||
ai_length += j;
|
ai_length += j;
|
||||||
if (((j == 1) && (source[i] != ']')) && ((source[i] < '0') || (source[i] > '9'))) {
|
if (((j == 1) && (source[i] != ']')) && ((source[i] < '0') || (source[i] > '9'))) {
|
||||||
ai_latch = 1;
|
ai_latch = 1;
|
||||||
@ -178,7 +177,7 @@ INTERNAL int gs1_verify(struct zint_symbol *symbol, const unsigned char source[]
|
|||||||
}
|
}
|
||||||
|
|
||||||
ai_count = 0;
|
ai_count = 0;
|
||||||
for (i = 1; i < src_len; i++) {
|
for (i = 1; i < (int) src_len; i++) {
|
||||||
if (source[i - 1] == '[') {
|
if (source[i - 1] == '[') {
|
||||||
ai_location[ai_count] = i;
|
ai_location[ai_count] = i;
|
||||||
j = 0;
|
j = 0;
|
||||||
@ -203,7 +202,7 @@ INTERNAL int gs1_verify(struct zint_symbol *symbol, const unsigned char source[]
|
|||||||
data_length[i] = 0;
|
data_length[i] = 0;
|
||||||
do {
|
do {
|
||||||
data_length[i]++;
|
data_length[i]++;
|
||||||
} while ((source[data_location[i] + data_length[i] - 1] != '[') && (data_location[i] + data_length[i] <= src_len));
|
} while ((source[data_location[i] + data_length[i] - 1] != '[') && (data_location[i] + data_length[i] <= (int) src_len));
|
||||||
data_length[i]--;
|
data_length[i]--;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -662,7 +661,7 @@ INTERNAL int gs1_verify(struct zint_symbol *symbol, const unsigned char source[]
|
|||||||
j = 0;
|
j = 0;
|
||||||
last_ai = 0;
|
last_ai = 0;
|
||||||
ai_latch = 1;
|
ai_latch = 1;
|
||||||
for (i = 0; i < src_len; i++) {
|
for (i = 0; i < (int) src_len; i++) {
|
||||||
if ((source[i] != '[') && (source[i] != ']')) {
|
if ((source[i] != '[') && (source[i] != ']')) {
|
||||||
reduced[j++] = source[i];
|
reduced[j++] = source[i];
|
||||||
}
|
}
|
||||||
|
@ -124,11 +124,11 @@ INTERNAL void rs_init_code(const int nsym, int index) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
INTERNAL void rs_encode(const size_t len,const unsigned char *data, unsigned char *res) {
|
INTERNAL void rs_encode(const size_t len, const unsigned char *data, unsigned char *res) {
|
||||||
int i, k;
|
int i, k;
|
||||||
for (i = 0; i < rlen; i++)
|
for (i = 0; i < rlen; i++)
|
||||||
res[i] = 0;
|
res[i] = 0;
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < (int) len; i++) {
|
||||||
int m = res[rlen - 1] ^ data[i];
|
int m = res[rlen - 1] ^ data[i];
|
||||||
for (k = rlen - 1; k > 0; k--) {
|
for (k = rlen - 1; k > 0; k--) {
|
||||||
if (m && rspoly[k])
|
if (m && rspoly[k])
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
libzint - the open source barcode library
|
libzint - the open source barcode library
|
||||||
Copyright (C) 2009-2019 Robin Stuart <rstuart114@gmail.com>
|
Copyright (C) 2009 - 2020 Robin Stuart <rstuart114@gmail.com>
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions
|
modification, are permitted provided that the following conditions
|
||||||
@ -33,7 +33,6 @@
|
|||||||
|
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
@ -50,7 +49,7 @@ static void make_html_friendly(unsigned char * string, char * html_version) {
|
|||||||
html_pos = 0;
|
html_pos = 0;
|
||||||
html_version[html_pos] = '\0';
|
html_version[html_pos] = '\0';
|
||||||
|
|
||||||
for (i = 0; i < ustrlen(string); i++) {
|
for (i = 0; i < (int) ustrlen(string); i++) {
|
||||||
switch(string[i]) {
|
switch(string[i]) {
|
||||||
case '>':
|
case '>':
|
||||||
strcat(html_version, ">");
|
strcat(html_version, ">");
|
||||||
@ -105,7 +104,7 @@ INTERNAL int svg_plot(struct zint_symbol *symbol) {
|
|||||||
|
|
||||||
int html_len = strlen((char *)symbol->text) + 1;
|
int html_len = strlen((char *)symbol->text) + 1;
|
||||||
|
|
||||||
for (i = 0; i < strlen((char *)symbol->text); i++) {
|
for (i = 0; i < (int) strlen((char *)symbol->text); i++) {
|
||||||
switch(symbol->text[i]) {
|
switch(symbol->text[i]) {
|
||||||
case '>':
|
case '>':
|
||||||
case '<':
|
case '<':
|
||||||
|
@ -73,6 +73,7 @@ zint_add_test(maxicode, test_maxicode)
|
|||||||
zint_add_test(pdf417, test_pdf417)
|
zint_add_test(pdf417, test_pdf417)
|
||||||
zint_add_test(png, test_png)
|
zint_add_test(png, test_png)
|
||||||
zint_add_test(postal, test_postal)
|
zint_add_test(postal, test_postal)
|
||||||
|
zint_add_test(print, test_print)
|
||||||
zint_add_test(qr, test_qr)
|
zint_add_test(qr, test_qr)
|
||||||
zint_add_test(raster, test_raster)
|
zint_add_test(raster, test_raster)
|
||||||
zint_add_test(rss, test_rss)
|
zint_add_test(rss, test_rss)
|
||||||
|
BIN
backend/tests/data/print/bmp/code128_aim.bmp
Normal file
After Width: | Height: | Size: 47 KiB |
BIN
backend/tests/data/print/bmp/dotcode_aim_fig7.bmp
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
backend/tests/data/print/bmp/qr_v1_m.bmp
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
backend/tests/data/print/emf/code128_aim.emf
Normal file
BIN
backend/tests/data/print/emf/dotcode_aim_fig7.emf
Normal file
BIN
backend/tests/data/print/emf/qr_v1_m.emf
Normal file
64
backend/tests/data/print/eps/code128_aim.eps
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
%!PS-Adobe-3.0 EPSF-3.0
|
||||||
|
%%Creator: Zint 2.7.1
|
||||||
|
%%Title: Zint Generated Symbol
|
||||||
|
%%Pages: 0
|
||||||
|
%%BoundingBox: 0 0 136 118
|
||||||
|
%%EndComments
|
||||||
|
/TL { setlinewidth moveto lineto stroke } bind def
|
||||||
|
/TD { newpath 0 360 arc fill } bind def
|
||||||
|
/TH { 0 setlinewidth moveto lineto lineto lineto lineto lineto closepath fill } bind def
|
||||||
|
/TB { 2 copy } bind def
|
||||||
|
/TR { newpath 4 1 roll exch moveto 1 index 0 rlineto 0 exch rlineto neg 0 rlineto closepath fill } bind def
|
||||||
|
/TE { pop pop } bind def
|
||||||
|
newpath
|
||||||
|
1.00 1.00 1.00 setrgbcolor
|
||||||
|
118.00 0.00 TB 0.00 136.00 TR
|
||||||
|
TE
|
||||||
|
0.00 0.00 0.00 setrgbcolor
|
||||||
|
100.00 18.00 TB 0.00 4.00 TR
|
||||||
|
TE
|
||||||
|
100.00 18.00 TB 6.00 2.00 TR
|
||||||
|
TE
|
||||||
|
100.00 18.00 TB 12.00 2.00 TR
|
||||||
|
TE
|
||||||
|
100.00 18.00 TB 22.00 2.00 TR
|
||||||
|
TE
|
||||||
|
100.00 18.00 TB 26.00 2.00 TR
|
||||||
|
TE
|
||||||
|
100.00 18.00 TB 34.00 4.00 TR
|
||||||
|
TE
|
||||||
|
100.00 18.00 TB 44.00 4.00 TR
|
||||||
|
TE
|
||||||
|
100.00 18.00 TB 54.00 2.00 TR
|
||||||
|
TE
|
||||||
|
100.00 18.00 TB 62.00 2.00 TR
|
||||||
|
TE
|
||||||
|
100.00 18.00 TB 66.00 2.00 TR
|
||||||
|
TE
|
||||||
|
100.00 18.00 TB 70.00 6.00 TR
|
||||||
|
TE
|
||||||
|
100.00 18.00 TB 78.00 4.00 TR
|
||||||
|
TE
|
||||||
|
100.00 18.00 TB 88.00 2.00 TR
|
||||||
|
TE
|
||||||
|
100.00 18.00 TB 92.00 6.00 TR
|
||||||
|
TE
|
||||||
|
100.00 18.00 TB 100.00 4.00 TR
|
||||||
|
TE
|
||||||
|
100.00 18.00 TB 110.00 4.00 TR
|
||||||
|
TE
|
||||||
|
100.00 18.00 TB 120.00 6.00 TR
|
||||||
|
TE
|
||||||
|
100.00 18.00 TB 128.00 2.00 TR
|
||||||
|
TE
|
||||||
|
100.00 18.00 TB 132.00 4.00 TR
|
||||||
|
TE
|
||||||
|
matrix currentmatrix
|
||||||
|
/Helvetica findfont
|
||||||
|
18.00 scalefont setfont
|
||||||
|
0 0 moveto 68.00 0.00 translate 0.00 rotate 0 0 moveto
|
||||||
|
(AIM) stringwidth
|
||||||
|
pop
|
||||||
|
-2 div 0 rmoveto
|
||||||
|
(AIM) show
|
||||||
|
setmatrix
|
56
backend/tests/data/print/eps/dotcode_aim_fig7.eps
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
%!PS-Adobe-3.0 EPSF-3.0
|
||||||
|
%%Creator: Zint 2.7.1
|
||||||
|
%%Title: Zint Generated Symbol
|
||||||
|
%%Pages: 0
|
||||||
|
%%BoundingBox: 0 0 26 20
|
||||||
|
%%EndComments
|
||||||
|
/TL { setlinewidth moveto lineto stroke } bind def
|
||||||
|
/TD { newpath 0 360 arc fill } bind def
|
||||||
|
/TH { 0 setlinewidth moveto lineto lineto lineto lineto lineto closepath fill } bind def
|
||||||
|
/TB { 2 copy } bind def
|
||||||
|
/TR { newpath 4 1 roll exch moveto 1 index 0 rlineto 0 exch rlineto neg 0 rlineto closepath fill } bind def
|
||||||
|
/TE { pop pop } bind def
|
||||||
|
newpath
|
||||||
|
1.00 1.00 1.00 setrgbcolor
|
||||||
|
20.00 0.00 TB 0.00 26.00 TR
|
||||||
|
TE
|
||||||
|
0.00 0.00 0.00 setrgbcolor
|
||||||
|
1.00 19.00 1.00 TD
|
||||||
|
5.00 19.00 1.00 TD
|
||||||
|
13.00 19.00 1.00 TD
|
||||||
|
17.00 19.00 1.00 TD
|
||||||
|
21.00 19.00 1.00 TD
|
||||||
|
25.00 19.00 1.00 TD
|
||||||
|
7.00 17.00 1.00 TD
|
||||||
|
1.00 15.00 1.00 TD
|
||||||
|
9.00 15.00 1.00 TD
|
||||||
|
17.00 15.00 1.00 TD
|
||||||
|
21.00 15.00 1.00 TD
|
||||||
|
25.00 15.00 1.00 TD
|
||||||
|
3.00 13.00 1.00 TD
|
||||||
|
15.00 13.00 1.00 TD
|
||||||
|
19.00 13.00 1.00 TD
|
||||||
|
9.00 11.00 1.00 TD
|
||||||
|
13.00 11.00 1.00 TD
|
||||||
|
21.00 11.00 1.00 TD
|
||||||
|
3.00 9.00 1.00 TD
|
||||||
|
11.00 9.00 1.00 TD
|
||||||
|
23.00 9.00 1.00 TD
|
||||||
|
1.00 7.00 1.00 TD
|
||||||
|
9.00 7.00 1.00 TD
|
||||||
|
13.00 7.00 1.00 TD
|
||||||
|
17.00 7.00 1.00 TD
|
||||||
|
25.00 7.00 1.00 TD
|
||||||
|
3.00 5.00 1.00 TD
|
||||||
|
7.00 5.00 1.00 TD
|
||||||
|
11.00 5.00 1.00 TD
|
||||||
|
19.00 5.00 1.00 TD
|
||||||
|
1.00 3.00 1.00 TD
|
||||||
|
9.00 3.00 1.00 TD
|
||||||
|
17.00 3.00 1.00 TD
|
||||||
|
21.00 3.00 1.00 TD
|
||||||
|
25.00 3.00 1.00 TD
|
||||||
|
3.00 1.00 1.00 TD
|
||||||
|
7.00 1.00 1.00 TD
|
||||||
|
15.00 1.00 1.00 TD
|
||||||
|
23.00 1.00 1.00 TD
|
181
backend/tests/data/print/eps/qr_v1_m.eps
Normal file
@ -0,0 +1,181 @@
|
|||||||
|
%!PS-Adobe-3.0 EPSF-3.0
|
||||||
|
%%Creator: Zint 2.7.1
|
||||||
|
%%Title: Zint Generated Symbol
|
||||||
|
%%Pages: 0
|
||||||
|
%%BoundingBox: 0 0 42 42
|
||||||
|
%%EndComments
|
||||||
|
/TL { setlinewidth moveto lineto stroke } bind def
|
||||||
|
/TD { newpath 0 360 arc fill } bind def
|
||||||
|
/TH { 0 setlinewidth moveto lineto lineto lineto lineto lineto closepath fill } bind def
|
||||||
|
/TB { 2 copy } bind def
|
||||||
|
/TR { newpath 4 1 roll exch moveto 1 index 0 rlineto 0 exch rlineto neg 0 rlineto closepath fill } bind def
|
||||||
|
/TE { pop pop } bind def
|
||||||
|
newpath
|
||||||
|
1.00 1.00 1.00 setrgbcolor
|
||||||
|
42.00 0.00 TB 0.00 42.00 TR
|
||||||
|
TE
|
||||||
|
0.00 0.00 0.00 setrgbcolor
|
||||||
|
2.00 40.00 TB 0.00 14.00 TR
|
||||||
|
TE
|
||||||
|
2.00 40.00 TB 18.00 2.00 TR
|
||||||
|
TE
|
||||||
|
2.00 40.00 TB 24.00 2.00 TR
|
||||||
|
TE
|
||||||
|
2.00 40.00 TB 28.00 14.00 TR
|
||||||
|
TE
|
||||||
|
10.00 30.00 TB 0.00 2.00 TR
|
||||||
|
TE
|
||||||
|
10.00 30.00 TB 12.00 2.00 TR
|
||||||
|
TE
|
||||||
|
2.00 38.00 TB 16.00 2.00 TR
|
||||||
|
TE
|
||||||
|
2.00 38.00 TB 22.00 4.00 TR
|
||||||
|
TE
|
||||||
|
10.00 30.00 TB 28.00 2.00 TR
|
||||||
|
TE
|
||||||
|
10.00 30.00 TB 40.00 2.00 TR
|
||||||
|
TE
|
||||||
|
6.00 32.00 TB 4.00 6.00 TR
|
||||||
|
TE
|
||||||
|
2.00 36.00 TB 18.00 2.00 TR
|
||||||
|
TE
|
||||||
|
6.00 32.00 TB 32.00 6.00 TR
|
||||||
|
TE
|
||||||
|
8.00 28.00 TB 24.00 2.00 TR
|
||||||
|
TE
|
||||||
|
2.00 32.00 TB 16.00 4.00 TR
|
||||||
|
TE
|
||||||
|
2.00 28.00 TB 0.00 14.00 TR
|
||||||
|
TE
|
||||||
|
2.00 28.00 TB 16.00 2.00 TR
|
||||||
|
TE
|
||||||
|
2.00 28.00 TB 20.00 2.00 TR
|
||||||
|
TE
|
||||||
|
2.00 28.00 TB 28.00 14.00 TR
|
||||||
|
TE
|
||||||
|
2.00 26.00 TB 18.00 2.00 TR
|
||||||
|
TE
|
||||||
|
2.00 26.00 TB 22.00 4.00 TR
|
||||||
|
TE
|
||||||
|
2.00 24.00 TB 0.00 2.00 TR
|
||||||
|
TE
|
||||||
|
2.00 24.00 TB 4.00 2.00 TR
|
||||||
|
TE
|
||||||
|
2.00 24.00 TB 8.00 2.00 TR
|
||||||
|
TE
|
||||||
|
2.00 24.00 TB 12.00 2.00 TR
|
||||||
|
TE
|
||||||
|
2.00 24.00 TB 18.00 6.00 TR
|
||||||
|
TE
|
||||||
|
2.00 24.00 TB 32.00 2.00 TR
|
||||||
|
TE
|
||||||
|
2.00 24.00 TB 38.00 2.00 TR
|
||||||
|
TE
|
||||||
|
2.00 22.00 TB 0.00 12.00 TR
|
||||||
|
TE
|
||||||
|
2.00 22.00 TB 14.00 4.00 TR
|
||||||
|
TE
|
||||||
|
2.00 22.00 TB 20.00 2.00 TR
|
||||||
|
TE
|
||||||
|
2.00 22.00 TB 28.00 2.00 TR
|
||||||
|
TE
|
||||||
|
2.00 22.00 TB 40.00 2.00 TR
|
||||||
|
TE
|
||||||
|
6.00 16.00 TB 0.00 2.00 TR
|
||||||
|
TE
|
||||||
|
2.00 20.00 TB 4.00 14.00 TR
|
||||||
|
TE
|
||||||
|
2.00 20.00 TB 24.00 2.00 TR
|
||||||
|
TE
|
||||||
|
2.00 20.00 TB 32.00 4.00 TR
|
||||||
|
TE
|
||||||
|
4.00 16.00 TB 8.00 2.00 TR
|
||||||
|
TE
|
||||||
|
4.00 16.00 TB 28.00 2.00 TR
|
||||||
|
TE
|
||||||
|
2.00 18.00 TB 34.00 2.00 TR
|
||||||
|
TE
|
||||||
|
2.00 18.00 TB 40.00 2.00 TR
|
||||||
|
TE
|
||||||
|
2.00 16.00 TB 12.00 2.00 TR
|
||||||
|
TE
|
||||||
|
2.00 16.00 TB 24.00 2.00 TR
|
||||||
|
TE
|
||||||
|
2.00 16.00 TB 32.00 2.00 TR
|
||||||
|
TE
|
||||||
|
2.00 16.00 TB 38.00 4.00 TR
|
||||||
|
TE
|
||||||
|
2.00 14.00 TB 16.00 8.00 TR
|
||||||
|
TE
|
||||||
|
2.00 14.00 TB 26.00 2.00 TR
|
||||||
|
TE
|
||||||
|
2.00 14.00 TB 30.00 2.00 TR
|
||||||
|
TE
|
||||||
|
4.00 12.00 TB 34.00 2.00 TR
|
||||||
|
TE
|
||||||
|
2.00 14.00 TB 38.00 2.00 TR
|
||||||
|
TE
|
||||||
|
2.00 12.00 TB 0.00 14.00 TR
|
||||||
|
TE
|
||||||
|
2.00 12.00 TB 20.00 4.00 TR
|
||||||
|
TE
|
||||||
|
2.00 12.00 TB 26.00 6.00 TR
|
||||||
|
TE
|
||||||
|
10.00 2.00 TB 0.00 2.00 TR
|
||||||
|
TE
|
||||||
|
10.00 2.00 TB 12.00 2.00 TR
|
||||||
|
TE
|
||||||
|
2.00 10.00 TB 18.00 2.00 TR
|
||||||
|
TE
|
||||||
|
2.00 10.00 TB 22.00 6.00 TR
|
||||||
|
TE
|
||||||
|
2.00 10.00 TB 30.00 6.00 TR
|
||||||
|
TE
|
||||||
|
2.00 10.00 TB 38.00 4.00 TR
|
||||||
|
TE
|
||||||
|
6.00 4.00 TB 4.00 6.00 TR
|
||||||
|
TE
|
||||||
|
2.00 8.00 TB 16.00 2.00 TR
|
||||||
|
TE
|
||||||
|
2.00 8.00 TB 20.00 4.00 TR
|
||||||
|
TE
|
||||||
|
2.00 8.00 TB 26.00 6.00 TR
|
||||||
|
TE
|
||||||
|
2.00 8.00 TB 34.00 4.00 TR
|
||||||
|
TE
|
||||||
|
2.00 8.00 TB 40.00 2.00 TR
|
||||||
|
TE
|
||||||
|
2.00 6.00 TB 20.00 2.00 TR
|
||||||
|
TE
|
||||||
|
2.00 6.00 TB 28.00 4.00 TR
|
||||||
|
TE
|
||||||
|
2.00 6.00 TB 38.00 2.00 TR
|
||||||
|
TE
|
||||||
|
2.00 4.00 TB 16.00 2.00 TR
|
||||||
|
TE
|
||||||
|
2.00 4.00 TB 24.00 2.00 TR
|
||||||
|
TE
|
||||||
|
2.00 4.00 TB 32.00 6.00 TR
|
||||||
|
TE
|
||||||
|
2.00 4.00 TB 40.00 2.00 TR
|
||||||
|
TE
|
||||||
|
2.00 2.00 TB 18.00 2.00 TR
|
||||||
|
TE
|
||||||
|
2.00 2.00 TB 28.00 4.00 TR
|
||||||
|
TE
|
||||||
|
2.00 2.00 TB 34.00 2.00 TR
|
||||||
|
TE
|
||||||
|
2.00 0.00 TB 0.00 14.00 TR
|
||||||
|
TE
|
||||||
|
2.00 0.00 TB 16.00 6.00 TR
|
||||||
|
TE
|
||||||
|
2.00 0.00 TB 24.00 2.00 TR
|
||||||
|
TE
|
||||||
|
2.00 0.00 TB 28.00 2.00 TR
|
||||||
|
TE
|
||||||
|
2.00 0.00 TB 32.00 2.00 TR
|
||||||
|
TE
|
||||||
|
2.00 0.00 TB 36.00 2.00 TR
|
||||||
|
TE
|
||||||
|
2.00 0.00 TB 40.00 2.00 TR
|
||||||
|
TE
|
BIN
backend/tests/data/print/gif/code128_aim.gif
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
backend/tests/data/print/gif/dotcode_aim_fig7.gif
Normal file
After Width: | Height: | Size: 83 B |
BIN
backend/tests/data/print/gif/qr_v1_m.gif
Normal file
After Width: | Height: | Size: 248 B |
BIN
backend/tests/data/print/pcx/code128_aim.pcx
Normal file
BIN
backend/tests/data/print/pcx/dotcode_aim_fig7.pcx
Normal file
BIN
backend/tests/data/print/pcx/qr_v1_m.pcx
Normal file
Before Width: | Height: | Size: 372 B After Width: | Height: | Size: 372 B |
BIN
backend/tests/data/print/png/dotcode_aim_fig7.png
Normal file
After Width: | Height: | Size: 145 B |
BIN
backend/tests/data/print/png/qr_v1_m.png
Normal file
After Width: | Height: | Size: 295 B |
35
backend/tests/data/print/svg/code128_aim.svg
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?>
|
||||||
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
|
||||||
|
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||||
|
<svg width="136" height="118" version="1.1"
|
||||||
|
xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<desc>Zint Generated Symbol
|
||||||
|
</desc>
|
||||||
|
|
||||||
|
<g id="barcode" fill="#000000">
|
||||||
|
<rect x="0" y="0" width="136" height="118" fill="#FFFFFF" />
|
||||||
|
<rect x="0.00" y="0.00" width="4.00" height="100.00" />
|
||||||
|
<rect x="6.00" y="0.00" width="2.00" height="100.00" />
|
||||||
|
<rect x="12.00" y="0.00" width="2.00" height="100.00" />
|
||||||
|
<rect x="22.00" y="0.00" width="2.00" height="100.00" />
|
||||||
|
<rect x="26.00" y="0.00" width="2.00" height="100.00" />
|
||||||
|
<rect x="34.00" y="0.00" width="4.00" height="100.00" />
|
||||||
|
<rect x="44.00" y="0.00" width="4.00" height="100.00" />
|
||||||
|
<rect x="54.00" y="0.00" width="2.00" height="100.00" />
|
||||||
|
<rect x="62.00" y="0.00" width="2.00" height="100.00" />
|
||||||
|
<rect x="66.00" y="0.00" width="2.00" height="100.00" />
|
||||||
|
<rect x="70.00" y="0.00" width="6.00" height="100.00" />
|
||||||
|
<rect x="78.00" y="0.00" width="4.00" height="100.00" />
|
||||||
|
<rect x="88.00" y="0.00" width="2.00" height="100.00" />
|
||||||
|
<rect x="92.00" y="0.00" width="6.00" height="100.00" />
|
||||||
|
<rect x="100.00" y="0.00" width="4.00" height="100.00" />
|
||||||
|
<rect x="110.00" y="0.00" width="4.00" height="100.00" />
|
||||||
|
<rect x="120.00" y="0.00" width="6.00" height="100.00" />
|
||||||
|
<rect x="128.00" y="0.00" width="2.00" height="100.00" />
|
||||||
|
<rect x="132.00" y="0.00" width="4.00" height="100.00" />
|
||||||
|
<text x="68.00" y="118.00" text-anchor="middle"
|
||||||
|
font-family="Helvetica" font-size="18.0" fill="#000000" >
|
||||||
|
AIM
|
||||||
|
</text>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.7 KiB |
51
backend/tests/data/print/svg/dotcode_aim_fig7.svg
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?>
|
||||||
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
|
||||||
|
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||||
|
<svg width="26" height="20" version="1.1"
|
||||||
|
xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<desc>Zint Generated Symbol
|
||||||
|
</desc>
|
||||||
|
|
||||||
|
<g id="barcode" fill="#000000">
|
||||||
|
<rect x="0" y="0" width="26" height="20" fill="#FFFFFF" />
|
||||||
|
<circle cx="1.00" cy="1.00" r="1.00" fill="#000000" />
|
||||||
|
<circle cx="5.00" cy="1.00" r="1.00" fill="#000000" />
|
||||||
|
<circle cx="13.00" cy="1.00" r="1.00" fill="#000000" />
|
||||||
|
<circle cx="17.00" cy="1.00" r="1.00" fill="#000000" />
|
||||||
|
<circle cx="21.00" cy="1.00" r="1.00" fill="#000000" />
|
||||||
|
<circle cx="25.00" cy="1.00" r="1.00" fill="#000000" />
|
||||||
|
<circle cx="7.00" cy="3.00" r="1.00" fill="#000000" />
|
||||||
|
<circle cx="1.00" cy="5.00" r="1.00" fill="#000000" />
|
||||||
|
<circle cx="9.00" cy="5.00" r="1.00" fill="#000000" />
|
||||||
|
<circle cx="17.00" cy="5.00" r="1.00" fill="#000000" />
|
||||||
|
<circle cx="21.00" cy="5.00" r="1.00" fill="#000000" />
|
||||||
|
<circle cx="25.00" cy="5.00" r="1.00" fill="#000000" />
|
||||||
|
<circle cx="3.00" cy="7.00" r="1.00" fill="#000000" />
|
||||||
|
<circle cx="15.00" cy="7.00" r="1.00" fill="#000000" />
|
||||||
|
<circle cx="19.00" cy="7.00" r="1.00" fill="#000000" />
|
||||||
|
<circle cx="9.00" cy="9.00" r="1.00" fill="#000000" />
|
||||||
|
<circle cx="13.00" cy="9.00" r="1.00" fill="#000000" />
|
||||||
|
<circle cx="21.00" cy="9.00" r="1.00" fill="#000000" />
|
||||||
|
<circle cx="3.00" cy="11.00" r="1.00" fill="#000000" />
|
||||||
|
<circle cx="11.00" cy="11.00" r="1.00" fill="#000000" />
|
||||||
|
<circle cx="23.00" cy="11.00" r="1.00" fill="#000000" />
|
||||||
|
<circle cx="1.00" cy="13.00" r="1.00" fill="#000000" />
|
||||||
|
<circle cx="9.00" cy="13.00" r="1.00" fill="#000000" />
|
||||||
|
<circle cx="13.00" cy="13.00" r="1.00" fill="#000000" />
|
||||||
|
<circle cx="17.00" cy="13.00" r="1.00" fill="#000000" />
|
||||||
|
<circle cx="25.00" cy="13.00" r="1.00" fill="#000000" />
|
||||||
|
<circle cx="3.00" cy="15.00" r="1.00" fill="#000000" />
|
||||||
|
<circle cx="7.00" cy="15.00" r="1.00" fill="#000000" />
|
||||||
|
<circle cx="11.00" cy="15.00" r="1.00" fill="#000000" />
|
||||||
|
<circle cx="19.00" cy="15.00" r="1.00" fill="#000000" />
|
||||||
|
<circle cx="1.00" cy="17.00" r="1.00" fill="#000000" />
|
||||||
|
<circle cx="9.00" cy="17.00" r="1.00" fill="#000000" />
|
||||||
|
<circle cx="17.00" cy="17.00" r="1.00" fill="#000000" />
|
||||||
|
<circle cx="21.00" cy="17.00" r="1.00" fill="#000000" />
|
||||||
|
<circle cx="25.00" cy="17.00" r="1.00" fill="#000000" />
|
||||||
|
<circle cx="3.00" cy="19.00" r="1.00" fill="#000000" />
|
||||||
|
<circle cx="7.00" cy="19.00" r="1.00" fill="#000000" />
|
||||||
|
<circle cx="15.00" cy="19.00" r="1.00" fill="#000000" />
|
||||||
|
<circle cx="23.00" cy="19.00" r="1.00" fill="#000000" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 2.7 KiB |
94
backend/tests/data/print/svg/qr_v1_m.svg
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?>
|
||||||
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
|
||||||
|
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||||
|
<svg width="42" height="42" version="1.1"
|
||||||
|
xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<desc>Zint Generated Symbol
|
||||||
|
</desc>
|
||||||
|
|
||||||
|
<g id="barcode" fill="#000000">
|
||||||
|
<rect x="0" y="0" width="42" height="42" fill="#FFFFFF" />
|
||||||
|
<rect x="0.00" y="0.00" width="14.00" height="2.00" />
|
||||||
|
<rect x="18.00" y="0.00" width="2.00" height="2.00" />
|
||||||
|
<rect x="24.00" y="0.00" width="2.00" height="2.00" />
|
||||||
|
<rect x="28.00" y="0.00" width="14.00" height="2.00" />
|
||||||
|
<rect x="0.00" y="2.00" width="2.00" height="10.00" />
|
||||||
|
<rect x="12.00" y="2.00" width="2.00" height="10.00" />
|
||||||
|
<rect x="16.00" y="2.00" width="2.00" height="2.00" />
|
||||||
|
<rect x="22.00" y="2.00" width="4.00" height="2.00" />
|
||||||
|
<rect x="28.00" y="2.00" width="2.00" height="10.00" />
|
||||||
|
<rect x="40.00" y="2.00" width="2.00" height="10.00" />
|
||||||
|
<rect x="4.00" y="4.00" width="6.00" height="6.00" />
|
||||||
|
<rect x="18.00" y="4.00" width="2.00" height="2.00" />
|
||||||
|
<rect x="32.00" y="4.00" width="6.00" height="6.00" />
|
||||||
|
<rect x="24.00" y="6.00" width="2.00" height="8.00" />
|
||||||
|
<rect x="16.00" y="8.00" width="4.00" height="2.00" />
|
||||||
|
<rect x="0.00" y="12.00" width="14.00" height="2.00" />
|
||||||
|
<rect x="16.00" y="12.00" width="2.00" height="2.00" />
|
||||||
|
<rect x="20.00" y="12.00" width="2.00" height="2.00" />
|
||||||
|
<rect x="28.00" y="12.00" width="14.00" height="2.00" />
|
||||||
|
<rect x="18.00" y="14.00" width="2.00" height="2.00" />
|
||||||
|
<rect x="22.00" y="14.00" width="4.00" height="2.00" />
|
||||||
|
<rect x="0.00" y="16.00" width="2.00" height="2.00" />
|
||||||
|
<rect x="4.00" y="16.00" width="2.00" height="2.00" />
|
||||||
|
<rect x="8.00" y="16.00" width="2.00" height="2.00" />
|
||||||
|
<rect x="12.00" y="16.00" width="2.00" height="2.00" />
|
||||||
|
<rect x="18.00" y="16.00" width="6.00" height="2.00" />
|
||||||
|
<rect x="32.00" y="16.00" width="2.00" height="2.00" />
|
||||||
|
<rect x="38.00" y="16.00" width="2.00" height="2.00" />
|
||||||
|
<rect x="0.00" y="18.00" width="12.00" height="2.00" />
|
||||||
|
<rect x="14.00" y="18.00" width="4.00" height="2.00" />
|
||||||
|
<rect x="20.00" y="18.00" width="2.00" height="2.00" />
|
||||||
|
<rect x="28.00" y="18.00" width="2.00" height="2.00" />
|
||||||
|
<rect x="40.00" y="18.00" width="2.00" height="2.00" />
|
||||||
|
<rect x="0.00" y="20.00" width="2.00" height="6.00" />
|
||||||
|
<rect x="4.00" y="20.00" width="14.00" height="2.00" />
|
||||||
|
<rect x="24.00" y="20.00" width="2.00" height="2.00" />
|
||||||
|
<rect x="32.00" y="20.00" width="4.00" height="2.00" />
|
||||||
|
<rect x="8.00" y="22.00" width="2.00" height="4.00" />
|
||||||
|
<rect x="28.00" y="22.00" width="2.00" height="4.00" />
|
||||||
|
<rect x="34.00" y="22.00" width="2.00" height="2.00" />
|
||||||
|
<rect x="40.00" y="22.00" width="2.00" height="2.00" />
|
||||||
|
<rect x="12.00" y="24.00" width="2.00" height="2.00" />
|
||||||
|
<rect x="24.00" y="24.00" width="2.00" height="2.00" />
|
||||||
|
<rect x="32.00" y="24.00" width="2.00" height="2.00" />
|
||||||
|
<rect x="38.00" y="24.00" width="4.00" height="2.00" />
|
||||||
|
<rect x="16.00" y="26.00" width="8.00" height="2.00" />
|
||||||
|
<rect x="26.00" y="26.00" width="2.00" height="2.00" />
|
||||||
|
<rect x="30.00" y="26.00" width="2.00" height="2.00" />
|
||||||
|
<rect x="34.00" y="26.00" width="2.00" height="4.00" />
|
||||||
|
<rect x="38.00" y="26.00" width="2.00" height="2.00" />
|
||||||
|
<rect x="0.00" y="28.00" width="14.00" height="2.00" />
|
||||||
|
<rect x="20.00" y="28.00" width="4.00" height="2.00" />
|
||||||
|
<rect x="26.00" y="28.00" width="6.00" height="2.00" />
|
||||||
|
<rect x="0.00" y="30.00" width="2.00" height="10.00" />
|
||||||
|
<rect x="12.00" y="30.00" width="2.00" height="10.00" />
|
||||||
|
<rect x="18.00" y="30.00" width="2.00" height="2.00" />
|
||||||
|
<rect x="22.00" y="30.00" width="6.00" height="2.00" />
|
||||||
|
<rect x="30.00" y="30.00" width="6.00" height="2.00" />
|
||||||
|
<rect x="38.00" y="30.00" width="4.00" height="2.00" />
|
||||||
|
<rect x="4.00" y="32.00" width="6.00" height="6.00" />
|
||||||
|
<rect x="16.00" y="32.00" width="2.00" height="2.00" />
|
||||||
|
<rect x="20.00" y="32.00" width="4.00" height="2.00" />
|
||||||
|
<rect x="26.00" y="32.00" width="6.00" height="2.00" />
|
||||||
|
<rect x="34.00" y="32.00" width="4.00" height="2.00" />
|
||||||
|
<rect x="40.00" y="32.00" width="2.00" height="2.00" />
|
||||||
|
<rect x="20.00" y="34.00" width="2.00" height="2.00" />
|
||||||
|
<rect x="28.00" y="34.00" width="4.00" height="2.00" />
|
||||||
|
<rect x="38.00" y="34.00" width="2.00" height="2.00" />
|
||||||
|
<rect x="16.00" y="36.00" width="2.00" height="2.00" />
|
||||||
|
<rect x="24.00" y="36.00" width="2.00" height="2.00" />
|
||||||
|
<rect x="32.00" y="36.00" width="6.00" height="2.00" />
|
||||||
|
<rect x="40.00" y="36.00" width="2.00" height="2.00" />
|
||||||
|
<rect x="18.00" y="38.00" width="2.00" height="2.00" />
|
||||||
|
<rect x="28.00" y="38.00" width="4.00" height="2.00" />
|
||||||
|
<rect x="34.00" y="38.00" width="2.00" height="2.00" />
|
||||||
|
<rect x="0.00" y="40.00" width="14.00" height="2.00" />
|
||||||
|
<rect x="16.00" y="40.00" width="6.00" height="2.00" />
|
||||||
|
<rect x="24.00" y="40.00" width="2.00" height="2.00" />
|
||||||
|
<rect x="28.00" y="40.00" width="2.00" height="2.00" />
|
||||||
|
<rect x="32.00" y="40.00" width="2.00" height="2.00" />
|
||||||
|
<rect x="36.00" y="40.00" width="2.00" height="2.00" />
|
||||||
|
<rect x="40.00" y="40.00" width="2.00" height="2.00" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 5.3 KiB |
BIN
backend/tests/data/print/tif/code128_aim.tif
Normal file
BIN
backend/tests/data/print/tif/dotcode_aim_fig7.tif
Normal file
BIN
backend/tests/data/print/tif/qr_v1_m.tif
Normal file
1
backend/tests/data/print/txt/code128_aim.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
D2 14 63 11 5D 8B B1 8E B
|
10
backend/tests/data/print/txt/dotcode_aim_fig7.txt
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
A2 A8
|
||||||
|
10 00
|
||||||
|
88 A8
|
||||||
|
41 40
|
||||||
|
0A 20
|
||||||
|
44 10
|
||||||
|
8A 88
|
||||||
|
54 40
|
||||||
|
88 A8
|
||||||
|
51 10
|
21
backend/tests/data/print/txt/qr_v1_m.txt
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
FE 4B F8
|
||||||
|
82 9A 08
|
||||||
|
BA 42 E8
|
||||||
|
BA 0A E8
|
||||||
|
BA CA E8
|
||||||
|
82 0A 08
|
||||||
|
FE AB F8
|
||||||
|
00 58 00
|
||||||
|
AA 70 90
|
||||||
|
FD A2 08
|
||||||
|
BF 88 C0
|
||||||
|
88 02 48
|
||||||
|
8A 0A 98
|
||||||
|
00 F5 50
|
||||||
|
FE 37 40
|
||||||
|
82 5D D8
|
||||||
|
BA B7 68
|
||||||
|
BA 23 10
|
||||||
|
BA 88 E8
|
||||||
|
82 43 40
|
||||||
|
FE EA A8
|
@ -52,8 +52,9 @@ static void test_input(void)
|
|||||||
/* 2*/ { BARCODE_CODE128, UNICODE_MODE, "éAéAéAéAéAéAéAéAéAéAéAéAéAéAéAéAéAéAéAé", -1, 0 }, // 39 chars
|
/* 2*/ { BARCODE_CODE128, UNICODE_MODE, "éAéAéAéAéAéAéAéAéAéAéAéAéAéAéAéAéAéAéAé", -1, 0 }, // 39 chars
|
||||||
/* 3*/ { BARCODE_CODE128, UNICODE_MODE, "éAéAéAéAéAéAéAéAéAéAéAéAéAéAéAéAéAéAéAéA", -1, ZINT_ERROR_TOO_LONG }, // 40 chars (+ 20 shifts)
|
/* 3*/ { BARCODE_CODE128, UNICODE_MODE, "éAéAéAéAéAéAéAéAéAéAéAéAéAéAéAéAéAéAéAéA", -1, ZINT_ERROR_TOO_LONG }, // 40 chars (+ 20 shifts)
|
||||||
/* 4*/ { BARCODE_CODE128, UNICODE_MODE, "\302\200", -1, ZINT_ERROR_INVALID_DATA }, // PAD U+0080, not in ISO 8859-1 although encodable in CODE128
|
/* 4*/ { BARCODE_CODE128, UNICODE_MODE, "\302\200", -1, ZINT_ERROR_INVALID_DATA }, // PAD U+0080, not in ISO 8859-1 although encodable in CODE128
|
||||||
/* 5*/ { BARCODE_CODE128, UNICODE_MODE, "\000\037é", 4, 0 },
|
/* 5*/ { BARCODE_CODE128, DATA_MODE, "\302\200", -1, 0 }, // PAD U+0080, use binary
|
||||||
/* 6*/ { BARCODE_CODE128B, UNICODE_MODE, "\000\037é", 4, 0 },
|
/* 6*/ { BARCODE_CODE128, UNICODE_MODE, "\000\037é", 4, 0 },
|
||||||
|
/* 7*/ { BARCODE_CODE128B, UNICODE_MODE, "\000\037é", 4, 0 },
|
||||||
};
|
};
|
||||||
int data_size = sizeof(data) / sizeof(struct item);
|
int data_size = sizeof(data) / sizeof(struct item);
|
||||||
|
|
||||||
@ -67,7 +68,7 @@ static void test_input(void)
|
|||||||
symbol->symbology = data[i].symbology;
|
symbol->symbology = data[i].symbology;
|
||||||
symbol->input_mode = data[i].input_mode;
|
symbol->input_mode = data[i].input_mode;
|
||||||
|
|
||||||
int length = data[i].length == -1 ? strlen(data[i].data) : data[i].length;
|
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, 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(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
libzint - the open source barcode library
|
libzint - the open source barcode library
|
||||||
Copyright (C) 2008-2019 Robin Stuart <rstuart114@gmail.com>
|
Copyright (C) 2019 - 2020 Robin Stuart <rstuart114@gmail.com>
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions
|
modification, are permitted provided that the following conditions
|
||||||
@ -60,15 +60,15 @@ static void test_utf8_to_unicode(void)
|
|||||||
|
|
||||||
for (int i = 0; i < data_size; i++) {
|
for (int i = 0; i < data_size; i++) {
|
||||||
|
|
||||||
int length = data[i].length == -1 ? strlen(data[i].data) : data[i].length;
|
int length = data[i].length == -1 ? (int) strlen(data[i].data) : data[i].length;
|
||||||
size_t ret_length = length;
|
size_t ret_length = length;
|
||||||
|
|
||||||
ret = utf8_to_unicode(&symbol, data[i].data, vals, &ret_length, data[i].disallow_4byte);
|
ret = utf8_to_unicode(&symbol, data[i].data, vals, &ret_length, data[i].disallow_4byte);
|
||||||
assert_equal(ret, data[i].ret, "i:%d ret %d != %d\n", i, ret, data[i].ret);
|
assert_equal(ret, data[i].ret, "i:%d ret %d != %d\n", i, ret, data[i].ret);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
assert_equal(ret_length, data[i].ret_length, "i:%d ret_length %ld != %ld\n", i, ret_length, data[i].ret_length);
|
assert_equal(ret_length, data[i].ret_length, "i:%d ret_length %ld != %ld\n", i, ret_length, data[i].ret_length);
|
||||||
for (int j = 0; j < ret_length; j++) {
|
for (size_t j = 0; j < ret_length; j++) {
|
||||||
assert_equal(vals[j], data[i].expected_vals[j], "i:%d vals[%d] %04X != %04X\n", i, j, vals[j], data[i].expected_vals[j]);
|
assert_equal(vals[j], data[i].expected_vals[j], "i:%d vals[%zu] %04X != %04X\n", i, j, vals[j], data[i].expected_vals[j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
libzint - the open source barcode library
|
libzint - the open source barcode library
|
||||||
Copyright (C) 2008-2020 Robin Stuart <rstuart114@gmail.com>
|
Copyright (C) 2019 - 2020 Robin Stuart <rstuart114@gmail.com>
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions
|
modification, are permitted provided that the following conditions
|
||||||
@ -31,6 +31,85 @@
|
|||||||
|
|
||||||
#include "testcommon.h"
|
#include "testcommon.h"
|
||||||
|
|
||||||
|
#define TEST_ENCODE_GENERATE_EXPECTED 1
|
||||||
|
|
||||||
|
// TODO: Verify against AIM standard
|
||||||
|
static void test_encode(void)
|
||||||
|
{
|
||||||
|
testStart("");
|
||||||
|
|
||||||
|
int ret;
|
||||||
|
struct item {
|
||||||
|
int input_mode;
|
||||||
|
int option_2;
|
||||||
|
unsigned char* data;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
int expected_rows;
|
||||||
|
int expected_width;
|
||||||
|
char* comment;
|
||||||
|
char* expected;
|
||||||
|
};
|
||||||
|
struct item data[] = {
|
||||||
|
/* 0*/ { UNICODE_MODE, -1, "2741", 0, 10, 13, "Verified manually againt bwipp (tec-it differs)",
|
||||||
|
"1010001010101"
|
||||||
|
"0001000000000"
|
||||||
|
"1000100010101"
|
||||||
|
"0100000101000"
|
||||||
|
"0000101000100"
|
||||||
|
"0100010000010"
|
||||||
|
"1000101010001"
|
||||||
|
"0101010001000"
|
||||||
|
"1000100010101"
|
||||||
|
"0101000100010"
|
||||||
|
},
|
||||||
|
};
|
||||||
|
int data_size = sizeof(data) / sizeof(struct item);
|
||||||
|
|
||||||
|
char escaped[1024];
|
||||||
|
|
||||||
|
for (int i = 0; i < data_size; i++) {
|
||||||
|
|
||||||
|
struct zint_symbol* symbol = ZBarcode_Create();
|
||||||
|
assert_nonnull(symbol, "Symbol not created\n");
|
||||||
|
|
||||||
|
symbol->symbology = BARCODE_DOTCODE;
|
||||||
|
symbol->input_mode = data[i].input_mode;
|
||||||
|
if (data[i].option_2 != -1) {
|
||||||
|
symbol->option_2 = data[i].option_2;
|
||||||
|
}
|
||||||
|
symbol->debug = ZINT_DEBUG_PRINT;
|
||||||
|
|
||||||
|
int length = strlen(data[i].data);
|
||||||
|
|
||||||
|
ret = ZBarcode_Encode(symbol, 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);
|
||||||
|
|
||||||
|
#ifdef TEST_ENCODE_GENERATE_EXPECTED
|
||||||
|
printf(" /*%3d*/ { %s, %d, \"%s\", %s, %d, %d, \"%s\",\n",
|
||||||
|
i, testUtilInputModeName(data[i].input_mode), data[i].option_2, testUtilEscape(data[i].data, length, escaped, sizeof(escaped)),
|
||||||
|
testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].comment);
|
||||||
|
testUtilModulesDump(symbol, " ", "\n");
|
||||||
|
printf(" },\n");
|
||||||
|
#else
|
||||||
|
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);
|
||||||
|
|
||||||
|
if (ret == 0) {
|
||||||
|
int width, row;
|
||||||
|
ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row);
|
||||||
|
assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, ret, width, row, data[i].data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
ZBarcode_Delete(symbol);
|
||||||
|
}
|
||||||
|
|
||||||
|
testFinish();
|
||||||
|
}
|
||||||
|
|
||||||
// #181 Christian Hartlage / Nico Gunkel OSS-Fuzz
|
// #181 Christian Hartlage / Nico Gunkel OSS-Fuzz
|
||||||
static void test_fuzz(void)
|
static void test_fuzz(void)
|
||||||
{
|
{
|
||||||
@ -95,6 +174,7 @@ static void test_fuzz(void)
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
test_encode();
|
||||||
test_fuzz();
|
test_fuzz();
|
||||||
|
|
||||||
testReport();
|
testReport();
|
||||||
|
@ -84,7 +84,7 @@ static void test_checks(void)
|
|||||||
if (data[i].dot_size != -1) {
|
if (data[i].dot_size != -1) {
|
||||||
symbol->dot_size = data[i].dot_size;
|
symbol->dot_size = data[i].dot_size;
|
||||||
}
|
}
|
||||||
int length = data[i].length == -1 ? strlen(data[i].data) : data[i].length;
|
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, 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);
|
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);
|
||||||
|
@ -47,8 +47,7 @@ static void test_print(void)
|
|||||||
char* expected_file;
|
char* expected_file;
|
||||||
};
|
};
|
||||||
struct item data[] = {
|
struct item data[] = {
|
||||||
/* 0*/ { BARCODE_CODE128, -1, -1, "AIM", "../data/png/code128_aim.png" },
|
/* 0*/ { BARCODE_CODABLOCKF, 3, -1, "AAAAAAAAA", "../data/png/codablockf_3rows.png"},
|
||||||
/* 1*/ { BARCODE_CODABLOCKF, 3, -1, "AAAAAAAAA", "../data/png/codablockf_3rows.png" },
|
|
||||||
};
|
};
|
||||||
int data_size = sizeof(data) / sizeof(struct item);
|
int data_size = sizeof(data) / sizeof(struct item);
|
||||||
|
|
||||||
@ -88,13 +87,15 @@ static void test_print(void)
|
|||||||
|
|
||||||
#ifdef TEST_PRINT_GENERATE_EXPECTED
|
#ifdef TEST_PRINT_GENERATE_EXPECTED
|
||||||
|
|
||||||
printf(" /*%2d*/ { %s, \"%s\", \"%s\"},\n", i, testUtilBarcodeName(data[i].symbology), testUtilEscape(data[i].data, length, escaped, escaped_size), data[i].expected_file);
|
printf(" /*%3d*/ { %s, %d, %d, \"%s\", \"%s\"},\n",
|
||||||
|
i, testUtilBarcodeName(data[i].symbology), data[i].option_1, data[i].option_2, testUtilEscape(data[i].data, length, escaped, escaped_size), data[i].expected_file);
|
||||||
ret = rename(symbol->outfile, 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);
|
assert_zero(ret, "i:%d rename(%s, %s) ret %d != 0\n", i, symbol->outfile, data[i].expected_file, ret);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
assert_nonzero(testUtilExists(symbol->outfile), "i:%d testUtilExists(%s) == 0\n", i, symbol->outfile);
|
assert_nonzero(testUtilExists(symbol->outfile), "i:%d testUtilExists(%s) == 0\n", i, symbol->outfile);
|
||||||
|
assert_nonzero(testUtilExists(data[i].expected_file), "i:%d testUtilExists(%s) == 0\n", i, data[i].expected_file);
|
||||||
|
|
||||||
ret = testUtilCmpPngs(symbol->outfile, data[i].expected_file);
|
ret = testUtilCmpPngs(symbol->outfile, data[i].expected_file);
|
||||||
assert_zero(ret, "i:%d %s testUtilCmpPngs(%s, %s) %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, data[i].expected_file, ret);
|
assert_zero(ret, "i:%d %s testUtilCmpPngs(%s, %s) %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, data[i].expected_file, ret);
|
||||||
|
167
backend/tests/test_print.c
Normal file
@ -0,0 +1,167 @@
|
|||||||
|
/*
|
||||||
|
libzint - the open source barcode library
|
||||||
|
Copyright (C) 2020 Robin Stuart <rstuart114@gmail.com>
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions
|
||||||
|
are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
3. Neither the name of the project nor the names of its contributors
|
||||||
|
may be used to endorse or promote products derived from this software
|
||||||
|
without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||||
|
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
/* vim: set ts=4 sw=4 et : */
|
||||||
|
|
||||||
|
#include "testcommon.h"
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
//#define TEST_PRINT_GENERATE_EXPECTED 1
|
||||||
|
|
||||||
|
static void test_print(void)
|
||||||
|
{
|
||||||
|
testStart("");
|
||||||
|
|
||||||
|
int ret;
|
||||||
|
struct item {
|
||||||
|
int symbology;
|
||||||
|
int option_1;
|
||||||
|
int option_2;
|
||||||
|
unsigned char* data;
|
||||||
|
char* expected_file;
|
||||||
|
};
|
||||||
|
struct item data[] = {
|
||||||
|
/* 0*/ { BARCODE_CODE128, -1, -1, "AIM", "code128_aim"},
|
||||||
|
/* 1*/ { BARCODE_QRCODE, 2, 1, "1234567890", "qr_v1_m"},
|
||||||
|
/* 2*/ { BARCODE_DOTCODE, -1, -1, "2741", "dotcode_aim_fig7"},
|
||||||
|
};
|
||||||
|
int data_size = sizeof(data) / sizeof(struct item);
|
||||||
|
|
||||||
|
char* exts[] = { "bmp", "emf", "eps", "gif", "pcx", "png", "svg", "tif", "txt" };
|
||||||
|
int exts_len = sizeof(exts) / sizeof(char*);
|
||||||
|
|
||||||
|
char data_dir[1024];
|
||||||
|
char expected_file[1024];
|
||||||
|
|
||||||
|
char escaped[1024];
|
||||||
|
int escaped_size = 1024;
|
||||||
|
|
||||||
|
#ifdef TEST_PRINT_GENERATE_EXPECTED
|
||||||
|
strcpy(data_dir, "../data");
|
||||||
|
if (!testUtilExists(data_dir)) {
|
||||||
|
ret = mkdir(data_dir, 0755);
|
||||||
|
assert_zero(ret, "mkdir(%s) ret %d != 0\n", data_dir, ret);
|
||||||
|
}
|
||||||
|
strcat(data_dir, "/print");
|
||||||
|
if (!testUtilExists(data_dir)) {
|
||||||
|
ret = mkdir(data_dir, 0755);
|
||||||
|
assert_zero(ret, "mkdir(%s) ret %d != 0\n", data_dir, ret);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
for (int j = 0; j < exts_len; j++) {
|
||||||
|
strcpy(data_dir, "../data/print/");
|
||||||
|
strcat(data_dir, exts[j]);
|
||||||
|
|
||||||
|
#ifdef TEST_PRINT_GENERATE_EXPECTED
|
||||||
|
if (!testUtilExists(data_dir)) {
|
||||||
|
ret = mkdir(data_dir, 0755);
|
||||||
|
assert_zero(ret, "mkdir(%s) ret %d != 0\n", data_dir, ret);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
for (int i = 0; i < data_size; i++) {
|
||||||
|
|
||||||
|
struct zint_symbol* symbol = ZBarcode_Create();
|
||||||
|
assert_nonnull(symbol, "Symbol not created\n");
|
||||||
|
|
||||||
|
symbol->symbology = data[i].symbology;
|
||||||
|
if (data[i].option_1 != -1) {
|
||||||
|
symbol->option_1 = data[i].option_1;
|
||||||
|
}
|
||||||
|
if (data[i].option_2 != -1) {
|
||||||
|
symbol->option_2 = data[i].option_2;
|
||||||
|
}
|
||||||
|
|
||||||
|
int length = strlen(data[i].data);
|
||||||
|
|
||||||
|
ret = ZBarcode_Encode(symbol, 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.");
|
||||||
|
strcat(symbol->outfile, exts[j]);
|
||||||
|
|
||||||
|
strcpy(expected_file, data_dir);
|
||||||
|
strcat(expected_file, "/");
|
||||||
|
strcat(expected_file, data[i].expected_file);
|
||||||
|
strcat(expected_file, ".");
|
||||||
|
strcat(expected_file, exts[j]);
|
||||||
|
|
||||||
|
ret = ZBarcode_Print(symbol, 0);
|
||||||
|
assert_zero(ret, "i:%d j:%d %s %s ZBarcode_Print %s ret %d != 0\n", i, j, exts[j], testUtilBarcodeName(data[i].symbology), symbol->outfile, ret);
|
||||||
|
|
||||||
|
#ifdef TEST_PRINT_GENERATE_EXPECTED
|
||||||
|
|
||||||
|
if (j == 0) {
|
||||||
|
printf(" /*%3d*/ { %s, %d, %d, \"%s\", \"%s\"},\n",
|
||||||
|
i, testUtilBarcodeName(data[i].symbology), data[i].option_1, data[i].option_2, testUtilEscape(data[i].data, length, escaped, escaped_size), data[i].expected_file);
|
||||||
|
}
|
||||||
|
ret = rename(symbol->outfile, expected_file);
|
||||||
|
assert_zero(ret, "i:%d rename(%s, %s) ret %d != 0\n", i, symbol->outfile, expected_file, ret);
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
assert_nonzero(testUtilExists(symbol->outfile), "i:%d j:%d %s testUtilExists(%s) == 0\n", i, j, exts[j], symbol->outfile);
|
||||||
|
|
||||||
|
if (strcmp(exts[j], "eps") == 0) {
|
||||||
|
ret = testUtilCmpEpss(symbol->outfile, expected_file);
|
||||||
|
assert_zero(ret, "i:%d %s testUtilCmpEpss(%s, %s) %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, expected_file, ret);
|
||||||
|
} else if (strcmp(exts[j], "png") == 0) {
|
||||||
|
ret = testUtilCmpPngs(symbol->outfile, expected_file);
|
||||||
|
assert_zero(ret, "i:%d %s testUtilCmpPngs(%s, %s) %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, expected_file, ret);
|
||||||
|
} else if (strcmp(exts[j], "svg") == 0) {
|
||||||
|
ret = testUtilCmpSvgs(symbol->outfile, expected_file);
|
||||||
|
assert_zero(ret, "i:%d %s testUtilCmpSvgs(%s, %s) %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, expected_file, ret);
|
||||||
|
} else if (strcmp(exts[j], "txt") == 0) {
|
||||||
|
ret = testUtilCmpTxts(symbol->outfile, expected_file);
|
||||||
|
assert_zero(ret, "i:%d %s testUtilCmpTxts(%s, %s) %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, expected_file, ret);
|
||||||
|
} else {
|
||||||
|
ret = testUtilCmpBins(symbol->outfile, expected_file);
|
||||||
|
assert_zero(ret, "i:%d %s testUtilCmpBins(%s, %s) %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, expected_file, ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
assert_zero(remove(symbol->outfile), "i:%d remove(%s) != 0\n", i, symbol->outfile);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
ZBarcode_Delete(symbol);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
testFinish();
|
||||||
|
}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
test_print();
|
||||||
|
|
||||||
|
testReport();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
@ -47,8 +47,8 @@ static void test_print(void)
|
|||||||
char* expected_file;
|
char* expected_file;
|
||||||
};
|
};
|
||||||
struct item data[] = {
|
struct item data[] = {
|
||||||
/* 0*/ { BARCODE_CODE128, -1, -1, "<>\"&'", "../data/svg/code128_amperands.svg" },
|
/* 0*/ { BARCODE_CODE128, -1, -1, "<>\"&'", "../data/svg/code128_amperands.svg" },
|
||||||
/* 1*/ { BARCODE_CODABLOCKF, 3, -1, "AAAAAAAAA", "../data/svg/codablockf_3rows.svg" },
|
/* 1*/ { BARCODE_CODABLOCKF, 3, -1, "AAAAAAAAA", "../data/svg/codablockf_3rows.svg"},
|
||||||
};
|
};
|
||||||
int data_size = sizeof(data) / sizeof(struct item);
|
int data_size = sizeof(data) / sizeof(struct item);
|
||||||
|
|
||||||
@ -88,13 +88,15 @@ static void test_print(void)
|
|||||||
|
|
||||||
#ifdef TEST_PRINT_GENERATE_EXPECTED
|
#ifdef TEST_PRINT_GENERATE_EXPECTED
|
||||||
|
|
||||||
printf(" /*%2d*/ { %s, \"%s\", \"%s\"},\n", i, testUtilBarcodeName(data[i].symbology), testUtilEscape(data[i].data, length, escaped, escaped_size), data[i].expected_file);
|
printf(" /*%3d*/ { %s, %d, %d, \"%s\", \"%s\"},\n",
|
||||||
|
i, testUtilBarcodeName(data[i].symbology), data[i].option_1, data[i].option_2, testUtilEscape(data[i].data, length, escaped, escaped_size), data[i].expected_file);
|
||||||
ret = rename(symbol->outfile, 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);
|
assert_zero(ret, "i:%d rename(%s, %s) ret %d != 0\n", i, symbol->outfile, data[i].expected_file, ret);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
assert_nonzero(testUtilExists(symbol->outfile), "i:%d testUtilExists(%s) == 0\n", i, symbol->outfile);
|
assert_nonzero(testUtilExists(symbol->outfile), "i:%d testUtilExists(%s) == 0\n", i, symbol->outfile);
|
||||||
|
assert_nonzero(testUtilExists(data[i].expected_file), "i:%d testUtilExists(%s) == 0\n", i, data[i].expected_file);
|
||||||
|
|
||||||
ret = testUtilCmpSvgs(symbol->outfile, data[i].expected_file);
|
ret = testUtilCmpSvgs(symbol->outfile, data[i].expected_file);
|
||||||
assert_zero(ret, "i:%d %s testUtilCmpSvgs(%s, %s) %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, data[i].expected_file, ret);
|
assert_zero(ret, "i:%d %s testUtilCmpSvgs(%s, %s) %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, data[i].expected_file, ret);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
libzint - the open source barcode library
|
libzint - the open source barcode library
|
||||||
Copyright (C) 2008-2019 Robin Stuart <rstuart114@gmail.com>
|
Copyright (C) 2019 - 2020 Robin Stuart <rstuart114@gmail.com>
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions
|
modification, are permitted provided that the following conditions
|
||||||
@ -33,8 +33,6 @@
|
|||||||
* Copyright (C) 2006-2017 Kentaro Fukuchi <kentaro@fukuchi.org>
|
* Copyright (C) 2006-2017 Kentaro Fukuchi <kentaro@fukuchi.org>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include "testcommon.h"
|
#include "testcommon.h"
|
||||||
#ifndef NO_PNG
|
#ifndef NO_PNG
|
||||||
#include <png.h>
|
#include <png.h>
|
||||||
@ -354,7 +352,7 @@ int testUtilDAFTConvert(const struct zint_symbol* symbol, char* buffer, int buff
|
|||||||
|
|
||||||
/* Is string valid UTF-8? */
|
/* Is string valid UTF-8? */
|
||||||
int testUtilIsValidUTF8(const unsigned char str[], const size_t length) {
|
int testUtilIsValidUTF8(const unsigned char str[], const size_t length) {
|
||||||
int i;
|
size_t i;
|
||||||
unsigned int codepoint, state = 0;
|
unsigned int codepoint, state = 0;
|
||||||
|
|
||||||
for (i = 0; i < length; i++) {
|
for (i = 0; i < length; i++) {
|
||||||
@ -954,7 +952,7 @@ int testUtilCmpPngs(char* png1, char* png2)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int testUtilCmpTxts(char* txt1, char* txt2)
|
int testUtilCmpTxts(char* txt1, char* txt2)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
FILE* fp1;
|
FILE* fp1;
|
||||||
@ -1005,7 +1003,7 @@ static int testUtilCmpTxts(char* txt1, char* txt2)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int testUtilCmpBins(char* bin1, char* bin2)
|
int testUtilCmpBins(char* bin1, char* bin2)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
FILE* fp1;
|
FILE* fp1;
|
||||||
@ -1114,23 +1112,3 @@ int testUtilCmpEpss(char* eps1, char* eps2)
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int testUtilCmpEmfs(char* emf1, char* emf2)
|
|
||||||
{
|
|
||||||
return testUtilCmpBins(emf1, emf2);
|
|
||||||
}
|
|
||||||
|
|
||||||
int testUtilCmpGifs(char* gif1, char* gif2)
|
|
||||||
{
|
|
||||||
return testUtilCmpBins(gif1, gif2);
|
|
||||||
}
|
|
||||||
|
|
||||||
int testUtilCmpBmps(char* bmp1, char* bmp2)
|
|
||||||
{
|
|
||||||
return testUtilCmpBins(bmp1, bmp2);
|
|
||||||
}
|
|
||||||
|
|
||||||
int testUtilCmpPcxs(char* pcx1, char* pcx2)
|
|
||||||
{
|
|
||||||
return testUtilCmpBins(pcx1, pcx2);
|
|
||||||
}
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
libzint - the open source barcode library
|
libzint - the open source barcode library
|
||||||
Copyright (C) 2008-2019 Robin Stuart <rstuart114@gmail.com>
|
Copyright (C) 2019 - 2020 Robin Stuart <rstuart114@gmail.com>
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions
|
modification, are permitted provided that the following conditions
|
||||||
@ -79,11 +79,9 @@ int testUtilModulesCmp(const struct zint_symbol* symbol, const char* expected, i
|
|||||||
int testUtilModulesDumpHex(const struct zint_symbol* symbol, char dump[], int dump_size);
|
int testUtilModulesDumpHex(const struct zint_symbol* symbol, char dump[], int dump_size);
|
||||||
int testUtilExists(char* filename);
|
int testUtilExists(char* filename);
|
||||||
int testUtilCmpPngs(char* file1, char* file2);
|
int testUtilCmpPngs(char* file1, char* file2);
|
||||||
|
int testUtilCmpTxts(char* txt1, char* txt2);
|
||||||
|
int testUtilCmpBins(char* bin1, char* bin2);
|
||||||
int testUtilCmpSvgs(char* svg1, char* svg2);
|
int testUtilCmpSvgs(char* svg1, char* svg2);
|
||||||
int testUtilCmpEpss(char* eps1, char* eps2);
|
int testUtilCmpEpss(char* eps1, char* eps2);
|
||||||
int testUtilCmpEmfs(char* emf1, char* emf2);
|
|
||||||
int testUtilCmpGifs(char* gif1, char* gif2);
|
|
||||||
int testUtilCmpBmps(char* bmp1, char* bmp2);
|
|
||||||
int testUtilCmpPcxs(char* pcx1, char* pcx2);
|
|
||||||
|
|
||||||
#endif /* TESTCOMMON_H */
|
#endif /* TESTCOMMON_H */
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
libzint - the open source barcode library
|
libzint - the open source barcode library
|
||||||
Copyright (C) 2016-2017 Robin Stuart <rstuart114@gmail.com>
|
Copyright (C) 2016 - 2020 Robin Stuart <rstuart114@gmail.com>
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions
|
modification, are permitted provided that the following conditions
|
||||||
@ -32,7 +32,6 @@
|
|||||||
/* vim: set ts=4 sw=4 et : */
|
/* vim: set ts=4 sw=4 et : */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
@ -47,8 +46,9 @@ INTERNAL int tif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
|||||||
int fgred, fggrn, fgblu, bgred, bggrn, bgblu;
|
int fgred, fggrn, fgblu, bgred, bggrn, bgblu;
|
||||||
int i;
|
int i;
|
||||||
int rows_per_strip, strip_count;
|
int rows_per_strip, strip_count;
|
||||||
int free_memory;
|
unsigned int free_memory;
|
||||||
int row, column, strip, bytes_put;
|
int row, column, strip;
|
||||||
|
unsigned int bytes_put;
|
||||||
FILE *tif_file;
|
FILE *tif_file;
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
uint32_t* strip_offset;
|
uint32_t* strip_offset;
|
||||||
@ -113,10 +113,6 @@ INTERNAL int tif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (free_memory > 0xffff0000) {
|
if (free_memory > 0xffff0000) {
|
||||||
#ifdef _MSC_VER
|
|
||||||
free(strip_offset);
|
|
||||||
free(strip_bytes);
|
|
||||||
#endif
|
|
||||||
strcpy(symbol->errtxt, "670: Output file size too big");
|
strcpy(symbol->errtxt, "670: Output file size too big");
|
||||||
return ZINT_ERROR_MEMORY;
|
return ZINT_ERROR_MEMORY;
|
||||||
}
|
}
|
||||||
|