test/hexapdf/test_writer.rb in hexapdf-0.20.2 vs test/hexapdf/test_writer.rb in hexapdf-0.20.3

- old
+ new

@@ -38,11 +38,11 @@ <</Size 3/Prev 54>> startxref 219 %%EOF 3 0 obj - <</Producer(HexaPDF version 0.20.2)>> + <</Producer(HexaPDF version 0.20.3)>> endobj xref 3 1 0000000296 00000 n trailer @@ -70,11 +70,11 @@ endobj startxref 141 %%EOF 6 0 obj - <</Producer(HexaPDF version 0.20.2)>> + <</Producer(HexaPDF version 0.20.3)>> endobj 2 0 obj <</Length 10>>stream Some data! endstream @@ -120,9 +120,20 @@ doc = HexaPDF::Document.new(io: @compressed_input_io) doc.pages.add output_io = StringIO.new HexaPDF::Writer.write(doc, output_io, incremental: true) refute_match(/^trailer/, output_io.string) + end + + it "raises an error if the used encryption was changed" do + io = StringIO.new + doc = HexaPDF::Document.new + doc.encrypt + doc.write(io) + + doc = HexaPDF::Document.new(io: io) + doc.encrypt(owner_password: 'test') + assert_raises(HexaPDF::Error) { doc.write('notused', incremental: true) } end end it "creates an xref stream if no xref stream is in a revision but object streams are" do document = HexaPDF::Document.new