From 179e46232be64f4142624b555c0c261822919854 Mon Sep 17 00:00:00 2001 From: Tim Allison Date: Thu, 28 May 2015 19:08:24 +0000 Subject: [PATCH] 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 --- .../poi/xwpf/usermodel/TestXWPFNumbering.java | 24 +++++++----------- test-data/document/NumberingWOverrides.docx | Bin 0 -> 15190 bytes 2 files changed, 9 insertions(+), 15 deletions(-) create mode 100644 test-data/document/NumberingWOverrides.docx 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 new file mode 100644 index 0000000000000000000000000000000000000000..48a7e2c251916ee8482891728283dc3f6e723fe4 GIT binary patch literal 15190 zcmeHu1$SJzvTmE1nK_1-Ic8>NW@ct)cFfF-i8$1}5oQa=c$&+@Yq0qe+QZBj*~#K@#$d#<_gb zy9kuNK>dBm8i0$+dHYFXVN^-hRUD@w$*%jH;Js!N(mqV=q& z712W+A%;k%{QVG^TN_eaW;uq5G0JTF=eYrOKAPGN9StSSGFwE4$I2O0E#EWD!n6Ph zcRSf>wdyImN&nIygY6hekEq5V<73{BLXsli9KR%+u)Pj6=J{QsGxw*DN?;htC zq#4bLs0bW0Zd}Mgj$8n+et%uY*UnN-nEMdNM_iL~A76LpU8Huv>JX5AbELlbF7bBx zTCg(_y&P=Wr`;r+AE;SxZ(sn0znLdt0&dF%utpAOeQ-eY)ORwqab}?Zb^l+p{2y$K ze|hxk#2%no!V6pkzXVTrDz5Zk7s)XgPpx7vLqTgx%Al<-SuMW4@GLEX>K+-2kIl>` zO?f$Ii@9zl>t5ofsv<;n!Yn-K^=UtKcmPsDJ4%>5796(Wv-W?Qy^NAcQjZ2lYhpxA z;zB0eN2E`DMcbnh`MFmHXGuyuIcH4XP?YPax_FoF$C97HG{0aaq3sP-$t&6wM$q;R z#}C$wzb=i1?qhuKM!jyo%5l;c=2$E0TUuNjMh1%P1fyzL+{=#XW3Qs_vVq7@T9^Wu zNQNgLGaXc|*Mq2i9Deo-63s^aEqlCdUBPSMB=z6+(a;r500FFN1_J=_0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