Bug 60294 - Add "unknown" ShapeType for 4095

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1766227 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andreas Beeker 2016-10-22 19:34:47 +00:00
parent 3f91e44380
commit 423a49cbab
3 changed files with 17 additions and 0 deletions

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;

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();
}
}

Binary file not shown.