You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ki...@apache.org on 2021/10/11 19:44:47 UTC

svn commit: r1894140 - in /poi: site/src/documentation/content/xdocs/ trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/model/ trunk/poi-ooxml/src/test/java/org/apache/poi/xslf/ trunk/test-data/slideshow/

Author: kiwiwings
Date: Mon Oct 11 19:44:47 2021
New Revision: 1894140

URL: http://svn.apache.org/viewvc?rev=1894140&view=rev
Log:
#65551 - Incorrect fetching paragraph and text runs props from master shape

Added:
    poi/trunk/test-data/slideshow/bug65551.pptx   (with props)
Modified:
    poi/site/src/documentation/content/xdocs/changes.xml
    poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/model/CharacterPropertyFetcher.java
    poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/model/ParagraphPropertyFetcher.java
    poi/trunk/poi-ooxml/src/test/java/org/apache/poi/xslf/TestXSLFBugs.java

Modified: poi/site/src/documentation/content/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/poi/site/src/documentation/content/xdocs/changes.xml?rev=1894140&r1=1894139&r2=1894140&view=diff
==============================================================================
--- poi/site/src/documentation/content/xdocs/changes.xml (original)
+++ poi/site/src/documentation/content/xdocs/changes.xml Mon Oct 11 19:44:47 2021
@@ -119,6 +119,7 @@
             <action type="fix" fixes-bug="62040" context="SS_Common">QUOTIENT function does not support cell references</action>
             <action type="fix" fixes-bug="64542" context="OPC">Allow creation of POIFSFileSystem instances from FileChannels but with an optional flag to prevent POI from closing the channel</action>
             <action type="fix" fixes-bug="65452" context="SS_Common">WorkbookFactory.create(File, ...) should throw exception if the input file is not in a supported format</action>
+            <action type="fix" fixes-bug="65551" context="XSLF">Incorrect fetching paragraph and text runs props from master shape</action>
         </actions>
     </release>
 

Modified: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/model/CharacterPropertyFetcher.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/model/CharacterPropertyFetcher.java?rev=1894140&r1=1894139&r2=1894140&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/model/CharacterPropertyFetcher.java (original)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/model/CharacterPropertyFetcher.java Mon Oct 11 19:44:47 2021
@@ -62,9 +62,9 @@ public final class CharacterPropertyFetc
     public T fetchProperty(XSLFShape shape) {
         final XSLFSheet sheet = shape.getSheet();
 
+        fetchRunProp();
 
         if (!(sheet instanceof XSLFSlideMaster)) {
-            fetchRunProp();
             fetchParagraphDefaultRunProp();
             fetchShapeProp(shape);
             fetchThemeProp(shape);

Modified: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/model/ParagraphPropertyFetcher.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/model/ParagraphPropertyFetcher.java?rev=1894140&r1=1894139&r2=1894140&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/model/ParagraphPropertyFetcher.java (original)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/model/ParagraphPropertyFetcher.java Mon Oct 11 19:44:47 2021
@@ -72,8 +72,9 @@ public final class ParagraphPropertyFetc
     public T fetchProperty(XSLFShape shape) {
         final XSLFSheet sheet = shape.getSheet();
 
+        fetchParagraphProp();
+
         if (!(sheet instanceof XSLFSlideMaster)) {
-            fetchParagraphProp();
             fetchShapeProp(shape);
             fetchThemeProp(shape);
         }

Modified: poi/trunk/poi-ooxml/src/test/java/org/apache/poi/xslf/TestXSLFBugs.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/test/java/org/apache/poi/xslf/TestXSLFBugs.java?rev=1894140&r1=1894139&r2=1894140&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/test/java/org/apache/poi/xslf/TestXSLFBugs.java (original)
+++ poi/trunk/poi-ooxml/src/test/java/org/apache/poi/xslf/TestXSLFBugs.java Mon Oct 11 19:44:47 2021
@@ -71,6 +71,7 @@ import org.apache.poi.sl.usermodel.Shape
 import org.apache.poi.sl.usermodel.Slide;
 import org.apache.poi.sl.usermodel.SlideShow;
 import org.apache.poi.sl.usermodel.SlideShowFactory;
+import org.apache.poi.sl.usermodel.TextParagraph;
 import org.apache.poi.sl.usermodel.TextRun;
 import org.apache.poi.sl.usermodel.TextShape;
 import org.apache.poi.sl.usermodel.VerticalAlignment;
@@ -1063,4 +1064,18 @@ class TestXSLFBugs {
             targetPresentation.write(new UnsynchronizedByteArrayOutputStream());
         }
     }
+
+    @Test
+    public void bug65551() throws IOException {
+        try (XMLSlideShow ppt = openSampleDocument("bug65551.pptx")) {
+            XSLFTextShape shape = (XSLFTextShape)ppt.getSlideMasters().get(0).getShapes().get(1);
+            XSLFTextParagraph tp = shape.getTextParagraphs().get(0);
+            assertEquals(TextParagraph.TextAlign.RIGHT, tp.getTextAlign());
+            XSLFTextRun tr = tp.getTextRuns().get(0);
+            PaintStyle fc = tr.getFontColor();
+            assertTrue(fc instanceof SolidPaint);
+            SolidPaint sp = (SolidPaint)fc;
+            assertEquals(Color.RED, sp.getSolidColor().getColor());
+        }
+    }
 }

Added: poi/trunk/test-data/slideshow/bug65551.pptx
URL: http://svn.apache.org/viewvc/poi/trunk/test-data/slideshow/bug65551.pptx?rev=1894140&view=auto
==============================================================================
Binary file - no diff available.

Propchange: poi/trunk/test-data/slideshow/bug65551.pptx
------------------------------------------------------------------------------
--- svn:mime-type (added)
+++ svn:mime-type Mon Oct 11 19:44:47 2021
@@ -0,0 +1 @@
+application/vnd.openxmlformats-officedocument.presentationml.presentation



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org