Skip to content

Commit 65f786c

Browse files
committed
PDFBOX-6121: improve test coverage
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1930509 13f79535-47bb-0310-9956-ffa450edef68
1 parent 941ffaa commit 65f786c

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import org.apache.xmpbox.type.BadFieldValueException;
3939
import org.apache.xmpbox.type.DefinedStructuredType;
4040
import org.apache.xmpbox.type.DimensionsType;
41+
import org.apache.xmpbox.type.LayerType;
4142
import org.apache.xmpbox.type.PDFASchemaType;
4243
import org.apache.xmpbox.type.ResourceEventType;
4344
import org.apache.xmpbox.type.ResourceRefType;
@@ -315,7 +316,7 @@ void testPDFBox3882() throws IOException, XmpParsingException
315316
* @throws XmpParsingException
316317
*/
317318
@Test
318-
void testPDFBox3882_2() throws XmpParsingException
319+
void testPDFBox3882_2() throws XmpParsingException, BadFieldValueException
319320
{
320321
// data modified from XMP data in the JPEG file in Apache Tika JpegParserTest.testJPEGXMPMM()
321322
String s = "<?xpacket begin=\"\" id=\"W5M0MpCehiHzreSzNTczkc9d\"?>\n" +
@@ -367,6 +368,12 @@ void testPDFBox3882_2() throws XmpParsingException
367368
" </rdf:Bag>\n" +
368369
" </photoshop:DocumentAncestors>\n" +
369370
" <photoshop:DateCreated>2012-04-30T12:54:48Z</photoshop:DateCreated>\n" +
371+
" <photoshop:TextLayers>\n" +
372+
" <rdf:Seq>\n" +
373+
" <rdf:li photoshop:LayerName=\"Name1\" photoshop:LayerText=\"Text1\"/>\n" +
374+
" <rdf:li photoshop:LayerName=\"Name2\" photoshop:LayerText=\"Text2\"/>\n" +
375+
" </rdf:Seq>\n" +
376+
" </photoshop:TextLayers>\n" +
370377
" </rdf:Description>\n" +
371378
" </rdf:RDF>\n" +
372379
"</x:xmpmeta>\n" +
@@ -398,6 +405,12 @@ void testPDFBox3882_2() throws XmpParsingException
398405
assertEquals("xmp.did:49E997348D4911E1AB62EBF9B374B234", xmpMediaManagementSchema.getDocumentID());
399406
assertEquals("xmp.did:01801174072068118A6D9A879C818256", xmpMediaManagementSchema.getOriginalDocumentID());
400407
PhotoshopSchema photoshopSchema = xmp.getPhotoshopSchema();
408+
List<LayerType> textLayers = photoshopSchema.getTextLayers();
409+
assertEquals(2, textLayers.size());
410+
assertEquals("Name1", textLayers.get(0).getLayerName());
411+
assertEquals("Text1", textLayers.get(0).getLayerText());
412+
assertEquals("Name2", textLayers.get(1).getLayerName());
413+
assertEquals("Text2", textLayers.get(1).getLayerText());
401414
assertEquals("2012-04-30T12:54:48+00:00", photoshopSchema.getDateCreated());
402415
assertEquals("2012-05-03T09:34:50-04:00\tFile i1222b.jpg opened\n", photoshopSchema.getHistory());
403416
ArrayProperty ancestorsProperty = photoshopSchema.getDocumentAncestorsProperty();

0 commit comments

Comments
 (0)