hexapdf 0.39.0 → 0.39.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d0a43d232528df9bfc4a2c9baddd9cd1ddbd33fe7cce9d146b4e25760f25429b
4
- data.tar.gz: 37cb10752d22bbc89fd18a779152ef7b5e02e6237318006a4b0e0a420d2890e2
3
+ metadata.gz: 07f7fd9468ec9c36993f4b1f2189704d65c1c73f7fa1ea30d44f6cb0a67fa92c
4
+ data.tar.gz: 1cad88a48910fd65a9dae7a90dcfe6ac34ef5ba9f69172a18bd52052fb10b99c
5
5
  SHA512:
6
- metadata.gz: 79a27b101c502261e1bca7a25fa26fa434d38cec09a2ccb28a698a4364d8ed337ee63d82ce8cd4dd3097334ed54f0877565c25e20c2494c0ae7029156dc188ef
7
- data.tar.gz: 69befc3a7066eb90a58ad4a65243939930f26ecc461e0f6f7c9bf0894ddfa58bf1a02567563caa453b0c6e745421de75e7dd433926d2a56b96aa4d71557059f5
6
+ metadata.gz: eeee46c22616abbca812ef441100e33534384db831aadf04df9b9382920aa58105be04046a76a9da76951c1d0bc39126e4ef33c43fa3401077c34604ff414acc
7
+ data.tar.gz: 1cd42546ff96980f6fbfeaae450a7f8657350ce3b23692b508b87718028e68fe50acd9ca8b744bc755f9b79029ecd41f5cb1cedc046209336594c3fba5a1807b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 0.39.1 - 2024-03-20
2
+
3
+ ### Fixed
4
+
5
+ * [HexaPDF::Layout::TableBox] to correctly split tables when a row span with a
6
+ too high cell is involved
7
+
8
+
1
9
  ## 0.39.0 - 2024-03-18
2
10
 
3
11
  ### Added
@@ -417,7 +417,8 @@ module HexaPDF
417
417
  break
418
418
  end
419
419
  end
420
- [height - available_height, last_fitted_row_index]
420
+
421
+ [height - available_height, last_fitted_row_index < start_row ? -1 : last_fitted_row_index]
421
422
  end
422
423
 
423
424
  # Draws the rows from +start_row+ to +end_row+ on the given +canvas+, with the top-left
@@ -647,7 +648,7 @@ module HexaPDF
647
648
  end
648
649
  end
649
650
 
650
- # Splits the content of the column box. This method is called from Box#split.
651
+ # Splits the content of the table box. This method is called from Box#split.
651
652
  def split_content(_available_width, _available_height, _frame)
652
653
  if @special_cells_fit_not_successful || @last_fitted_row_index < 0
653
654
  [nil, self]
@@ -284,7 +284,7 @@ module HexaPDF
284
284
  end
285
285
 
286
286
  # Creates a new widget annotation for this form field (must be a terminal field!) on the
287
- # given +page+, adding the +values+ to the created widget annotation oject.
287
+ # given +page+, adding the +values+ to the created widget annotation object.
288
288
  #
289
289
  # If +allow_embedded+ is +false+, embedding the first widget in the field itself is not
290
290
  # allowed.
@@ -37,6 +37,6 @@
37
37
  module HexaPDF
38
38
 
39
39
  # The version of HexaPDF.
40
- VERSION = '0.39.0'
40
+ VERSION = '0.39.1'
41
41
 
42
42
  end
@@ -362,8 +362,8 @@ describe HexaPDF::Layout::TableBox do
362
362
  @doc = HexaPDF::Document.new
363
363
  @page = @doc.pages.add
364
364
  @frame = HexaPDF::Layout::Frame.new(0, 0, 160, 100, context: @page)
365
- draw_block = lambda {|canvas, _box| canvas.move_to(0, 0).end_path }
366
- @fixed_size_boxes = 15.times.map { HexaPDF::Layout::Box.new(width: 20, height: 10, &draw_block) }
365
+ @draw_block = lambda {|canvas, _box| canvas.move_to(0, 0).end_path }
366
+ @fixed_size_boxes = 15.times.map { HexaPDF::Layout::Box.new(width: 20, height: 10, &@draw_block) }
367
367
  end
368
368
 
369
369
  def create_box(**kwargs)
@@ -561,6 +561,30 @@ describe HexaPDF::Layout::TableBox do
561
561
  assert_equal(-1, box_b.last_fitted_row_index)
562
562
  end
563
563
 
564
+ it "splits the table correctly when row spans and a too-high cell are involved" do
565
+ cells = [[@fixed_size_boxes[0], @fixed_size_boxes[1]],
566
+ [{row_span: 2, content: @fixed_size_boxes[2]}, @fixed_size_boxes[3]],
567
+ [HexaPDF::Layout::Box.new(width: 20, height: 150, &@draw_block)]]
568
+ box = create_box(cells: cells)
569
+
570
+ refute(box.fit(100, 100, @frame))
571
+ box_a, box_b = box.split(100, 100, @frame)
572
+ assert_same(box_a, box)
573
+ assert(box_b.split_box?)
574
+ assert_equal(0, box_a.start_row_index)
575
+ assert_equal(0, box_a.last_fitted_row_index)
576
+ assert_equal(1, box_b.start_row_index)
577
+ assert_equal(-1, box_b.last_fitted_row_index)
578
+
579
+ refute(box_b.fit(100, 100, @frame))
580
+ box_c, box_d = box_b.split(100, 100, @frame)
581
+ assert_nil(box_c)
582
+ assert_same(box_d, box_b)
583
+ assert(box_d.split_box?)
584
+ assert_equal(1, box_d.start_row_index)
585
+ assert_equal(-1, box_d.last_fitted_row_index)
586
+ end
587
+
564
588
  it "splits the table if the header or footer rows don't fit" do
565
589
  cells_creator = lambda {|_| [@fixed_size_boxes[10, 2]] }
566
590
  [{header: cells_creator}, {footer: cells_creator}].each do |args|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hexapdf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.39.0
4
+ version: 0.39.1
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-03-18 00:00:00.000000000 Z
11
+ date: 2024-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cmdparse