poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cen...@apache.org
Subject svn commit: r1730598 - /poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFRun.java
Date Mon, 15 Feb 2016 19:16:46 GMT
Author: centic
Date: Mon Feb 15 19:16:45 2016
New Revision: 1730598

URL: http://svn.apache.org/viewvc?rev=1730598&view=rev
Log:
Tried to reproduce bug 55476, but could not, added unit test anyway

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=1730598&r1=1730597&r2=1730598&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 Mon Feb 15
19:16:45 2016
@@ -16,25 +16,19 @@
 ==================================================================== */
 package org.apache.poi.xwpf.usermodel;
 
+import junit.framework.TestCase;
+import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
+import org.apache.poi.util.Units;
+import org.apache.poi.xwpf.XWPFTestDataSamples;
+import org.apache.poi.xwpf.model.XWPFHeaderFooterPolicy;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.*;
+
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.math.BigInteger;
 import java.util.Iterator;
 import java.util.List;
 
-import junit.framework.TestCase;
-
-import org.apache.poi.xwpf.XWPFTestDataSamples;
-import org.apache.poi.xwpf.model.XWPFHeaderFooterPolicy;
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTBr;
-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.STOnOff;
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.STUnderline;
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.STVerticalAlignRun;
-
 /**
  * Tests for XWPF Run
  */
@@ -444,4 +438,26 @@ public class TestXWPFRun extends TestCas
             }
         }
     }
+
+    public void testBug55476() throws IOException, InvalidFormatException {
+        byte[] image = XWPFTestDataSamples.getImage("abstract1.jpg");
+        XWPFDocument document = new XWPFDocument();
+
+        document.createParagraph().createRun().addPicture(
+                new ByteArrayInputStream(image), Document.PICTURE_TYPE_JPEG, "test.jpg",
Units.toEMU(300), Units.toEMU(100));
+
+        XWPFDocument docBack = XWPFTestDataSamples.writeOutAndReadBack(document);
+        List<XWPFPicture> pictures = docBack.getParagraphArray(0).getRuns().get(0).getEmbeddedPictures();
+        assertEquals(1, pictures.size());
+        docBack.close();
+
+        /*OutputStream stream = new FileOutputStream("c:\\temp\\55476.docx");
+        try {
+            document.write(stream);
+        } finally {
+            stream.close();
+        }*/
+
+        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