#65551 - Incorrect fetching paragraph and text runs props from master shape

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1894140 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andreas Beeker 2021-10-11 19:44:47 +00:00
parent 6aa3871e64
commit db71e2328a
4 changed files with 18 additions and 2 deletions

View File

@ -62,9 +62,9 @@ public final class CharacterPropertyFetcher<T> extends PropertyFetcher<T> {
public T fetchProperty(XSLFShape shape) {
final XSLFSheet sheet = shape.getSheet();
fetchRunProp();
if (!(sheet instanceof XSLFSlideMaster)) {
fetchRunProp();
fetchParagraphDefaultRunProp();
fetchShapeProp(shape);
fetchThemeProp(shape);

View File

@ -72,8 +72,9 @@ public final class ParagraphPropertyFetcher<T> extends PropertyFetcher<T> {
public T fetchProperty(XSLFShape shape) {
final XSLFSheet sheet = shape.getSheet();
fetchParagraphProp();
if (!(sheet instanceof XSLFSlideMaster)) {
fetchParagraphProp();
fetchShapeProp(shape);
fetchThemeProp(shape);
}

View File

@ -71,6 +71,7 @@ import org.apache.poi.sl.usermodel.ShapeType;
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());
}
}
}

Binary file not shown.