From 38e6e7e0a0c214a17b251cea8c767655dfaecc67 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sun, 13 Nov 2016 20:10:54 +0000 Subject: Add basic embedded of style maps --- .../java/org/zwobble/mammoth/tests/MammothTests.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (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 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; @@ -234,6 +235,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("

Walking on imported air

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