poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cen...@apache.org
Subject svn commit: r1826464 - /poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFRun.java
Date Sun, 11 Mar 2018 21:11:11 GMT
Author: centic
Date: Sun Mar 11 21:11:11 2018
New Revision: 1826464

URL: http://svn.apache.org/viewvc?rev=1826464&view=rev
Log:
Add test for setters/getters of XWPFRun to include morre generated classes in poi-ooxml-schemas.

See also https://github.com/centic9/poi-on-android/issues/31

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=1826464&r1=1826463&r2=1826464&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 Sun Mar 11
21:11:11 2018
@@ -16,16 +16,6 @@
 ==================================================================== */
 package org.apache.poi.xwpf.usermodel;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.math.BigInteger;
-import java.util.Iterator;
-import java.util.List;
-
 import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
 import org.apache.poi.util.Units;
 import org.apache.poi.wp.usermodel.HeaderFooterType;
@@ -38,18 +28,25 @@ import org.openxmlformats.schemas.drawin
 import org.openxmlformats.schemas.drawingml.x2006.main.CTBlipFillProperties;
 import org.openxmlformats.schemas.drawingml.x2006.picture.CTPicture;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTBr;
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTLang;
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTLanguage;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTOnOff;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTR;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRPr;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.STBrClear;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.STHighlightColor;
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.STLang;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.STOnOff;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.STUnderline;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.STVerticalAlignRun;
 
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.math.BigInteger;
+import java.util.Iterator;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
 /**
  * Tests for XWPF Run
  */
@@ -294,8 +291,6 @@ public class TestXWPFRun {
     /**
      * Test that on an existing document, we do the
      * right thing with it
-     *
-     * @throws IOException
      */
     @Test
     public void testExisting() throws IOException {
@@ -458,7 +453,7 @@ public class TestXWPFRun {
     }
     
     @Test
-    public void testSetGetLang() throws IOException {
+    public void testSetGetLang() {
         XWPFRun run = p.createRun();
         assertNull(run.getLang());
 
@@ -473,7 +468,7 @@ public class TestXWPFRun {
     }
 
     @Test
-    public void testSetGetHighlight() throws IOException {
+    public void testSetGetHighlight() {
         XWPFRun run = p.createRun();
         assertEquals(false, run.isHighlighted());
         
@@ -654,4 +649,28 @@ public class TestXWPFRun {
         
         document.close();
     }
+
+    @Test
+    public void testSetters() throws IOException {
+        XWPFDocument document = new XWPFDocument();
+        final XWPFRun run = document.createParagraph().createRun();
+
+        // at least trigger some of the setters to ensure classes are included in
+        // the poi-ooxml-schemas
+        run.setBold(true);
+        run.setCapitalized(true);
+        run.setCharacterSpacing(2);
+        assertEquals(2, run.getCharacterSpacing());
+        run.setColor("000000");
+        run.setDoubleStrikethrough(true);
+        run.setEmbossed(true);
+        run.setFontFamily("Calibri");
+        assertEquals("Calibri", run.getFontFamily());
+        run.setFontSize(10);
+        assertEquals(10, run.getFontSize());
+        run.setImprinted(true);
+        run.setItalic(true);
+
+        document.close();
+    }
 }



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


Mime
View raw message