Skip to content

Commit 94756cc

Browse files
author
joris.schellekens
committed
implement code review remarks
move test to PdfReaderTest resolves DEVSIX-1426
1 parent 1b98844 commit 94756cc

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

kernel/src/test/java/com/itextpdf/kernel/pdf/PdfReaderTest.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ This file is part of the iText (R) project.
4646
import com.itextpdf.io.source.ByteArrayOutputStream;
4747
import com.itextpdf.io.source.ByteUtils;
4848
import com.itextpdf.kernel.PdfException;
49+
import com.itextpdf.kernel.utils.CompareTool;
4950
import com.itextpdf.test.ExtendedITextTest;
5051
import com.itextpdf.test.annotations.LogMessage;
5152
import com.itextpdf.test.annotations.LogMessages;
@@ -1477,6 +1478,28 @@ public void freeReferencesTest() throws IOException {
14771478
pdfDoc.close();
14781479
}
14791480

1481+
@Test
1482+
public void freeReferencesTest02() throws IOException, InterruptedException {
1483+
1484+
String cmpFile = sourceFolder + "cmp_freeReferences02.pdf";
1485+
String outputFile = destinationFolder + "freeReferences02.pdf";
1486+
String inputFile = sourceFolder + "freeReferences02.pdf";
1487+
1488+
PdfWriter writer = new PdfWriter(outputFile);
1489+
PdfReader reader = new PdfReader(inputFile);
1490+
1491+
PdfDocument inputPdfDocument = new PdfDocument(reader);
1492+
PdfDocument outputPdfDocument = new PdfDocument(writer);
1493+
1494+
int lastPage = inputPdfDocument.getNumberOfPages();
1495+
inputPdfDocument.copyPagesTo(lastPage, lastPage, outputPdfDocument);
1496+
1497+
inputPdfDocument.close();
1498+
outputPdfDocument.close();
1499+
1500+
Assert.assertNull(new CompareTool().compareByContent(outputFile, cmpFile, destinationFolder, "diff_"));
1501+
}
1502+
14801503
@Test
14811504
public void pdfVersionTest() throws IOException {
14821505
String filename = sourceFolder + "hello.pdf";

0 commit comments

Comments
 (0)