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
4eb8175d88
commit
bfa702ed88
@ -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();
|
||||
}
|
||||
}
|
BIN
test-data/slideshow/testtiff.tif
Normal file
BIN
test-data/slideshow/testtiff.tif
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user