aboutsummaryrefslogtreecommitdiff
path: root/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/zwobble/mammoth/tests/MammothTests.java18
1 files changed, 18 insertions, 0 deletions
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;
@@ -67,6 +70,21 @@ public class MammothTests {
}
@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("<p><img src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAIAAAACUFjqAAAAAXNSR0IArs4c6QAAAAlwSFlzAAAOvgAADr4B6kKxwAAAABNJREFUKFNj/M+ADzDhlWUYqdIAQSwBE8U+X40AAAAASUVORK5CYII=\" /></p>")));
+ } finally {
+ tempDirectory.toFile().delete();
+ }
+ }
+
+ @Test
public void contentTypesAreRead() {
assertThat(
convertToHtml("tiny-picture-custom-content-type.docx"),