hexapdf-extras 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ea614bc7163af0c86933d2861f6c55fbab0e7a95cb799fd28167823db3f5b476
4
- data.tar.gz: 2ae5cc1c597b8d6040c3a0f0803328692dad49cc011faf2e903e95758ee35260
3
+ metadata.gz: be80955331e2df5f0ce6c549d335930bf5eed3e031deb166e6b13122bfca89d1
4
+ data.tar.gz: ba2c0f0affc9be014a6e87a4bbdb08bd8843af6a179fc0cd2acb548191eba47e
5
5
  SHA512:
6
- metadata.gz: e8dc9518929b83e6ca2248fce24d1d0123b328af01e92c5f8831c3cf1ecd47655b640529ca8027aa6705c317e6875a54d701dbbbc3be17a9f0478cf3dc7dc0d3
7
- data.tar.gz: 9266e72303a8c0a13608e24f74c6e5e47528e3875a198e5cdd1d6ded55dd0131978247b8646645e34019e4764396f5a512f4eb3ffd96d1b0f130723c08293eaf
6
+ metadata.gz: 60b8b6103c054737c98ef349e5cf7f5f6596eec6bbfdb23ef4dbd04623ecdbf4d1076332be273b19ff10d6931543ab30e8db806fdbfa317e1ab5619d974028c8
7
+ data.tar.gz: e4e5144d3b851225a971e5944d160fe6a7d4f8dd32bba2e89e0dd3dd6e30cdc52bfa95e2cd3d9a8a36b8761c506a9368817775f57bbe06130ad2d809f1f9ae8d
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'hexapdf/layout/box'
4
+ require 'hexapdf/extras/graphic_object/qr_code'
4
5
 
5
6
  module HexaPDF
6
7
  module Extras
@@ -44,8 +45,9 @@ module HexaPDF
44
45
  # Fits the QRCode into the given area.
45
46
  def fit(available_width, available_height, _frame)
46
47
  super
47
- @width = @height = [@width, @height].min
48
48
  @qr_code.size = [content_width, content_height].min
49
+ @width = @qr_code.size + reserved_width
50
+ @height = @qr_code.size + reserved_height
49
51
  @fit_successful = (@width <= available_width && @height <= available_height)
50
52
  end
51
53
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module HexaPDF
4
4
  module Extras
5
- VERSION = '1.0.0'
5
+ VERSION = '1.0.1'
6
6
  end
7
7
  end
@@ -49,10 +49,20 @@ describe HexaPDF::Extras::Layout::QRCodeBox do
49
49
  box = create_box(style: {padding: [1, 2], border: {width: [3, 4]}})
50
50
  assert(box.fit(100, 100, nil))
51
51
  assert_equal(88, box.qr_code.size)
52
+ assert_equal(100, box.width)
53
+ assert_equal(96, box.height)
52
54
 
53
55
  box = create_box(style: {padding: [2, 1], border: {width: [4, 3]}})
54
56
  assert(box.fit(100, 100, nil))
55
57
  assert_equal(88, box.qr_code.size)
58
+ assert_equal(96, box.width)
59
+ assert_equal(100, box.height)
60
+
61
+ box = create_box(style: {padding: [5, 5, 5, 0], border: {width: [2, 2, 2, 0]}})
62
+ assert(box.fit(50, 100, nil))
63
+ assert_equal(43, box.qr_code.size)
64
+ assert_equal(50, box.width)
65
+ assert_equal(57, box.height)
56
66
  end
57
67
  end
58
68
 
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.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Leitner
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-07 00:00:00.000000000 Z
11
+ date: 2023-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hexapdf
@@ -38,7 +38,7 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.2'
41
- description:
41
+ description:
42
42
  email: t_leitner@gmx.at
43
43
  executables: []
44
44
  extensions: []
@@ -61,7 +61,7 @@ homepage: https://hexapdf-extras.gettalong.org
61
61
  licenses:
62
62
  - MIT
63
63
  metadata: {}
64
- post_install_message:
64
+ post_install_message:
65
65
  rdoc_options: []
66
66
  require_paths:
67
67
  - lib
@@ -76,8 +76,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
76
  - !ruby/object:Gem::Version
77
77
  version: '0'
78
78
  requirements: []
79
- rubygems_version: 3.1.6
80
- signing_key:
79
+ rubygems_version: 3.4.10
80
+ signing_key:
81
81
  specification_version: 4
82
82
  summary: Additional functionality for HexaPDF
83
83
  test_files: []