diff options
author | Tim Allison <tallison@apache.org> | 2015-05-28 19:08:24 +0000 |
---|---|---|
committer | Tim Allison <tallison@apache.org> | 2015-05-28 19:08:24 +0000 |
commit | 179e46232be64f4142624b555c0c261822919854 (patch) | |
tree | 72f72c81a9c2a2eccbe3f682ac54cfd5d005bc70 | |
parent | d6f899fd9dd392e597e2b773d7985e5f31771741 (diff) | |
download | poi-179e46232be64f4142624b555c0c261822919854.tar.gz poi-179e46232be64f4142624b555c0c261822919854.zip |
POI-57889 -- actually trigger inclusion of CTNumLvl with document contributed by Moritz Dorka on TIKA-1315
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1682310 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFNumbering.java | 24 | ||||
-rw-r--r-- | test-data/document/NumberingWOverrides.docx | bin | 0 -> 15190 bytes |
2 files changed, 9 insertions, 15 deletions
diff --git a/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFNumbering.java b/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFNumbering.java index 2cae023cf9..5f5e9c07bc 100644 --- a/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFNumbering.java +++ b/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFNumbering.java @@ -23,6 +23,8 @@ import java.math.BigInteger; import junit.framework.TestCase; import org.apache.poi.xwpf.XWPFTestDataSamples; +import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTNum; +import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTNumLvl; public class TestXWPFNumbering extends TestCase { @@ -89,21 +91,13 @@ public class TestXWPFNumbering extends TestCase { } public void testOverrideList() throws IOException { - //TODO: for now the try/catch block ensures loading/inclusion of CTNumLevel - //for down stream processing. - //Ideally, we should find files that actually use overrides and test against those. - //Use XWPFParagraph's getNumStartOverride() in the actual tests - - XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("Numbering.docx"); - XWPFParagraph p = doc.getParagraphs().get(18);XWPFNumbering numbering = doc.getNumbering(); - boolean ex = false; - assertNull(p.getNumStartOverride()); - try { - numbering.getNum(p.getNumID()).getCTNum().getLvlOverrideArray(1); - } catch (IndexOutOfBoundsException e) { - ex = true; - } - assertTrue(ex); + XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("NumberingWOverrides.docx"); + XWPFParagraph p = doc.getParagraphs().get(4); + XWPFNumbering numbering = doc.getNumbering(); + CTNum ctNum = numbering.getNum(p.getNumID()).getCTNum(); + assertEquals(9, ctNum.sizeOfLvlOverrideArray()); + CTNumLvl ctNumLvl = ctNum.getLvlOverrideArray(0); + assertEquals("upperLetter", ctNumLvl.getLvl().getNumFmt().getVal().toString()); } } diff --git a/test-data/document/NumberingWOverrides.docx b/test-data/document/NumberingWOverrides.docx Binary files differnew file mode 100644 index 0000000000..48a7e2c251 --- /dev/null +++ b/test-data/document/NumberingWOverrides.docx |