|
26 | 26 | import org.apache.tika.metadata.Geographic; |
27 | 27 | import org.apache.tika.metadata.HttpHeaders; |
28 | 28 | import org.apache.tika.metadata.Metadata; |
| 29 | +import org.apache.tika.metadata.TikaCoreProperties; |
29 | 30 | import org.apache.tika.parser.AutoDetectParser; |
30 | 31 | import org.apache.tika.parser.ParseContext; |
31 | 32 | import org.apache.tika.parser.Parser; |
@@ -84,4 +85,25 @@ public void testAppleLivePhotoMakerNote() throws Exception { |
84 | 85 | } |
85 | 86 | } |
86 | 87 |
|
| 88 | + /* |
| 89 | + testAVIF_XMP.avif is a 32x32 gradient encoded with libavif through |
| 90 | + ImageMagick, with an XMP packet attached: AVIF is the same ISO-BMFF |
| 91 | + container, so the same parser reads it (TIKA-4870). |
| 92 | + */ |
| 93 | + @Test |
| 94 | + public void testAvif() throws Exception { |
| 95 | + Metadata metadata = new Metadata(); |
| 96 | + try (TikaInputStream tis = getResourceAsStream("/test-documents/testAVIF_XMP.avif")) { |
| 97 | + parser.parse(tis, new DefaultHandler(), metadata, new ParseContext()); |
| 98 | + |
| 99 | + assertEquals("image/avif", metadata.get(HttpHeaders.CONTENT_TYPE)); |
| 100 | + assertEquals("avif", metadata.get(ImageMetadataExtractor.UNKNOWN_IMG_NS + "Major Brand")); |
| 101 | + assertEquals("32 pixels", metadata.get(ImageMetadataExtractor.UNKNOWN_IMG_NS + "Width")); |
| 102 | + assertEquals("32 pixels", metadata.get(ImageMetadataExtractor.UNKNOWN_IMG_NS + "Height")); |
| 103 | + //the XMP item is found through meta/iinf/iloc, as it is for HEIC |
| 104 | + assertEquals("AVIF XMP Title", metadata.get(TikaCoreProperties.TITLE)); |
| 105 | + assertEquals("Jane Photographer", metadata.get(TikaCoreProperties.CREATOR)); |
| 106 | + } |
| 107 | + } |
| 108 | + |
87 | 109 | } |
0 commit comments