summaryrefslogtreecommitdiff
path: root/src/test/java/org
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2017-04-22 15:53:54 +0100
committerMichael Williamson <mike@zwobble.org>2017-04-22 15:54:55 +0100
commit2d5ab06e462f2db69e64bd1dcbba98e8752fd146 (patch)
treec1cd4cf79069ebc0009f788071b405bf3d4f7f77 /src/test/java/org
parentd078ad2ad09fb504b46f07b75df4fe365a59c6a4 (diff)
Handle complex fields that do not have a "separate" fldChar.
Diffstat (limited to 'src/test/java/org')
-rw-r--r--src/test/java/org/zwobble/mammoth/tests/docx/BodyXmlTests.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/test/java/org/zwobble/mammoth/tests/docx/BodyXmlTests.java b/src/test/java/org/zwobble/mammoth/tests/docx/BodyXmlTests.java
index a28086d..4a750a5 100644
--- a/src/test/java/org/zwobble/mammoth/tests/docx/BodyXmlTests.java
+++ b/src/test/java/org/zwobble/mammoth/tests/docx/BodyXmlTests.java
@@ -307,6 +307,32 @@ public class BodyXmlTests {
isEmptyRun()
)));
}
+
+ @Test
+ public void fieldWithoutSeparateFldCharIsIgnored() {
+ XmlElement hyperlinkRunXml = runXml("this is a hyperlink");
+ XmlElement element = paragraphXml(list(
+ BEGIN_COMPLEX_FIELD,
+ HYPERLINK_INSTRTEXT,
+ SEPARATE_COMPLEX_FIELD,
+ BEGIN_COMPLEX_FIELD,
+ END_COMPLEX_FIELD,
+ hyperlinkRunXml,
+ END_COMPLEX_FIELD
+ ));
+ DocumentElement paragraph = readSuccess(bodyReader(), element);
+
+ assertThat(paragraph, isParagraph(hasChildren(
+ isEmptyRun(),
+ isEmptyHyperlinkedRun(),
+ isEmptyHyperlinkedRun(),
+ isEmptyHyperlinkedRun(),
+ isHyperlinkedRun(hasChildren(
+ isTextElement("this is a hyperlink")
+ )),
+ isEmptyRun()
+ )));
+ }
}
@Test