Skip to content

Commit

Permalink
fixing test case introduced with bug report 502
Browse files Browse the repository at this point in the history
The original code made subtable cells larger than requested, thus
enabeling such small cells (:widht => 15). Enlarging to (:width => 20).
  • Loading branch information
hbrandl committed Dec 23, 2013
1 parent d45e310 commit c914cf1
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions spec/table_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,38 @@
table = Prawn::Table.new data, pdf, :column_widths => [50, 200, 40, 40, 50, 50]
end

it "illustrates issue #502" do
it "illustrates issue #502", :focus => true do
pdf = Prawn::Document.new
first = {:content=>"Foooo fo foooooo",:width=>50,:align=>:center}
second = {:content=>"Foooo",:colspan=>2,:width=>70,:align=>:center}
third = {:content=>"fooooooooooo, fooooooooooooo, fooo, foooooo fooooo",:width=>55,:align=>:center}
fourth = {:content=>"Bar",:width=>15,:align=>:center}
third = {:content=>"fooooooooooo, fooooooooooooo, fooo, foooooo fooooo",:width=>50,:align=>:center}
fourth = {:content=>"Bar",:width=>20,:align=>:center}
table_content = [[
first,
[[second],[third,fourth]]
]]
pdf.move_down(20)
table = Prawn::Table.new table_content, pdf
puts "column_widths: #{table.column_widths}"

pdf.table(table_content)
end

it "illustrates wrong width in a special case", :focus2 do
pdf = Prawn::Document.new
first = {:content=>"Foooo fo foooooo",:width=>50,:align=>:center}
second = {:content=>"Foooo",:colspan=>2,:width=>70,:align=>:center}
third = {:content=>"fooooooooooo, fooooooooooooo, fooo, foooooo fooooo",:width=>50,:align=>:center}
fourth = {:content=>"Bar",:width=>20,:align=>:center}
table_content = [[
first,
[[second],[third,fourth]]
]]
table = Prawn::Table.new table_content, pdf
puts "column_widths: #{table.column_widths}"
table.column_widths.should == [50.0, 70.0]
end

#https://github.com/prawnpdf/prawn/issues/407#issuecomment-28556698
it "illustrates issue #407 - comment 28556698" do
data = [['', ''],
Expand Down

0 comments on commit c914cf1

Please sign in to comment.