mirror of https://github.com/apache/poi.git
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
This commit is contained in:
parent
d6f899fd9d
commit
179e46232b
|
@ -23,6 +23,8 @@ import java.math.BigInteger;
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
import org.apache.poi.xwpf.XWPFTestDataSamples;
|
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 {
|
public class TestXWPFNumbering extends TestCase {
|
||||||
|
|
||||||
|
@ -89,21 +91,13 @@ public class TestXWPFNumbering extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testOverrideList() throws IOException {
|
public void testOverrideList() throws IOException {
|
||||||
//TODO: for now the try/catch block ensures loading/inclusion of CTNumLevel
|
XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("NumberingWOverrides.docx");
|
||||||
//for down stream processing.
|
XWPFParagraph p = doc.getParagraphs().get(4);
|
||||||
//Ideally, we should find files that actually use overrides and test against those.
|
XWPFNumbering numbering = doc.getNumbering();
|
||||||
//Use XWPFParagraph's getNumStartOverride() in the actual tests
|
CTNum ctNum = numbering.getNum(p.getNumID()).getCTNum();
|
||||||
|
assertEquals(9, ctNum.sizeOfLvlOverrideArray());
|
||||||
XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("Numbering.docx");
|
CTNumLvl ctNumLvl = ctNum.getLvlOverrideArray(0);
|
||||||
XWPFParagraph p = doc.getParagraphs().get(18);XWPFNumbering numbering = doc.getNumbering();
|
assertEquals("upperLetter", ctNumLvl.getLvl().getNumFmt().getVal().toString());
|
||||||
boolean ex = false;
|
|
||||||
assertNull(p.getNumStartOverride());
|
|
||||||
try {
|
|
||||||
numbering.getNum(p.getNumID()).getCTNum().getLvlOverrideArray(1);
|
|
||||||
} catch (IndexOutOfBoundsException e) {
|
|
||||||
ex = true;
|
|
||||||
}
|
|
||||||
assertTrue(ex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue