aboutsummaryrefslogtreecommitdiffstats
path: root/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFSDT.java
diff options
context:
space:
mode:
authorNick Burch <nick@apache.org>2013-06-25 13:09:08 +0000
committerNick Burch <nick@apache.org>2013-06-25 13:09:08 +0000
commit3c379bbcde3d65acac8a42b0f06200fb5cd1303b (patch)
tree3da5694a75e68ce5bd614b91eeb43bb3deab5dc2 /src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFSDT.java
parent5d40529d6a60dcffb92df30d9058ae62e1212f8b (diff)
downloadpoi-3c379bbcde3d65acac8a42b0f06200fb5cd1303b.tar.gz
poi-3c379bbcde3d65acac8a42b0f06200fb5cd1303b.zip
Patch from Tim Allison from bug #55142 - Not all XWPF SDT block
s need newlines git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1496458 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFSDT.java')
-rw-r--r--src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFSDT.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFSDT.java b/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFSDT.java
index 2359beac2e..f1a585567b 100644
--- a/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFSDT.java
+++ b/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFSDT.java
@@ -93,6 +93,31 @@ public final class TestXWPFSDT extends TestCase {
}
assertEquals("SDT as cell known failure", false, found);
}
+
+ /**
+ * POI-55142 and Tika 1130
+ */
+ public void testNewLinesBetweenRuns() throws Exception{
+ XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("Bug55142.docx");
+ List<XWPFSDT> sdts = extractAllSDTs(doc);
+ List<String> targs = new ArrayList<String>();
+ //these test newlines and tabs in paragraphs/body elements
+ targs.add("Rich-text1 abcdefghi");
+ targs.add("Rich-text2 abcd\t\tefgh");
+ targs.add("Rich-text3 abcd\nefg");
+ targs.add("Rich-text4 abcdefg");
+ targs.add("Rich-text5 abcdefg\nhijk");
+ targs.add("Plain-text1 abcdefg");
+ targs.add("Plain-text2 abcdefg\nhijk\nlmnop");
+ //this tests consecutive runs within a cell (not a paragraph)
+ //this test case was triggered by Tika-1130
+ targs.add("sdt_incell2 abcdefg");
+
+ for (int i = 0; i < sdts.size(); i++){
+ XWPFSDT sdt = sdts.get(i);
+ assertEquals(targs.get(i), targs.get(i), sdt.getContent().getText());
+ }
+ }
private List<XWPFSDT> extractAllSDTs(XWPFDocument doc){