Skip to content

Commit

Permalink
Merge pull request prawnpdf#709 from DatekWireless/master
Browse files Browse the repository at this point in the history
Added failing spec for Issue prawnpdf#707
  • Loading branch information
practicingruby committed Apr 10, 2014
2 parents 5e6452f + ed21ca3 commit e0fe7cf
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -6,5 +6,6 @@ pkg
Gemfile.lock
drop_to_console.rb
manual.pdf
/.idea
/doc
/bin
20 changes: 18 additions & 2 deletions spec/table_spec.rb
Expand Up @@ -50,8 +50,7 @@
pdf = Prawn::Document.new({:page_size => "A4", :page_layout => :portrait})

table_data = Array.new
text = "This will be a very long text. "
4.times do text += text end
text = 'This will be a very long text. ' * 5
table_data.push([{:content => text, :rowspan => 2}, 'b', 'c'])
table_data.push(['b','c'])

Expand Down Expand Up @@ -734,6 +733,23 @@
output.pages[1][:strings].should == ["Header", "Body"]
end

it 'should only draw first-page header if the first multi-row fits',
:unresolved, :issue => 707 do
pdf = Prawn::Document.new

pdf.y = 100 # not enough room for the header and multirow cell
pdf.table [
[{content: 'Header', colspan: 2}],
[{content: 'Multirow cell', rowspan: 3}, 'Line 1'],
] + (2..3).map { |i| ["Line #{i}"] }, :header => true

output = PDF::Inspector::Page.analyze(pdf.render)
# Ensure we only drew the header once, on the second page
output.pages[0][:strings].should == []
output.pages[1][:strings].should == ['Header', 'Multirow cell', 'Line 1',
'Line 2', 'Line 3']
end

it "should draw background before borders, but only within pages" do
seq = sequence("drawing_order")

Expand Down

0 comments on commit e0fe7cf

Please sign in to comment.