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 2011/12/06 04:33:12 UTC

svn commit: r1210768 - in /poi/trunk: src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFRun.java test-data/document/52288.docx

Author: nick
Date: Tue Dec  6 03:33:11 2011
New Revision: 1210768

URL: http://svn.apache.org/viewvc?rev=1210768&view=rev
Log:
Test that shows that bug #52288 is already fixed

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

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFRun.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFRun.java?rev=1210768&r1=1210767&r2=1210768&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFRun.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFRun.java Tue Dec  6 03:33:11 2011
@@ -19,6 +19,7 @@ package org.apache.poi.xwpf.usermodel;
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.math.BigInteger;
+import java.util.Iterator;
 import java.util.List;
 
 import junit.framework.TestCase;
@@ -369,4 +370,24 @@ public class TestXWPFRun extends TestCas
        assertEquals(1, doc.getAllPictures().size());
        assertEquals(1, r.getEmbeddedPictures().size());
     }
+    
+    /**
+     * Bugzilla #52288 - setting the font family on the
+     *  run mustn't NPE
+     */
+    public void testSetFontFamily_52288() throws Exception {
+       XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("52288.docx");
+       final Iterator<XWPFParagraph> paragraphs = doc.getParagraphsIterator();
+       while (paragraphs.hasNext()) {
+          final XWPFParagraph paragraph = paragraphs.next();
+          for (final XWPFRun run : paragraph.getRuns()) {
+             if (run != null) {
+                final String text = run.getText(0);
+                if (text != null) {
+                   run.setFontFamily("Times New Roman");
+                }
+             }
+          }
+       }
+    }
 }

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

Propchange: poi/trunk/test-data/document/52288.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