Browse Source

Bug 60294 - Add "unknown" ShapeType for 4095

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1766227 13f79535-47bb-0310-9956-ffa450edef68
tags/REL_3_16_BETA1
Andreas Beeker 7 years ago
parent
commit
49572b2ac8

+ 5
- 0
src/java/org/apache/poi/sl/usermodel/ShapeType.java View File

@@ -307,6 +307,11 @@ public enum ShapeType {
}
public static ShapeType forId(int id, boolean isOoxmlId){
// exemption for #60294
if (!isOoxmlId && id == 0x0FFF) {
return NOT_PRIMITIVE;
}
for(ShapeType t : values()){
if((isOoxmlId && t.ooxmlId == id) ||
(!isOoxmlId && t.nativeId == id)) return t;

+ 12
- 0
src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java View File

@@ -75,6 +75,7 @@ import org.apache.poi.sl.usermodel.PaintStyle;
import org.apache.poi.sl.usermodel.PaintStyle.SolidPaint;
import org.apache.poi.sl.usermodel.PictureData.PictureType;
import org.apache.poi.sl.usermodel.Placeholder;
import org.apache.poi.sl.usermodel.ShapeType;
import org.apache.poi.sl.usermodel.Slide;
import org.apache.poi.sl.usermodel.SlideShow;
import org.apache.poi.sl.usermodel.SlideShowFactory;
@@ -1008,4 +1009,15 @@ public final class TestBugs {
}
return null;
}

/**
* Bug 60294: Add "unknown" ShapeType for 4095
*/
@Test
public void bug60294() throws IOException {
HSLFSlideShow ppt = open("60294.ppt");
List<HSLFShape> shList = ppt.getSlides().get(0).getShapes();
assertEquals(ShapeType.NOT_PRIMITIVE, ((HSLFAutoShape)shList.get(2)).getShapeType());
ppt.close();
}
}

BIN
test-data/slideshow/60294.ppt View File


Loading…
Cancel
Save