poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From talli...@apache.org
Subject svn commit: r1682310 - in /poi/trunk: src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFNumbering.java test-data/document/NumberingWOverrides.docx
Date Thu, 28 May 2015 19:08:25 GMT
Author: tallison
Date: Thu May 28 19:08:24 2015
New Revision: 1682310

URL: http://svn.apache.org/r1682310
Log:
POI-57889 -- actually trigger inclusion of CTNumLvl with document contributed by Moritz Dorka
on TIKA-1315

Added:
    poi/trunk/test-data/document/NumberingWOverrides.docx   (with props)
Modified:
    poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFNumbering.java

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFNumbering.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFNumbering.java?rev=1682310&r1=1682309&r2=1682310&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFNumbering.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFNumbering.java Thu
May 28 19:08:24 2015
@@ -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 T
 	}
 
 	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());
 	}
 
 }

Added: poi/trunk/test-data/document/NumberingWOverrides.docx
URL: http://svn.apache.org/viewvc/poi/trunk/test-data/document/NumberingWOverrides.docx?rev=1682310&view=auto
==============================================================================
Binary file - no diff available.

Propchange: poi/trunk/test-data/document/NumberingWOverrides.docx
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message