Skip to content

Commit e0650fa

Browse files
IdamkinIiText-CI
authored andcommitted
Remove problematic metadata from form test and add test for it
DEVSIX-1870 Autoported commit. Original commit hash: [4347293fb]
1 parent fe10931 commit e0650fa

File tree

4 files changed

+27
-1
lines changed

4 files changed

+27
-1
lines changed

itext.tests/itext.kernel.tests/itext/kernel/pdf/XMPMetadataTest.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,32 @@ public virtual void CreateEmptyDocumentWithAbcXmp() {
176176
reader.Close();
177177
}
178178

179+
/// <exception cref="System.IO.IOException"/>
180+
/// <exception cref="System.Exception"/>
181+
[NUnit.Framework.Test]
182+
[NUnit.Framework.Ignore("DEVSIX-1899: fails in .NET passes in Java")]
183+
public virtual void CustomXmpTest() {
184+
String xmp = "<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d' bytes='770'?>\n" + "\n" + "<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'\n"
185+
+ " xmlns:iX='http://ns.adobe.com/iX/1.0/'>\n" + "\n" + " <rdf:Description about=''\n" + " xmlns='http://ns.adobe.com/pdf/1.3/'\n"
186+
+ " xmlns:pdf='http://ns.adobe.com/pdf/1.3/'>\n" + " <pdf:ModDate>2001-03-28T15:17:00-08:00</pdf:ModDate>\n"
187+
+ " <pdf:CreationDate>2001-03-28T15:19:45-08:00</pdf:CreationDate>\n" + " </rdf:Description>\n" + "\n"
188+
+ " <rdf:Description about=''\n" + " xmlns='http://ns.adobe.com/xap/1.0/'\n" + " xmlns:xap='http://ns.adobe.com/xap/1.0/'>\n"
189+
+ " <xap:ModifyDate>2001-03-28T15:17:00-08:00</xap:ModifyDate>\n" + " <xap:CreateDate>2001-03-28T15:19:45-08:00</xap:CreateDate>\n"
190+
+ " <xap:MetadataDate>2001-03-28T15:17:00-08:00</xap:MetadataDate>\n" + " </rdf:Description>\n" + "\n"
191+
+ "</rdf:RDF>\n" + "<?xpacket end='r'?>";
192+
String outPath = destinationFolder + "customXmp.pdf";
193+
String cmpPath = sourceFolder + "cmp_customXmp.pdf";
194+
PdfDocument pdfDoc = new PdfDocument(new PdfWriter(outPath));
195+
PdfPage page = pdfDoc.AddNewPage();
196+
page.Flush();
197+
pdfDoc.SetXmpMetadata(xmp.GetBytes(iText.IO.Util.EncodingUtil.ISO_8859_1));
198+
pdfDoc.Close();
199+
CompareTool compareTool = new CompareTool();
200+
NUnit.Framework.Assert.IsNull(compareTool.CompareByContent(outPath, cmpPath, destinationFolder, "diff_customXmp_"
201+
));
202+
NUnit.Framework.Assert.IsNull(compareTool.CompareDocumentInfo(outPath, cmpPath));
203+
}
204+
179205
/// <exception cref="iText.Kernel.XMP.XMPException"/>
180206
private byte[] RemoveAlwaysDifferentEntries(byte[] cmpBytes) {
181207
XMPMeta xmpMeta = XMPMetaFactory.ParseFromBuffer(cmpBytes);

port-hash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
46dbf9c1f8c1fb351e423f88beaad64482fdfe06
1+
4347293fb741ba7496f7bdc5a8b626c488ae53f5

0 commit comments

Comments
 (0)