Skip to content

Commit 331ba7c

Browse files
committed
Add another problematic xmp test
DEVSIX-1870
1 parent 4347293 commit 331ba7c

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

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

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ This file is part of the iText (R) project.
5858

5959
import java.io.ByteArrayInputStream;
6060
import java.io.ByteArrayOutputStream;
61+
import java.io.FileNotFoundException;
6162
import java.io.IOException;
6263
import java.nio.charset.StandardCharsets;
6364

@@ -211,7 +212,8 @@ public void createEmptyDocumentWithAbcXmp() throws IOException, XMPException {
211212
@Test
212213
@Ignore("DEVSIX-1899: fails in .NET passes in Java")
213214
public void customXmpTest() throws IOException, InterruptedException {
214-
String xmp = "<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d' bytes='770'?>\n" +
215+
runCustomXmpTest("customXmp",
216+
"<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d' bytes='770'?>\n" +
215217
"\n" +
216218
"<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'\n" +
217219
" xmlns:iX='http://ns.adobe.com/iX/1.0/'>\n" +
@@ -232,9 +234,22 @@ public void customXmpTest() throws IOException, InterruptedException {
232234
" </rdf:Description>\n" +
233235
"\n" +
234236
"</rdf:RDF>\n" +
235-
"<?xpacket end='r'?>";
236-
String outPath = destinationFolder + "customXmp.pdf";
237-
String cmpPath = sourceFolder + "cmp_customXmp.pdf";
237+
"<?xpacket end='r'?>");
238+
}
239+
240+
@Test
241+
@Ignore("DEVSIX-1899: fails in .NET passes in Java")
242+
public void customXmpTest02() throws IOException, InterruptedException {
243+
runCustomXmpTest("customXmp02",
244+
"<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d' bytes='1026'?><rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:iX='http://ns.adobe.com/iX/1.0/'><rdf:Description about='' xmlns='http://ns.adobe.com/pdf/1.3/' xmlns:pdf='http://ns.adobe.com/pdf/1.3/' pdf:CreationDate='2016-01-27T13:07:23Z' pdf:ModDate='2016-01-27T13:07:23Z' pdf:Producer='Acrobat Distiller 5.0.5 (Windows)' pdf:Author='Koeck' pdf:Creator='PScript5.dll Version 5.2.2' pdf:Title='Rasant_ACE.indd'/>\n" +
245+
"<rdf:Description about='' xmlns='http://ns.adobe.com/xap/1.0/' xmlns:xap='http://ns.adobe.com/xap/1.0/' xap:CreateDate='2016-01-27T13:07:23Z' xap:ModifyDate='2016-01-27T13:07:23Z' xap:Author='Koeck' xap:MetadataDate='2016-01-27T13:07:23Z'><xap:Title><rdf:Alt><rdf:li xml:lang='x-default'>Rasant_ACE.indd</rdf:li></rdf:Alt></xap:Title></rdf:Description>\n" +
246+
"<rdf:Description about='' xmlns='http://purl.org/dc/elements/1.1/' xmlns:dc='http://purl.org/dc/elements/1.1/' dc:creator='Koeck' dc:title='Rasant_ACE.indd'/>\n" +
247+
"</rdf:RDF><?xpacket end='r'?>");
248+
}
249+
250+
private void runCustomXmpTest(String name, String xmp) throws IOException, InterruptedException {
251+
String outPath = destinationFolder + name + ".pdf";
252+
String cmpPath = sourceFolder + "cmp_" + name + ".pdf";
238253

239254
PdfDocument pdfDoc = new PdfDocument(new PdfWriter(outPath));
240255
PdfPage page = pdfDoc.addNewPage();
@@ -243,7 +258,7 @@ public void customXmpTest() throws IOException, InterruptedException {
243258
pdfDoc.close();
244259

245260
CompareTool compareTool = new CompareTool();
246-
Assert.assertNull(compareTool.compareByContent(outPath, cmpPath, destinationFolder, "diff_customXmp_"));
261+
Assert.assertNull(compareTool.compareByContent(outPath, cmpPath, destinationFolder, "diff_" + name + "_"));
247262
Assert.assertNull(compareTool.compareDocumentInfo(outPath, cmpPath));
248263
}
249264

0 commit comments

Comments
 (0)