diff options
Diffstat (limited to 'src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFParagraph.java')
-rw-r--r-- | src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFParagraph.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFParagraph.java b/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFParagraph.java index 31be821e06..f53d524b01 100644 --- a/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFParagraph.java +++ b/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFParagraph.java @@ -22,6 +22,7 @@ import java.math.BigInteger; import java.util.List; import junit.framework.TestCase; + import org.apache.poi.xwpf.XWPFTestDataSamples; import org.openxmlformats.schemas.drawingml.x2006.picture.CTPicture; import org.openxmlformats.schemas.drawingml.x2006.picture.PicDocument; @@ -495,6 +496,24 @@ public final class TestXWPFParagraph extends TestCase { assertTrue(p.removeRun(0)); } + + public void testFieldRuns() throws Exception { + XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("FldSimple.docx"); + List<XWPFParagraph> ps = doc.getParagraphs(); + assertEquals(1, ps.size()); + + XWPFParagraph p = ps.get(0); + assertEquals(1, p.getRuns().size()); + assertEquals(1, p.getIRuns().size()); + + XWPFRun r = p.getRuns().get(0); + assertEquals(XWPFFieldRun.class, r.getClass()); + + XWPFFieldRun fr = (XWPFFieldRun)r; + assertEquals(" FILENAME \\* MERGEFORMAT ", fr.getFieldInstruction()); + assertEquals("FldSimple.docx", fr.text()); + assertEquals("FldSimple.docx", p.getText()); + } @SuppressWarnings("deprecation") public void testRuns() { |