-
Notifications
You must be signed in to change notification settings - Fork 35
/
graphics.test.js
155 lines (116 loc) · 14 KB
/
graphics.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
const { Box, Circle, Line, Graphic, GraphicData } = require('../src/jszpl.js');
const testHelpers = require('./test-helpers.js');
const PNG = require('pngjs').PNG;
const _ = require('lodash');
test('add box to a label', () => {
const label = testHelpers.createLabel();
const box = new Box();
label.content.push(box);
box.fill = true;
box.width = 150;
box.height = 150;
const zpl = label.generateZPL();
expect(zpl).toBe(`^XA
^FO10,10^GB150,150,150,,0^FS
^XZ`);
});
test('add circle to a label', () => {
const label = testHelpers.createLabel();
const circle = new Circle();
label.content.push(circle);
circle.fill = true;
circle.width = 150;
circle.height = 150;
const zpl = label.generateZPL();
expect(zpl).toBe(`^XA
^FO10,10^GC150,150,B^FS
^XZ`);
});
test('add box overlapping circle to a label', () => {
const label = testHelpers.createLabel();
const circle = new Circle();
label.content.push(circle);
circle.fill = true;
circle.width = 150;
circle.height = 150;
const box = new Box();
label.content.push(box);
box.fill = true;
box.width = 150;
box.height = 150;
box.invert = true;
box.cornerRadius = 10;
const zpl = label.generateZPL();
expect(zpl).toBe(`^XA
^FO10,10^GC150,150,B^FS
^FO10,10^FR^GB150,150,150,,1^FS
^XZ`);
const binaryData = [];
label.generateBinaryImage(binaryData);
expect(binaryData.length).toBe(400);
const blackPixels = _.filter(_.flatten(binaryData), (e) => e);
expect(blackPixels.length).toBe(4769);
});
test('add lines to a label', () => {
const label = testHelpers.createLabel();
const line1 = new Line();
label.content.push(line1);
line1.x1 = 50;
line1.y1 = 50;
line1.x2 = 150;
line1.y2 = 150;
line1.thickness = 5;
const line2 = new Line();
label.content.push(line2);
line2.x1 = 50;
line2.y1 = 150;
line2.x2 = 150;
line2.y2 = 50;
line2.thickness = 5;
const zpl = label.generateZPL();
expect(zpl).toBe(`^XA
^FO60,60^GD100,100,5,B,L^FS
^FO60,60^GD100,100,5,B,R^FS
^XZ`);
const binaryData = [];
label.generateBinaryImage(binaryData);
expect(binaryData.length).toBe(400);
const blackPixels = _.filter(_.flatten(binaryData), (e) => e);
expect(blackPixels.length).toBe(1351);
});
test('add image to a label', () => {
const label = testHelpers.createLabel();
const base64Image = 'iVBORw0KGgoAAAANSUhEUgAAAG4AAABsCAYAAACLk4fwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAABcGSURBVHhe7d0FnHRV+QdwkJaSUjqkJKRTWkIUJJSSbilpBGlQJAXBoASlpUOlpJQQJVQaVLpDBVSa+/9/z7vPevbund25M/O+7Lrz+3yez07cuXP3/O55+pwZq+hiWKJL3DBFl7hhii5xwxRd4oYpPjLi/v3vfxePP/548f777/e80kUd1Cbu6aefLlZdddUkW221VXHwwQcXf/3rX4tnnnmm54jG+M9//lNcddVV6bMLL7xwseSSSxbvvvtu8a9//Sudg7zwwgs9R3cxEGoT9/DDDxdjjTVWksUWW6xYd911i5/+9KfFJZdcUnz9618v7rjjjuKdd97pOXoUzK5f//rXieT55puv9/Nrrrlm8eabbxZLLbVUej7JJJMUp5xySjrPfvvt1yVxALRFXIgBv/7664u33367uOuuu4p99tmn+OMf/9jziaK44oorii233DI9XmmllXo/t+KKK6ZZ5/Gkk05a3H333ekY2GGHHYq99tqr51kXZXSEuJB11lknkQfXXHNNsd1226XZR6UGZphhhn6fQ9o999zTc8Qoom+55Zau/RsAtYljpxZccMF+gx+ywA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2QBmXibCYwlNEUcVzesputGymKn80gb8/rBHEqFeERhrRKGijCivNAsCy/OpTRFHG8ynyASDPbH+bI01/tEoe03BkRlwlZ2oHAOZAvhByqaIo4UKmOgdIqUBdRSA1p1caVSSPWB7TrRARx1OTRRx+dHg9lNE1ctGJTka22weXLd3V41UUVaSQKqa1C1TuWa0kOfxQrc+qiaeLAXluNWtqaATsSg12XOA21VTONmmx3tintiFVBrXE4oBZx7SLvvbTys1wbq4LYUcI7Ks+EUyL5rcM5T1O1CjEc4mRTmIThgDFKnAx+DD4ZrNRBhVXtBNTqcqdGoAn0qlCRtMpwwBgjTtK2vMiiEXGOFfRXrSUjncy4m21+wBB0mnWJy4CI+KXiEKqvqnIsq67hJz82FzatE+oRlHD0kAS6xJWQdzYjTOU4cqBleD0nKhdZ/HY9yBy61yxbBvaN4zXUA+/AaCeONxhdzSR2RG8EFQnZel3PuWh2bXZtWjOQ3tKMy466sbRqjI5y0+jCaCOOHeJal3tOqn5lf0yCJ2tW5a3seRJ9uGC0EHf33Xen/vqcsJByzWtMAWEq2rI+1oqb+VFa6hL3/6iaZbl8FFl3K4x0W5WvBYEaVRdccMFeEocLOk5ceTfYEEuprJ9jT8Y0FH+rrilEQD9YW95QQ8eJExcpr5SlvFnNmIT+TjVBpaWy2JkhX/o1XDDanJMuRi+6xA1TdIkbliiK/wNsUobSg0K7CwAAAABJRU5ErkJggg==';
const imageBuffer = new Buffer.from(base64Image, 'base64');
const imageData = PNG.sync.read(imageBuffer);
const graphic = new Graphic();
label.content.push(graphic);
graphic.width = 200;
graphic.height = 200;
let index = 0;
const imageBits = [];
for (let y = 0; y < imageData.height; y++) {
for (let x = 0; x < imageData.width; x++) {
const red = imageData.data[index++];
const green = imageData.data[index++];
const blue = imageData.data[index++];
const opacity = imageData.data[index++];
let value = 0;
if (opacity != 0) {
value = (((red + green + blue) / 3) < 180) ? 1 : 0;
}
imageBits.push(value);
}
}
graphic.data = new GraphicData(110, 108, imageBits);
const zpl = label.generateZPL();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binaryData), (e) => e);
expect(blackPixels.length).toBe(7780);
});