diff options
Diffstat (limited to 'src/test/java/org/zwobble/mammoth/tests/MammothTests.java')
| -rw-r--r-- | src/test/java/org/zwobble/mammoth/tests/MammothTests.java | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/test/java/org/zwobble/mammoth/tests/MammothTests.java b/src/test/java/org/zwobble/mammoth/tests/MammothTests.java index 665e00a..ab67f07 100644 --- a/src/test/java/org/zwobble/mammoth/tests/MammothTests.java +++ b/src/test/java/org/zwobble/mammoth/tests/MammothTests.java @@ -3,10 +3,11 @@ package org.zwobble.mammoth.tests; import org.junit.Test; import org.zwobble.mammoth.DocumentConverter; import org.zwobble.mammoth.Result; +import org.zwobble.mammoth.internal.docx.EmbeddedStyleMap; +import org.zwobble.mammoth.internal.docx.InMemoryArchive; import org.zwobble.mammoth.internal.styles.parsing.ParseException; -import java.io.File; -import java.io.IOException; +import java.io.*; import java.nio.file.Files; import java.nio.file.Path; import java.util.function.Function; @@ -235,6 +236,17 @@ public class MammothTests { } @Test + public void embeddedStyleMapCanBeWrittenAndThenRead() throws IOException { + InMemoryArchive archive = InMemoryArchive.fromStream(new FileInputStream(TestData.file("single-paragraph.docx"))); + EmbeddedStyleMap.embedStyleMap(archive, "p => h1"); + + assertThat( + new DocumentConverter().convertToHtml(new ByteArrayInputStream(archive.toByteArray())), + isSuccess("<h1>Walking on imported air</h1>") + ); + } + + @Test public void canExtractRawTextFromFile() throws IOException { assertThat( new DocumentConverter().extractRawText(TestData.file("simple-list.docx")), |
