Skip to content

Commit dd11946

Browse files
Kate IvanovaiText-CI
authored andcommitted
Add test for infinite loop when copying outlines
DEVSIX-5076 Autoported commit. Original commit hash: [26287f1c8]
1 parent 3af1e66 commit dd11946

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

itext.tests/itext.kernel.tests/itext/kernel/utils/PdfMergerTest.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,21 @@ public virtual void MergePdfWithComplexOCGTwiceTest() {
334334
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outPdf, cmpPdf, destinationFolder));
335335
}
336336

337+
[NUnit.Framework.Test]
338+
[NUnit.Framework.Ignore("TODO: DEVSIX-5064 (when doing merge with outlines infinite loop occurs )")]
339+
public virtual void MergeOutlinesWithWrongStructureTest() {
340+
PdfDocument inputDoc = new PdfDocument(new PdfReader(sourceFolder + "infiniteLoopInOutlineStructure.pdf"));
341+
PdfDocument outputDoc = new PdfDocument(new PdfWriter(destinationFolder + "infiniteLoopInOutlineStructure.pdf"
342+
));
343+
PdfMerger merger = new PdfMerger(outputDoc, false, true);
344+
System.Console.Out.WriteLine("Doing merge");
345+
merger.Merge(inputDoc, 1, 2);
346+
merger.Close();
347+
System.Console.Out.WriteLine("Merge done");
348+
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + "infiniteLoopInOutlineStructure.pdf"
349+
, sourceFolder + "cmp_infiniteLoopInOutlineStructure.pdf", destinationFolder));
350+
}
351+
337352
private void MergePdfs(IList<FileInfo> sources, String destination) {
338353
PdfDocument mergedDoc = new PdfDocument(new PdfWriter(destination));
339354
PdfMerger merger = new PdfMerger(mergedDoc);

port-hash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
98c021cbba22ad23416a51c2e8308f9de1b8dacc
1+
26287f1c8c48faa80481abe03618098f489888c8

0 commit comments

Comments
 (0)