diff options
| author | Michael Williamson <mike@zwobble.org> | 2016-11-13 20:10:54 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-11-13 20:10:54 +0000 |
| commit | 38e6e7e0a0c214a17b251cea8c767655dfaecc67 (patch) | |
| tree | 3718fff1163b979f7d0ac34c60d1215828d3fc70 /src/test/java/org/zwobble/mammoth/tests/MammothTests.java | |
| parent | 90be34b20ed99409523a2d5ff174f48058969684 (diff) | |
Add basic embedded of style maps
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")), |
