mirror of https://github.com/apache/poi.git
XSLFPictureData support for TIFF images - patch and tests from bug #59742 from Jens Popp
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1749732 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5f921159e7
commit
ec07d025c1
|
@ -249,6 +249,8 @@ public final class XSLFPictureData extends POIXMLDocumentPart implements Picture
|
|||
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 extends POIXMLDocumentPart implements Picture
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
Binary file not shown.
Loading…
Reference in New Issue