You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ni...@apache.org on 2013/06/20 14:51:30 UTC

svn commit: r1494962 - /poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFFootnotes.java

Author: nick
Date: Thu Jun 20 12:51:30 2013
New Revision: 1494962

URL: http://svn.apache.org/r1494962
Log:
Patch from Tim Allen from bug #55066 - unit test to show that we no longer load XWPF footnotes twice

Modified:
    poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFFootnotes.java

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFFootnotes.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFFootnotes.java?rev=1494962&r1=1494961&r2=1494962&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFFootnotes.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFFootnotes.java Thu Jun 20 12:51:30 2013
@@ -19,6 +19,7 @@ package org.apache.poi.xwpf.usermodel;
 
 import java.io.IOException;
 import java.math.BigInteger;
+import java.util.List;
 
 import junit.framework.TestCase;
 
@@ -45,5 +46,25 @@ public class TestXWPFFootnotes extends T
 		XWPFFootnote note = docIn.getFootnoteByID(noteId.intValue());
 		assertEquals(note.getCTFtnEdn().getType(), STFtnEdn.NORMAL);
 	}
+
+   /**
+    * Bug 55066 - avoid double loading the footnotes
+    */
+	public void testLoadFootnotesOnce() throws IOException{
+		XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("Bug54849.docx");
+		List<XWPFFootnote> footnotes = doc.getFootnotes();
+		int hits = 0;
+		for (XWPFFootnote fn : footnotes){
+			for (IBodyElement e : fn.getBodyElements()){
+				if (e instanceof XWPFParagraph){
+					String txt = ((XWPFParagraph)e).getText();
+					if (txt.indexOf("Footnote_sdt") > -1){
+						hits++;
+					}
+				}
+			}
+		}
+		assertEquals("Load footnotes once", 1, hits);
+	}
 }
 



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