test/hexapdf/test_importer.rb in hexapdf-0.26.0 vs test/hexapdf/test_importer.rb in hexapdf-0.26.1
- old
+ new
@@ -76,9 +76,17 @@
assert_equal("str", data[:str])
assert_equal("value", @obj[:hash][:key])
assert_equal(["one", "two"], @obj[:array])
end
+ it "uses already mapped HexaPDF::Object instances instead of mapping them again" do
+ hash = @importer.import(@hash)
+ assert_kind_of(HexaPDF::Dictionary, hash)
+ obj = @importer.import(@obj)
+ assert_kind_of(HexaPDF::Dictionary, obj[:hash])
+ assert_same(hash, obj[:hash])
+ end
+
it "duplicates the stream if it is a string" do
src_obj = @source.add({}, stream: 'data')
dst_obj = @importer.import(src_obj)
refute_same(dst_obj.data.stream, src_obj.data.stream)
end