mirror of https://github.com/apache/poi.git
#65653 - HSLF FillType for texture and background color fills ignored
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1894538 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3a3ac61965
commit
4b230fa142
|
@ -254,6 +254,8 @@ public final class HSLFFill {
|
|||
// 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:
|
||||
|
@ -264,6 +266,7 @@ public final class HSLFFill {
|
|||
case FILL_SHADE:
|
||||
case FILL_SHADE_SCALE:
|
||||
return getGradientPaint(GradientType.linear);
|
||||
case FILL_TEXTURE:
|
||||
case FILL_PICTURE:
|
||||
return getTexturePaint();
|
||||
default:
|
||||
|
|
|
@ -109,6 +109,25 @@ public final class TestBugs {
|
|||
}
|
||||
}
|
||||
|
||||
@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
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue