From cfabbcdab4fbd8401569ec5e6e88a6bca913b502 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sun, 21 Feb 2016 09:05:38 +0000 Subject: Implement FileReader to support external images --- .../java/org/zwobble/mammoth/tests/MammothTests.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/test/java/org') diff --git a/src/test/java/org/zwobble/mammoth/tests/MammothTests.java b/src/test/java/org/zwobble/mammoth/tests/MammothTests.java index c165cfd..e778630 100644 --- a/src/test/java/org/zwobble/mammoth/tests/MammothTests.java +++ b/src/test/java/org/zwobble/mammoth/tests/MammothTests.java @@ -5,6 +5,9 @@ import org.zwobble.mammoth.Mammoth; import org.zwobble.mammoth.results.Result; import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; import static org.junit.Assert.assertThat; import static org.zwobble.mammoth.results.Result.success; @@ -66,6 +69,21 @@ public class MammothTests { deepEquals(success("

"))); } + @Test + public void imagesStoredOutsideOfDocumentAreIncludedInOutput() throws IOException { + Path tempDirectory = Files.createTempDirectory("mammoth-"); + try { + Path documentPath = tempDirectory.resolve("external-picture.docx"); + Files.copy(TestData.file("external-picture.docx").toPath(), documentPath); + Files.copy(TestData.file("tiny-picture.png").toPath(), tempDirectory.resolve("tiny-picture.png")); + assertThat( + Mammoth.convertToHtml(documentPath.toFile()), + deepEquals(success("

"))); + } finally { + tempDirectory.toFile().delete(); + } + } + @Test public void contentTypesAreRead() { assertThat( -- cgit v1.2.3