test/hexapdf/test_writer.rb in hexapdf-0.8.0 vs test/hexapdf/test_writer.rb in hexapdf-0.9.0
- old
+ new
@@ -38,11 +38,11 @@
<</Size 3/Prev 54>>
startxref
219
%%EOF
3 0 obj
- <</Producer(HexaPDF version 0.8.0)>>
+ <</Producer(HexaPDF version 0.9.0)>>
endobj
xref
3 1
0000000296 00000 n
trailer
@@ -70,11 +70,11 @@
endobj
startxref
141
%%EOF
6 0 obj
- <</Producer(HexaPDF version 0.8.0)>>
+ <</Producer(HexaPDF version 0.9.0)>>
endobj
2 0 obj
<</Length 10>>stream
Some data!
endstream
@@ -99,9 +99,20 @@
end
it "writes a complete document" do
assert_document_conversion(@std_input_io)
assert_document_conversion(@compressed_input_io)
+ end
+
+ it "writes a document in incremental mode" do
+ doc = HexaPDF::Document.new(io: @std_input_io)
+ doc.pages.add
+ output_io = StringIO.new
+ HexaPDF::Writer.write(doc, output_io, incremental: true)
+ assert_equal(output_io.string[0, @std_input_io.string.length], @std_input_io.string)
+ doc = HexaPDF::Document.new(io: output_io)
+ assert_equal(4, doc.revisions.size)
+ assert_equal(2, doc.revisions.current.each.to_a.size)
end
it "raises an error if no xref stream is in a revision but object streams are" do
document = HexaPDF::Document.new
document.add(Type: :ObjStm)