test/hexapdf/layout/test_text_box.rb in hexapdf-0.33.0 vs test/hexapdf/layout/test_text_box.rb in hexapdf-0.34.0
- old
+ new
@@ -23,9 +23,17 @@
it "supports flowing text around other content" do
assert(create_box([]).supports_position_flow?)
end
end
+ it "returns the text contents as string" do
+ doc = HexaPDF::Document.new
+ font = doc.fonts.add("Times")
+ box = create_box([HexaPDF::Layout::TextFragment.create('Test ', font: font), @inline_box,
+ HexaPDF::Layout::TextFragment.create('here', font: font)])
+ assert_equal('Test here', box.text)
+ end
+
describe "fit" do
it "fits into a rectangular area" do
box = create_box([@inline_box] * 5, style: {padding: 10})
assert(box.fit(100, 100, @frame))
assert_equal(70, box.width)