test/hexapdf/layout/test_inline_box.rb in hexapdf-0.6.0 vs test/hexapdf/layout/test_inline_box.rb in hexapdf-0.7.0

- old
+ new

@@ -6,12 +6,21 @@ describe HexaPDF::Layout::InlineBox do before do @box = HexaPDF::Layout::InlineBox.create(width: 10, height: 15, style: {margin: [15, 10]}) end + it "needs a box to wrap and an optional alignment on initialization" do + ibox = HexaPDF::Layout::InlineBox.new(@box) + assert_equal(@box, ibox.box) + assert_equal(:baseline, ibox.valign) + + ibox = HexaPDF::Layout::InlineBox.new(@box, valign: :top) + assert_equal(:top, ibox.valign) + end + it "draws the wrapped box at the correct position" do canvas = Object.new - block = ->(c, x, y) do + block = lambda do |c, x, y| assert_equal(canvas, c) assert_equal(10, x) assert_equal(15, y) end @box.box.stub(:draw, block) do