hexapdf-extras 1.2.0 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +2 -1
- data/lib/hexapdf/extras/layout/qr_code_box.rb +4 -5
- data/lib/hexapdf/extras/layout/swiss_qr_bill.rb +1 -1
- data/lib/hexapdf/extras/layout/zint_box.rb +3 -1
- data/lib/hexapdf/extras/version.rb +1 -1
- data/test/hexapdf/extras/layout/test_qr_code_box.rb +7 -7
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f67123484ebe9ff4b442a3928cc727d19b7b3e9767536c08775d9f8bbd679d41
|
4
|
+
data.tar.gz: 5d7cc27bb1537f22465fb1ca8fd6396629575a4ffec9c49a64c52e7ad0c31d31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f717ebe411c150d4da8edafedf19739305d11a18d9e164a3db9f68ef535ba02cdb5374753414f0cd05bbbc92f51547b32cde1eceee845c568c87c3a7be662a00
|
7
|
+
data.tar.gz: 25c2b45c6ed7b614c6c32a5b7fdc3f30ed1700162baff8c1b9450ee08b010fea3142ffeab41f7ccf370b71d3c9038ae9a9ec738929bac4fac0229b67d0d2690c
|
data/Rakefile
CHANGED
@@ -11,6 +11,7 @@ end
|
|
11
11
|
|
12
12
|
CLOBBER << 'webgen-out'
|
13
13
|
CLOBBER << 'webgen-tmp'
|
14
|
+
CLOBBER << 'coverage'
|
14
15
|
|
15
16
|
task default: 'test'
|
16
17
|
|
@@ -27,7 +28,7 @@ task publish_files: [:package] do
|
|
27
28
|
end
|
28
29
|
|
29
30
|
task :test_all do
|
30
|
-
versions = `rbenv versions --bare | grep -i
|
31
|
+
versions = `rbenv versions --bare | grep -i 3.`.split("\n")
|
31
32
|
versions.each do |version|
|
32
33
|
sh "eval \"$(rbenv init -)\"; rbenv shell #{version} && ruby -v && rake test"
|
33
34
|
end
|
@@ -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]
|
@@ -404,7 +404,7 @@ module HexaPDF
|
|
404
404
|
|
405
405
|
box_fitter.fit(receipt(layout, styles))
|
406
406
|
box_fitter.fit(payment(layout, styles, qr_code_cross(canvas.context.document)))
|
407
|
-
unless box_fitter.
|
407
|
+
unless box_fitter.success?
|
408
408
|
raise HexaPDF::Error, "The Swiss QR-bill could not be fit"
|
409
409
|
end
|
410
410
|
|
@@ -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
|
@@ -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])
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Leitner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-05
|
11
|
+
date: 2024-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hexapdf
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.44'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
26
|
+
version: '0.44'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rqrcode_core
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|