View | Details | Raw Unified | Return to bug 63200
Collapse All | Expand All

(-)a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShape.java (-14 / +5 lines)
Lines 24-29 import java.awt.geom.Rectangle2D; Link Here
24
import java.io.IOException;
24
import java.io.IOException;
25
import java.io.InputStream;
25
import java.io.InputStream;
26
import java.util.Arrays;
26
import java.util.Arrays;
27
import java.util.Optional;
27
28
28
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
29
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
29
import org.apache.poi.openxml4j.opc.PackagePart;
30
import org.apache.poi.openxml4j.opc.PackagePart;
Lines 46-64 import org.apache.poi.xslf.model.PropertyFetcher; Link Here
46
import org.apache.poi.xslf.usermodel.XSLFPropertiesDelegate.XSLFFillProperties;
47
import org.apache.poi.xslf.usermodel.XSLFPropertiesDelegate.XSLFFillProperties;
47
import org.apache.xmlbeans.XmlCursor;
48
import org.apache.xmlbeans.XmlCursor;
48
import org.apache.xmlbeans.XmlObject;
49
import org.apache.xmlbeans.XmlObject;
49
import org.openxmlformats.schemas.drawingml.x2006.main.CTBlip;
50
import org.openxmlformats.schemas.drawingml.x2006.main.*;
50
import org.openxmlformats.schemas.drawingml.x2006.main.CTBlipFillProperties;
51
import org.openxmlformats.schemas.drawingml.x2006.main.CTGradientFillProperties;
52
import org.openxmlformats.schemas.drawingml.x2006.main.CTGradientStop;
53
import org.openxmlformats.schemas.drawingml.x2006.main.CTGroupShapeProperties;
54
import org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualDrawingProps;
55
import org.openxmlformats.schemas.drawingml.x2006.main.CTSchemeColor;
56
import org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties;
57
import org.openxmlformats.schemas.drawingml.x2006.main.CTShapeStyle;
58
import org.openxmlformats.schemas.drawingml.x2006.main.CTSolidColorFillProperties;
59
import org.openxmlformats.schemas.drawingml.x2006.main.CTStyleMatrix;
60
import org.openxmlformats.schemas.drawingml.x2006.main.CTStyleMatrixReference;
61
import org.openxmlformats.schemas.drawingml.x2006.main.STPathShadeType;
62
import org.openxmlformats.schemas.presentationml.x2006.main.CTBackgroundProperties;
51
import org.openxmlformats.schemas.presentationml.x2006.main.CTBackgroundProperties;
63
import org.openxmlformats.schemas.presentationml.x2006.main.CTPlaceholder;
52
import org.openxmlformats.schemas.presentationml.x2006.main.CTPlaceholder;
64
import org.openxmlformats.schemas.presentationml.x2006.main.CTShape;
53
import org.openxmlformats.schemas.presentationml.x2006.main.CTShape;
Lines 431-437 public abstract class XSLFShape implements Shape<XSLFShape,XSLFTextParagraph> { Link Here
431
    protected static PaintStyle selectPaint(final CTGradientFillProperties gradFill, CTSchemeColor phClr, final XSLFTheme theme) {
420
    protected static PaintStyle selectPaint(final CTGradientFillProperties gradFill, CTSchemeColor phClr, final XSLFTheme theme) {
432
421
433
        @SuppressWarnings("deprecation")
422
        @SuppressWarnings("deprecation")
434
        final CTGradientStop[] gs = gradFill.getGsLst().getGsArray();
423
        final CTGradientStop[] gs = Optional.ofNullable(gradFill.getGsLst())
424
            .map(CTGradientStopList::getGsArray)
425
            .orElse(new CTGradientStop[0]);
435
426
436
        Arrays.sort(gs, (o1, o2) -> {
427
        Arrays.sort(gs, (o1, o2) -> {
437
            int pos1 = o1.getPos();
428
            int pos1 = o1.getPos();
(-)a/src/ooxml/testcases/org/apache/poi/xslf/TestXSLFBugs.java (-18 / +18 lines)
Lines 61-84 import org.apache.poi.sl.usermodel.ShapeType; Link Here
61
import org.apache.poi.sl.usermodel.Slide;
61
import org.apache.poi.sl.usermodel.Slide;
62
import org.apache.poi.sl.usermodel.VerticalAlignment;
62
import org.apache.poi.sl.usermodel.VerticalAlignment;
63
import org.apache.poi.util.IOUtils;
63
import org.apache.poi.util.IOUtils;
64
import org.apache.poi.xslf.usermodel.XMLSlideShow;
64
import org.apache.poi.xslf.usermodel.*;
65
import org.apache.poi.xslf.usermodel.XSLFAutoShape;
66
import org.apache.poi.xslf.usermodel.XSLFGroupShape;
67
import org.apache.poi.xslf.usermodel.XSLFHyperlink;
68
import org.apache.poi.xslf.usermodel.XSLFNotes;
69
import org.apache.poi.xslf.usermodel.XSLFPictureData;
70
import org.apache.poi.xslf.usermodel.XSLFPictureShape;
71
import org.apache.poi.xslf.usermodel.XSLFRelation;
72
import org.apache.poi.xslf.usermodel.XSLFShape;
73
import org.apache.poi.xslf.usermodel.XSLFSlide;
74
import org.apache.poi.xslf.usermodel.XSLFSlideLayout;
75
import org.apache.poi.xslf.usermodel.XSLFSlideMaster;
76
import org.apache.poi.xslf.usermodel.XSLFTable;
77
import org.apache.poi.xslf.usermodel.XSLFTableCell;
78
import org.apache.poi.xslf.usermodel.XSLFTableRow;
79
import org.apache.poi.xslf.usermodel.XSLFTextBox;
80
import org.apache.poi.xslf.usermodel.XSLFTextParagraph;
81
import org.apache.poi.xslf.usermodel.XSLFTextRun;
82
import org.junit.Ignore;
65
import org.junit.Ignore;
83
import org.junit.Test;
66
import org.junit.Test;
84
import org.openxmlformats.schemas.drawingml.x2006.main.CTOuterShadowEffect;
67
import org.openxmlformats.schemas.drawingml.x2006.main.CTOuterShadowEffect;
Lines 88-93 import org.openxmlformats.schemas.presentationml.x2006.main.CTShape; Link Here
88
public class TestXSLFBugs {
71
public class TestXSLFBugs {
89
    private static final POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
72
    private static final POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
90
73
74
    @Test
75
    public void bug63200() throws Exception {
76
        try(XMLSlideShow ss1 = XSLFTestDataSamples.openSampleDocument("gradient-fill-in-group.pptx")) {
77
            assertEquals(1, ss1.getSlides().size());
78
79
            XSLFSlide slide = ss1.getSlides().get(0);
80
81
            assertEquals(slide.getShapes().size(), 1);
82
            XSLFGroupShape group = (XSLFGroupShape)slide.getShapes().get(0);
83
            assertEquals(group.getShapes().size(), 2);
84
            XSLFAutoShape oval = (XSLFAutoShape)group.getShapes().get(0);
85
            XSLFAutoShape arrow = (XSLFAutoShape)group.getShapes().get(1);
86
            assertEquals(oval.getFillColor(), null);
87
            assertEquals(arrow.getFillColor(), null);
88
        }
89
    }
90
91
    @Test
91
    @Test
92
    public void bug62929() throws Exception {
92
    public void bug62929() throws Exception {
93
        try(XMLSlideShow ss1 = XSLFTestDataSamples.openSampleDocument("missing-blip-fill.pptx")) {
93
        try(XMLSlideShow ss1 = XSLFTestDataSamples.openSampleDocument("missing-blip-fill.pptx")) {

Return to bug 63200