diff options
| author | Michael Williamson <mike@zwobble.org> | 2016-02-13 23:19:28 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-02-13 23:19:28 +0000 |
| commit | 6dd319ca5eebe1f97b9558b5b45bbccf402eb319 (patch) | |
| tree | 5d8521ba8ed8b1437da06ad3a2f3b0a74583d49e /src/test/java/org/zwobble/mammoth | |
| parent | a67ffc8bce54b319d9da39d6c4acfdc2d5ee0335 (diff) | |
Emit warning when reading image of unsupported content type
Diffstat (limited to 'src/test/java/org/zwobble/mammoth')
| -rw-r--r-- | src/test/java/org/zwobble/mammoth/tests/docx/BodyXmlTests.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/java/org/zwobble/mammoth/tests/docx/BodyXmlTests.java b/src/test/java/org/zwobble/mammoth/tests/docx/BodyXmlTests.java index 62fced9..49542ec 100644 --- a/src/test/java/org/zwobble/mammoth/tests/docx/BodyXmlTests.java +++ b/src/test/java/org/zwobble/mammoth/tests/docx/BodyXmlTests.java @@ -432,6 +432,25 @@ public class BodyXmlTests { } } + @Test + public void warningIfImageTypeIsUnsupportedByWebBrowsers() { + XmlElement element = inlineImageXml(embeddedBlipXml("rId5"), ""); + Relationships relationships = new Relationships(map( + "rId5", new Relationship("media/hat.emf"))); + DocxFile file = new InMemoryDocxFile(map("word/media/hat.emf", "Not an image at all!")); + ContentTypes contentTypes = new ContentTypes(map("emf", "image/x-emf"), map()); + + Result<?> result = read( + a(bodyReader, + with(RELATIONSHIPS, relationships), + with(DOCX_FILE, file), + with(CONTENT_TYPES, contentTypes)), + element); + assertThat( + result, + hasProperty("warnings", deepEquals(list(warning("Image of type image/x-emf is unlikely to display in web browsers"))))); + } + private XmlElement inlineImageXml(XmlElement blip, String description) { return element("w:drawing", list( element("wp:inline", imageXml(blip, description)))); |
