hexapdf-extras 1.2.1 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/lib/hexapdf/extras/layout/qr_code_box.rb +4 -5
- data/lib/hexapdf/extras/layout/zint_box.rb +3 -1
- data/lib/hexapdf/extras/version.rb +1 -1
- data/test/hexapdf/extras/graphic_object/test_zint.rb +2 -2
- data/test/hexapdf/extras/layout/test_qr_code_box.rb +7 -7
- data/test/hexapdf/extras/layout/test_swiss_qr_bill.rb +17 -17
- metadata +6 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b425559332a45c2a40c8de3fb518e26c772db9b99f63ef393df92f2bfceee3b
|
4
|
+
data.tar.gz: e33029a0a9aa8aed06f1438f31fdf8b53cb7bc0b15e96f43b72a7b74d014d5d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72e693b278f55b2e8fb8ddb7b7ade7ec544b4ffa2e0977b73f1b5a784be7444de78101af02c25095cdb6e5f00b86ac704bd84c6f947090754c39041a1085f5d3
|
7
|
+
data.tar.gz: 4e2caa6555160576d3e008706f7dc58540be3766eab308c318872778feb79a4185289c90cba605c69e406143d674f4e6abaf0bf2f931a5fa6f5410d14bad1ff8
|
data/Rakefile
CHANGED
@@ -42,17 +42,16 @@ module HexaPDF
|
|
42
42
|
)
|
43
43
|
end
|
44
44
|
|
45
|
+
private
|
46
|
+
|
45
47
|
# Fits the QRCode into the given area.
|
46
|
-
def
|
47
|
-
super
|
48
|
+
def fit_content(available_width, available_height, _frame)
|
48
49
|
@qr_code.size = [content_width, content_height].min
|
49
50
|
@width = @qr_code.size + reserved_width
|
50
51
|
@height = @qr_code.size + reserved_height
|
51
|
-
|
52
|
+
fit_result.success! if @width <= available_width && @height <= available_height
|
52
53
|
end
|
53
54
|
|
54
|
-
private
|
55
|
-
|
56
55
|
# Draws the QR code onto the canvas at position [x, y].
|
57
56
|
def draw_content(canvas, x, y)
|
58
57
|
@qr_code.at = [x, y]
|
@@ -43,8 +43,10 @@ module HexaPDF
|
|
43
43
|
@barcode = GraphicObject::Zint.configure(**data)
|
44
44
|
end
|
45
45
|
|
46
|
+
private
|
47
|
+
|
46
48
|
# Fits the barcode into the given area.
|
47
|
-
def
|
49
|
+
def fit_content(available_width, available_height, frame)
|
48
50
|
@image ||= @barcode.form_xobject(frame.document)
|
49
51
|
super
|
50
52
|
end
|
@@ -74,7 +74,7 @@ describe HexaPDF::Extras::GraphicObject::Zint do
|
|
74
74
|
[:set_font_and_size, [:F1, 14.0]],
|
75
75
|
[:set_device_gray_non_stroking_color, [0.0]],
|
76
76
|
[:begin_text],
|
77
|
-
[:
|
77
|
+
[:move_text, [67.716, 3.5]],
|
78
78
|
[:show_text, ["test"]],
|
79
79
|
[:end_text]])
|
80
80
|
end
|
@@ -108,7 +108,7 @@ describe HexaPDF::Extras::GraphicObject::Zint do
|
|
108
108
|
[:set_font_and_size, [:F1, 14.0]],
|
109
109
|
[:set_device_gray_non_stroking_color, [0.0]],
|
110
110
|
[:begin_text],
|
111
|
-
[:
|
111
|
+
[:move_text, [0.216, 0.400002]],
|
112
112
|
[:show_text, ["1"]],
|
113
113
|
[:set_font_and_size, [:F1, 20.0]],
|
114
114
|
[:move_text, [32.424, 0]],
|
@@ -29,7 +29,7 @@ describe HexaPDF::Extras::Layout::QRCodeBox do
|
|
29
29
|
it "uses the smaller value of width/height for the dimensions if smaller than available_width/height" do
|
30
30
|
[{width: 10}, {width: 10, height: 50}, {height: 10}, {width: 50, height: 10}].each do |args|
|
31
31
|
box = create_box(**args)
|
32
|
-
assert(box.fit(100, 100, @frame))
|
32
|
+
assert(box.fit(100, 100, @frame).success?)
|
33
33
|
assert_equal(10, box.width)
|
34
34
|
assert_equal(10, box.height)
|
35
35
|
assert_equal(10, box.qr_code.size)
|
@@ -38,12 +38,12 @@ describe HexaPDF::Extras::Layout::QRCodeBox do
|
|
38
38
|
|
39
39
|
it "uses the smaller value of available_width/height for the dimensions" do
|
40
40
|
box = create_box
|
41
|
-
assert(box.fit(10, 20, @frame))
|
41
|
+
assert(box.fit(10, 20, @frame).success?)
|
42
42
|
assert_equal(10, box.width)
|
43
43
|
assert_equal(10, box.height)
|
44
44
|
assert_equal(10, box.qr_code.size)
|
45
45
|
|
46
|
-
assert(box.fit(20, 15, @frame))
|
46
|
+
assert(box.fit(20, 15, @frame).success?)
|
47
47
|
assert_equal(15, box.width)
|
48
48
|
assert_equal(15, box.height)
|
49
49
|
assert_equal(15, box.qr_code.size)
|
@@ -51,19 +51,19 @@ describe HexaPDF::Extras::Layout::QRCodeBox do
|
|
51
51
|
|
52
52
|
it "takes the border and padding into account for the QR code size" do
|
53
53
|
box = create_box(style: {padding: [1, 2], border: {width: [3, 4]}})
|
54
|
-
assert(box.fit(100, 100, @frame))
|
54
|
+
assert(box.fit(100, 100, @frame).success?)
|
55
55
|
assert_equal(88, box.qr_code.size)
|
56
56
|
assert_equal(100, box.width)
|
57
57
|
assert_equal(96, box.height)
|
58
58
|
|
59
59
|
box = create_box(style: {padding: [2, 1], border: {width: [4, 3]}})
|
60
|
-
assert(box.fit(100, 100, @frame))
|
60
|
+
assert(box.fit(100, 100, @frame).success?)
|
61
61
|
assert_equal(88, box.qr_code.size)
|
62
62
|
assert_equal(96, box.width)
|
63
63
|
assert_equal(100, box.height)
|
64
64
|
|
65
65
|
box = create_box(style: {padding: [5, 5, 5, 0], border: {width: [2, 2, 2, 0]}})
|
66
|
-
assert(box.fit(50, 100, @frame))
|
66
|
+
assert(box.fit(50, 100, @frame).success?)
|
67
67
|
assert_equal(43, box.qr_code.size)
|
68
68
|
assert_equal(50, box.width)
|
69
69
|
assert_equal(57, box.height)
|
@@ -73,7 +73,7 @@ describe HexaPDF::Extras::Layout::QRCodeBox do
|
|
73
73
|
describe "draw" do
|
74
74
|
it "draws the qrcode" do
|
75
75
|
box = create_box(width: 10)
|
76
|
-
box.fit(100, 100, @frame)
|
76
|
+
assert(box.fit(100, 100, @frame).success?)
|
77
77
|
|
78
78
|
canvas = Minitest::Mock.new
|
79
79
|
canvas.expect(:draw, nil, [box.qr_code])
|
@@ -13,7 +13,7 @@ describe HexaPDF::Extras::Layout::SwissQRBill do
|
|
13
13
|
def data
|
14
14
|
@data ||= {
|
15
15
|
creditor: {
|
16
|
-
iban: "CH4431999123000889012",
|
16
|
+
iban: +"CH4431999123000889012",
|
17
17
|
name: "Max Muster & Söhne",
|
18
18
|
address_line1: "Musterstrasse",
|
19
19
|
address_line2: "123",
|
@@ -72,11 +72,11 @@ describe HexaPDF::Extras::Layout::SwissQRBill do
|
|
72
72
|
it "ensures a correct iban value in the creditor field" do
|
73
73
|
data[:creditor].delete(:iban)
|
74
74
|
assert_invalid_data(/:iban of :creditor is missing/)
|
75
|
-
data[:creditor][:iban] = 'CH44 319 39912300088901 2'
|
75
|
+
data[:creditor][:iban] = +'CH44 319 39912300088901 2'
|
76
76
|
assert_invalid_data(/:iban of :creditor.*21/)
|
77
|
-
data[:creditor][:iban] = 'CH4431999123000889013'
|
77
|
+
data[:creditor][:iban] = +'CH4431999123000889013'
|
78
78
|
assert_invalid_data(/:iban of :creditor.*invalid check digits/)
|
79
|
-
data[:creditor][:iban] = 'CH4431999123000889012'
|
79
|
+
data[:creditor][:iban] = +'CH4431999123000889012'
|
80
80
|
assert(create_box(data))
|
81
81
|
end
|
82
82
|
|
@@ -152,32 +152,32 @@ describe HexaPDF::Extras::Layout::SwissQRBill do
|
|
152
152
|
it "ensures the QRR reference value exists and is valid" do
|
153
153
|
data[:reference_type] = 'QRR'
|
154
154
|
assert_invalid_data(/:reference must be filled.*QRR/)
|
155
|
-
data[:reference] = 'adsfads'
|
155
|
+
data[:reference] = +'adsfads'
|
156
156
|
assert_invalid_data(/:reference for QRR.*27/)
|
157
|
-
data[:reference] = '210000000003139471430009011'
|
157
|
+
data[:reference] = +'210000000003139471430009011'
|
158
158
|
assert_invalid_data(/:reference for QRR.*invalid check digit.*7/)
|
159
|
-
data[:reference] = '21000000000313947143000901'
|
159
|
+
data[:reference] = +'21000000000313947143000901'
|
160
160
|
assert_equal('7', create_box(data).data[:reference][26])
|
161
|
-
data[:reference] = '210000000 0031394 71430009017'
|
161
|
+
data[:reference] = +'210000000 0031394 71430009017'
|
162
162
|
assert(create_box(data))
|
163
163
|
end
|
164
164
|
|
165
165
|
it "ensures the SCOR reference value exists and is valid" do
|
166
166
|
data[:reference_type] = 'SCOR'
|
167
167
|
assert_invalid_data(/:reference must be filled.*SCOR/)
|
168
|
-
data[:reference] = 'RF11'
|
168
|
+
data[:reference] = +'RF11'
|
169
169
|
assert_invalid_data(/:reference for SCOR.*5 and 25/)
|
170
|
-
data[:reference] = 'RFa' * 9
|
170
|
+
data[:reference] = +'RFa' * 9
|
171
171
|
assert_invalid_data(/:reference for SCOR.*5 and 25/)
|
172
|
-
data[:reference] = 'RF123323;ö'
|
172
|
+
data[:reference] = +'RF123323;ö'
|
173
173
|
assert_invalid_data(/:reference for SCOR.*alpha-numeric/)
|
174
|
-
data[:reference] = 'a' * 20
|
174
|
+
data[:reference] = +'a' * 20
|
175
175
|
assert_invalid_data(/:reference for SCOR must start.*RF/)
|
176
|
-
data[:reference] = 'RFabcdefgh'
|
176
|
+
data[:reference] = +'RFabcdefgh'
|
177
177
|
assert_invalid_data(/:reference for SCOR must start.*RF and check digits/)
|
178
|
-
data[:reference] = 'RF 48 5000056789012345d'
|
178
|
+
data[:reference] = +'RF 48 5000056789012345d'
|
179
179
|
assert_invalid_data(/:reference for SCOR has invalid check digits/)
|
180
|
-
data[:reference] = 'RF 48 5000056789012345'
|
180
|
+
data[:reference] = +'RF 48 5000056789012345'
|
181
181
|
assert(create_box(data))
|
182
182
|
end
|
183
183
|
|
@@ -226,7 +226,7 @@ describe HexaPDF::Extras::Layout::SwissQRBill do
|
|
226
226
|
|
227
227
|
it "works with all information filled in" do
|
228
228
|
data[:reference_type] = 'QRR'
|
229
|
-
data[:reference] = '210000000 0031394 71430009017'
|
229
|
+
data[:reference] = +'210000000 0031394 71430009017'
|
230
230
|
data[:message] = 'Please just pay the bills, Jim!'
|
231
231
|
data[:billing_information] = '//S/hit/30/50/what/do/I/do/'
|
232
232
|
data[:alternative_schemes] = 'ebill/here/comes/data'
|
@@ -237,7 +237,7 @@ describe HexaPDF::Extras::Layout::SwissQRBill do
|
|
237
237
|
data.delete(:debtor)
|
238
238
|
data.delete(:amount)
|
239
239
|
data[:reference_type] = 'SCOR'
|
240
|
-
data[:reference] = 'RF48 5000056789012345'
|
240
|
+
data[:reference] = +'RF48 5000056789012345'
|
241
241
|
assert(@composer.box(:swiss_qr_bill, data: data))
|
242
242
|
end
|
243
243
|
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hexapdf-extras
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Leitner
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-01-01 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: hexapdf
|
@@ -16,14 +15,14 @@ dependencies:
|
|
16
15
|
requirements:
|
17
16
|
- - "~>"
|
18
17
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0
|
18
|
+
version: '1.0'
|
20
19
|
type: :runtime
|
21
20
|
prerelease: false
|
22
21
|
version_requirements: !ruby/object:Gem::Requirement
|
23
22
|
requirements:
|
24
23
|
- - "~>"
|
25
24
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0
|
25
|
+
version: '1.0'
|
27
26
|
- !ruby/object:Gem::Dependency
|
28
27
|
name: rqrcode_core
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,7 +51,6 @@ dependencies:
|
|
52
51
|
- - "~>"
|
53
52
|
- !ruby/object:Gem::Version
|
54
53
|
version: '1.3'
|
55
|
-
description:
|
56
54
|
email: t_leitner@gmx.at
|
57
55
|
executables: []
|
58
56
|
extensions: []
|
@@ -81,7 +79,6 @@ homepage: https://hexapdf-extras.gettalong.org
|
|
81
79
|
licenses:
|
82
80
|
- MIT
|
83
81
|
metadata: {}
|
84
|
-
post_install_message:
|
85
82
|
rdoc_options: []
|
86
83
|
require_paths:
|
87
84
|
- lib
|
@@ -89,15 +86,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
89
86
|
requirements:
|
90
87
|
- - ">="
|
91
88
|
- !ruby/object:Gem::Version
|
92
|
-
version: '
|
89
|
+
version: '3.0'
|
93
90
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
91
|
requirements:
|
95
92
|
- - ">="
|
96
93
|
- !ruby/object:Gem::Version
|
97
94
|
version: '0'
|
98
95
|
requirements: []
|
99
|
-
rubygems_version: 3.
|
100
|
-
signing_key:
|
96
|
+
rubygems_version: 3.6.2
|
101
97
|
specification_version: 4
|
102
98
|
summary: Additional functionality for HexaPDF
|
103
99
|
test_files: []
|