|
27 | 27 |
|
28 | 28 | import org.apache.xmpbox.XMPMetadata; |
29 | 29 | import org.apache.xmpbox.schema.XMPMediaManagementSchema; |
| 30 | +import org.apache.xmpbox.schema.XMPPageTextSchema; |
30 | 31 | import org.apache.xmpbox.type.ArrayProperty; |
| 32 | +import org.apache.xmpbox.type.DimensionsType; |
31 | 33 | import org.apache.xmpbox.type.ResourceEventType; |
32 | 34 |
|
33 | 35 | import org.junit.jupiter.api.Assertions; |
|
39 | 41 | */ |
40 | 42 | class DomXmpParserTest |
41 | 43 | { |
42 | | - DomXmpParserTest() |
43 | | - { |
44 | | - } |
45 | | - |
46 | 44 | @Test |
47 | 45 | void testPDFBox5649() throws IOException, XmpParsingException |
48 | 46 | { |
@@ -158,4 +156,32 @@ void testPDFBox5288() throws XmpParsingException |
158 | 156 | Assertions.assertEquals("created", firstHistoryEntry.getAction()); |
159 | 157 | Assertions.assertEquals("iDRS PDF output engine 7", firstHistoryEntry.getParameters()); |
160 | 158 | } |
| 159 | + |
| 160 | + @Test |
| 161 | + void testPageTextSchema() throws XmpParsingException |
| 162 | + { |
| 163 | + String s = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n" + |
| 164 | + "<?xpacket begin=\"\" id=\"W5M0MpCehiHzreSzNTczkc9d\"?>\n" + |
| 165 | + "<x:xmpmeta xmlns:x=\"adobe:ns:meta/\">\n" + |
| 166 | + " <rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n" + |
| 167 | + " <rdf:Description xmlns:xmpTPg=\"http://ns.adobe.com/xap/1.0/t/pg/\"\n" + |
| 168 | + " rdf:about=\"\">\n" + |
| 169 | + " <xmpTPg:MaxPageSize>\n" + |
| 170 | + " <rdf:Description xmlns:stDim=\"http://ns.adobe.com/xap/1.0/sType/Dimensions#\">\n" + |
| 171 | + " <stDim:w>4</stDim:w>\n" + |
| 172 | + " <stDim:h>3</stDim:h>\n" + |
| 173 | + " <stDim:unit>inch</stDim:unit>\n" + |
| 174 | + " </rdf:Description>\n" + |
| 175 | + " </xmpTPg:MaxPageSize>\n" + |
| 176 | + " <xmpTPg:NPages>7</xmpTPg:NPages>\n" + |
| 177 | + " </rdf:Description>\n" + |
| 178 | + " </rdf:RDF>\n" + |
| 179 | + "</x:xmpmeta><?xpacket end=\"r\"?>"; |
| 180 | + DomXmpParser xmpParser = new DomXmpParser(); |
| 181 | + XMPMetadata xmp = xmpParser.parse(s.getBytes(StandardCharsets.UTF_8)); |
| 182 | + XMPPageTextSchema pageTextSchema = xmp.getPageTextSchema(); |
| 183 | + DimensionsType dim = (DimensionsType) pageTextSchema.getProperty(XMPPageTextSchema.MAX_PAGE_SIZE); |
| 184 | + Assertions.assertEquals("DimensionsType{4.0 x 3.0 inch}", dim.toString()); |
| 185 | + Assertions.assertEquals("[IntegerType:7]", pageTextSchema.getProperty(XMPPageTextSchema.N_PAGES).toString()); |
| 186 | + } |
161 | 187 | } |
0 commit comments