Skip to content

Commit 32d831d

Browse files
committed
PDFBOX-6110: improve test coverage of XMPMediaManagementSchema
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1930120 13f79535-47bb-0310-9956-ffa450edef68
1 parent 26eaf8c commit 32d831d

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

xmpbox/src/test/java/org/apache/xmpbox/xml/DomXmpParserTest.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import org.apache.xmpbox.type.ArrayProperty;
3232
import org.apache.xmpbox.type.DimensionsType;
3333
import org.apache.xmpbox.type.ResourceEventType;
34+
import org.apache.xmpbox.type.ResourceRefType;
3435

3536
import org.junit.jupiter.api.Assertions;
3637
import org.junit.jupiter.api.Test;
@@ -157,13 +158,28 @@ void testPDFBox5288() throws XmpParsingException
157158
Assertions.assertEquals("iDRS PDF output engine 7", firstHistoryEntry.getParameters());
158159
}
159160

161+
/**
162+
* Test PageTextSchema and XMPMediaManagementSchema.
163+
*
164+
* @throws XmpParsingException
165+
*/
160166
@Test
161167
void testPageTextSchema() throws XmpParsingException
162168
{
163169
String s = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n" +
164170
"<?xpacket begin=\"\" id=\"W5M0MpCehiHzreSzNTczkc9d\"?>\n" +
165171
"<x:xmpmeta xmlns:x=\"adobe:ns:meta/\">\n" +
166172
" <rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n" +
173+
" <rdf:Description xmlns:stRef=\"http://ns.adobe.com/xap/1.0/sType/ResourceRef#\"\n" +
174+
" xmlns:xmpMM=\"http://ns.adobe.com/xap/1.0/mm/\"\n" +
175+
" rdf:about=\"\">\n" +
176+
" <xmpMM:InstanceID>uuid:b429d411-e628-45ca-b932-d2c77fbe6cd3</xmpMM:InstanceID>\n" +
177+
" <xmpMM:DocumentID>adobe:docid:indd:db084a4d-dbb2-11dc-ac34-beb3cc4028ec</xmpMM:DocumentID>\n" +
178+
" <xmpMM:RenditionClass>proof:pdf</xmpMM:RenditionClass>\n" +
179+
" <xmpMM:DerivedFrom rdf:parseType=\"Resource\">\n" +
180+
" <stRef:documentID>adobe:docid:indd:fa7c6589-9f4a-11dc-9641-af983df728d7</stRef:documentID>\n" +
181+
" </xmpMM:DerivedFrom>\n" +
182+
" </rdf:Description>" +
167183
" <rdf:Description xmlns:xmpTPg=\"http://ns.adobe.com/xap/1.0/t/pg/\"\n" +
168184
" rdf:about=\"\">\n" +
169185
" <xmpTPg:MaxPageSize>\n" +
@@ -183,5 +199,11 @@ void testPageTextSchema() throws XmpParsingException
183199
DimensionsType dim = (DimensionsType) pageTextSchema.getProperty(XMPPageTextSchema.MAX_PAGE_SIZE);
184200
Assertions.assertEquals("DimensionsType{4.0 x 3.0 inch}", dim.toString());
185201
Assertions.assertEquals("[IntegerType:7]", pageTextSchema.getProperty(XMPPageTextSchema.N_PAGES).toString());
202+
XMPMediaManagementSchema xmpMediaManagementSchema = xmp.getXMPMediaManagementSchema();
203+
ResourceRefType derivedFromProperty = xmpMediaManagementSchema.getDerivedFromProperty();
204+
Assertions.assertEquals("uuid:b429d411-e628-45ca-b932-d2c77fbe6cd3", xmpMediaManagementSchema.getInstanceID());
205+
Assertions.assertEquals("proof:pdf", xmpMediaManagementSchema.getRenditionClass());
206+
Assertions.assertEquals("adobe:docid:indd:db084a4d-dbb2-11dc-ac34-beb3cc4028ec", xmpMediaManagementSchema.getDocumentID());
207+
Assertions.assertEquals("adobe:docid:indd:fa7c6589-9f4a-11dc-9641-af983df728d7", derivedFromProperty.getDocumentID());
186208
}
187209
}

0 commit comments

Comments
 (0)