From 8dd12c1ca7703a085b57fe4c5c35ef6e19d92134 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Wed, 24 Feb 2016 09:04:14 +0000 Subject: Allow style maps to be added --- .../org/zwobble/mammoth/tests/MammothTests.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/test/java/org/zwobble/mammoth/tests/MammothTests.java') 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 @@ -167,6 +167,27 @@ public class MammothTests { deepEquals(success("

Datum plane

"))); } + @Test + public void canUseCustomStyleMap() throws IOException { + assertThat( + convertToHtml("underline.docx", mammoth -> mammoth.addStyleMap("u => em")), + deepEquals(success("

The Sunset Tree

"))); + } + + @Test + public void mostRecentlyAddedStyleMapTakesPrecedence() throws IOException { + assertThat( + convertToHtml("underline.docx", mammoth -> mammoth.addStyleMap("u => em").addStyleMap("u => strong")), + deepEquals(success("

The Sunset Tree

"))); + } + + @Test + public void rulesFromPreviouslyAddedStyleMapsStillTakeEffectIfNotOverriden() throws IOException { + assertThat( + convertToHtml("underline.docx", mammoth -> mammoth.addStyleMap("u => em").addStyleMap("s => del")), + deepEquals(success("

The Sunset Tree

"))); + } + @Test public void canExtractRawText() throws IOException { assertThat( -- cgit v1.2.3