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 | 21 |
1 files changed, 21 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 6e5794a..288c6a2 100644 --- a/src/test/java/org/zwobble/mammoth/tests/MammothTests.java +++ b/src/test/java/org/zwobble/mammoth/tests/MammothTests.java @@ -168,6 +168,27 @@ public class MammothTests { } @Test + public void canUseCustomStyleMap() throws IOException { + assertThat( + convertToHtml("underline.docx", mammoth -> mammoth.addStyleMap("u => em")), + deepEquals(success("<p><strong>The <em>Sunset</em> Tree</strong></p>"))); + } + + @Test + public void mostRecentlyAddedStyleMapTakesPrecedence() throws IOException { + assertThat( + convertToHtml("underline.docx", mammoth -> mammoth.addStyleMap("u => em").addStyleMap("u => strong")), + deepEquals(success("<p><strong>The <strong>Sunset</strong> Tree</strong></p>"))); + } + + @Test + public void rulesFromPreviouslyAddedStyleMapsStillTakeEffectIfNotOverriden() throws IOException { + assertThat( + convertToHtml("underline.docx", mammoth -> mammoth.addStyleMap("u => em").addStyleMap("s => del")), + deepEquals(success("<p><strong>The <em>Sunset</em> Tree</strong></p>"))); + } + + @Test public void canExtractRawText() throws IOException { assertThat( Mammoth.extractRawText(TestData.file("simple-list.docx")), |
