// need to handle (not only) the type (radial,rectangular,linear),
// the direction, e.g. top right, and bounds (e.g. for rectangular boxes)
switch (fillType) {
+ case FILL_BACKGROUND:
+ return DrawPaint.createSolidPaint(getBackgroundColor());
case FILL_SOLID:
return DrawPaint.createSolidPaint(getForegroundColor());
case FILL_SHADE_SHAPE:
case FILL_SHADE:
case FILL_SHADE_SCALE:
return getGradientPaint(GradientType.linear);
+ case FILL_TEXTURE:
case FILL_PICTURE:
return getTexturePaint();
default:
}
}
+ @Test
+ void fillTypesPaintMapping_65653() throws IOException {
+ try (HSLFSlideShow ppt = open("41246-2.ppt")) {
+ HSLFAutoShape as = (HSLFAutoShape) ppt.getSlides().get(15).getShapes().get(0);
+ HSLFFill f = as.getFill();
+ assertEquals(HSLFFill.FILL_TEXTURE, f.getFillType());
+ PaintStyle p = f.getFillStyle().getPaint();
+ assertTrue(p instanceof PaintStyle.TexturePaint);
+ }
+ try (HSLFSlideShow ppt = open("backgrounds.ppt")) {
+ HSLFAutoShape as = (HSLFAutoShape) ppt.getSlides().get(1).getShapes().get(0);
+ HSLFFill f = as.getFill();
+ assertEquals(HSLFFill.FILL_BACKGROUND, f.getFillType());
+ PaintStyle p = as.getFillStyle().getPaint();
+ assertTrue(p instanceof SolidPaint);
+ assertEquals(Color.WHITE, ((SolidPaint)p).getSolidColor().getColor());
+ }
+ }
+
/**
* First fix from Bug 42474: NPE in RichTextRun.isBold()
* when the RichTextRun comes from a Notes model object