Author: kiwiwings
Date: Sun Oct 24 22:07:59 2021
New Revision: 1894538

URL: http://svn.apache.org/viewvc?rev=1894538&view=rev
Log:
#65653 - HSLF FillType for texture and background color fills ignored

Modified:
    poi/site/src/documentation/content/xdocs/changes.xml
    
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFFill.java
    
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestBugs.java
    poi/trunk/poi/src/test/java9/module-info.class

Modified: poi/site/src/documentation/content/xdocs/changes.xml
URL: 
http://svn.apache.org/viewvc/poi/site/src/documentation/content/xdocs/changes.xml?rev=1894538&r1=1894537&r2=1894538&view=diff
==============================================================================
--- poi/site/src/documentation/content/xdocs/changes.xml (original)
+++ poi/site/src/documentation/content/xdocs/changes.xml Sun Oct 24 22:07:59 
2021
@@ -127,6 +127,7 @@
             <action type="fix" fixes-bug="65634" 
context="XSLF">SlideShowFactory.create(File, ...) should throw exception if the 
input file is not in a supported format</action>
             <action type="fix" fixes-bug="65648" context="SXSSF">Remove 
finalizer on SXSSF SheetDataWriter</action>
             <action type="fix" fixes-bug="65650" context="POI_Overall">Use 
image/x-pict as mime type for pict format pictures (previous versions used a 
mix of image/pict and image/x-pict)</action>
+            <action type="fix" fixes-bug="65653" context="HSLF">HSLF FillType 
for texture and background color fills ignored</action>
         </actions>
     </release>
 

Modified: 
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFFill.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFFill.java?rev=1894538&r1=1894537&r2=1894538&view=diff
==============================================================================
--- 
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFFill.java
 (original)
+++ 
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFFill.java
 Sun Oct 24 22:07:59 2021
@@ -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:

Modified: 
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestBugs.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestBugs.java?rev=1894538&r1=1894537&r2=1894538&view=diff
==============================================================================
--- 
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestBugs.java
 (original)
+++ 
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestBugs.java
 Sun Oct 24 22:07:59 2021
@@ -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

Modified: poi/trunk/poi/src/test/java9/module-info.class
URL: 
http://svn.apache.org/viewvc/poi/trunk/poi/src/test/java9/module-info.class?rev=1894538&r1=1894537&r2=1894538&view=diff
==============================================================================
Binary files - no diff available.



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to