diff options
author | Andreas Beeker <kiwiwings@apache.org> | 2021-10-24 22:07:59 +0000 |
---|---|---|
committer | Andreas Beeker <kiwiwings@apache.org> | 2021-10-24 22:07:59 +0000 |
commit | 4b230fa142f599f9580a630f7bbdcd3ae095569f (patch) | |
tree | 29efa84feffbe1610eb8577912953eb80c067c14 /poi-scratchpad | |
parent | 3a3ac61965e3e7178a0df418e15351465312c1d4 (diff) | |
download | poi-4b230fa142f599f9580a630f7bbdcd3ae095569f.tar.gz poi-4b230fa142f599f9580a630f7bbdcd3ae095569f.zip |
#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
Diffstat (limited to 'poi-scratchpad')
-rw-r--r-- | poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFFill.java | 3 | ||||
-rw-r--r-- | poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestBugs.java | 19 |
2 files changed, 22 insertions, 0 deletions
diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFFill.java b/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFFill.java index 50ddf9cdf2..219cd05c59 100644 --- a/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFFill.java +++ b/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFFill.java @@ -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: diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestBugs.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestBugs.java index a2b0df9bf7..1cd5be3cf6 100644 --- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestBugs.java +++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestBugs.java @@ -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 |