test/hexapdf/content/test_canvas.rb in hexapdf-0.15.0 vs test/hexapdf/content/test_canvas.rb in hexapdf-0.15.1
- old
+ new
@@ -829,10 +829,21 @@
[:concatenate_matrix, [10, 0, 0, 20, 1, 2]],
[:paint_xobject, [:XO1]],
[:restore_graphics_state]])
end
+ it "doesn't do anything if the image's width or height is zero" do
+ @image[:Width] = 0
+ @canvas.xobject(@image, at: [0, 0])
+ assert_operators(@page.contents, [])
+
+ @image[:Width] = 10
+ @image[:Height] = 0
+ @canvas.xobject(@image, at: [0, 0])
+ assert_operators(@page.contents, [])
+ end
+
it "correctly serializes the form with no options" do
@canvas.xobject(@form, at: [1, 2])
assert_operators(@page.contents, [[:save_graphics_state],
[:concatenate_matrix, [1, 0, 0, 1, -99, -48]],
[:paint_xobject, [:XO1]],
@@ -859,9 +870,19 @@
@canvas.image(@form, at: [1, 2], width: 50, height: 10)
assert_operators(@page.contents, [[:save_graphics_state],
[:concatenate_matrix, [0.5, 0, 0, 0.2, -99, -48]],
[:paint_xobject, [:XO1]],
[:restore_graphics_state]])
+ end
+
+ it "doesn't do anything if the form's width or height is zero" do
+ @form[:BBox] = [100, 50, 100, 200]
+ @canvas.xobject(@form, at: [0, 0])
+ assert_operators(@page.contents, [])
+
+ @form[:BBox] = [100, 50, 150, 50]
+ @canvas.xobject(@form, at: [0, 0])
+ assert_operators(@page.contents, [])
end
end
describe "character_spacing" do
it "uses the gs_getter_setter implementation" do