poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject svn commit: r1749732 - in /poi/trunk: src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureData.java src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFPictureShape.java test-data/slideshow/testtiff.tif
Date Wed, 22 Jun 2016 16:18:37 GMT
Author: nick
Date: Wed Jun 22 16:18:36 2016
New Revision: 1749732

URL: http://svn.apache.org/viewvc?rev=1749732&view=rev
Log:
XSLFPictureData support for TIFF images - patch and tests from bug #59742 from Jens Popp

Added:
    poi/trunk/test-data/slideshow/testtiff.tif   (with props)
Modified:
    poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureData.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFPictureShape.java

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureData.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureData.java?rev=1749732&r1=1749731&r2=1749732&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureData.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureData.java Wed Jun 22
16:18:36 2016
@@ -249,6 +249,8 @@ public final class XSLFPictureData exten
             return PictureType.WPG;
         } else if (XSLFRelation.IMAGE_WDP.getContentType().equals(ct)) {
             return PictureType.WDP;
+        } else if (XSLFRelation.IMAGE_TIFF.getContentType().equals(ct)) {
+            return PictureType.TIFF;
         } else {
             return null;
         }
@@ -267,6 +269,7 @@ public final class XSLFPictureData exten
             case BMP: return XSLFRelation.IMAGE_BMP;
             case WPG: return XSLFRelation.IMAGE_WPG;
             case WDP: return XSLFRelation.IMAGE_WDP;
+            case TIFF: return XSLFRelation.IMAGE_TIFF;
             default: return null;
         }
     }

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFPictureShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFPictureShape.java?rev=1749732&r1=1749731&r2=1749732&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFPictureShape.java
(original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFPictureShape.java
Wed Jun 22 16:18:36 2016
@@ -32,6 +32,7 @@ import java.util.Map;
 
 import org.apache.poi.POIDataSamples;
 import org.apache.poi.sl.usermodel.PictureData.PictureType;
+import org.apache.poi.util.IOUtils;
 import org.apache.poi.xslf.XSLFTestDataSamples;
 import org.junit.Test;
 import org.openxmlformats.schemas.presentationml.x2006.main.CTPicture;
@@ -193,4 +194,18 @@ public class TestXSLFPictureShape {
         assertTrue(ppt2.getPictureData().isEmpty());
         ppt2.close();
     }
+    
+    @Test
+    public void testTiffImageBug59742() throws Exception {
+        XMLSlideShow slideShow = new XMLSlideShow();
+        final InputStream tiffStream = _slTests.openResourceAsStream("testtiff.tif");
+        final byte[] pictureData = IOUtils.toByteArray(tiffStream);
+        IOUtils.closeQuietly(tiffStream);
+        
+        XSLFPictureData pic = slideShow.addPicture(pictureData, PictureType.TIFF);
+        assertEquals("image/tiff", pic.getContentType());
+        assertEquals("image1.tiff", pic.getFileName());
+        
+        slideShow.close();
+    }
 }
\ No newline at end of file

Added: poi/trunk/test-data/slideshow/testtiff.tif
URL: http://svn.apache.org/viewvc/poi/trunk/test-data/slideshow/testtiff.tif?rev=1749732&view=auto
==============================================================================
Binary file - no diff available.

Propchange: poi/trunk/test-data/slideshow/testtiff.tif
------------------------------------------------------------------------------
    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


Mime
View raw message