From fba6593d40f2f635e791103ab95466681189fdb8 Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Tue, 6 Dec 2011 03:33:11 +0000 Subject: [PATCH] Test that shows that bug #52288 is already fixed git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1210768 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/xwpf/usermodel/TestXWPFRun.java | 21 ++++++++++++++++++ test-data/document/52288.docx | Bin 0 -> 12788 bytes 2 files changed, 21 insertions(+) create mode 100644 test-data/document/52288.docx diff --git a/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFRun.java b/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFRun.java index 88b44975f6..272ca87d1c 100644 --- a/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFRun.java +++ b/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFRun.java @@ -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 TestCase { 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 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"); + } + } + } + } + } } diff --git a/test-data/document/52288.docx b/test-data/document/52288.docx new file mode 100644 index 0000000000000000000000000000000000000000..0eb23b0d4e5cd52bda79634b87b3766e3813e45d GIT binary patch literal 12788 zcmeHtWmKHWwszz08a&XrySux)6Wk><5G1%0BtUR?cXxujTW|si?k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