Bug 51085

Summary: Creation of slidemaster background results in a red cross
Product: POI Reporter: tobias.meissner
Component: HSLFAssignee: POI Developers List <dev>
Status: RESOLVED WORKSFORME    
Severity: normal    
Priority: P2    
Version: 3.7-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description tobias.meissner 2011-04-19 08:00:19 UTC
When using the following lines of code (worked in version 3.0.2 ), the powerpoint slide is created, but instead of a proper background a red cross appears.

The used layoutfile is an existing PNG file, which definitely worked in older versions.

            SlideShow ppt = new SlideShow()
            SlideMaster master = ppt.getSlidesMasters()[0];
            Fill fill = master.getBackground().getFill();
            int idx = ppt.addPicture(layoutFile, Picture.PNG);
            fill.setFillType(Fill.FILL_PICTURE);
            fill.setPictureData(idx);
...
Comment 1 Andreas Beeker 2016-01-16 18:07:09 UTC
This is not happening anymore - if unsure, please add your <layoutFile>.png.

This was my testcode:

@Test
public void bug51085() throws IOException {
    File sample = HSLFTestDataSamples.getSampleFile("tomcat.png");
    HSLFSlideShow ppt = new HSLFSlideShow();
    HSLFSlideMaster sm = ppt.getSlideMasters().get(0);
    HSLFFill fill = sm.getBackground().getFill();
    HSLFPictureData pd = ppt.addPicture(sample, PictureData.PictureType.PNG);
    fill.setFillType(HSLFFill.FILL_PICTURE);
    fill.setPictureData(pd);
    FileOutputStream fos = new FileOutputStream("bla.ppt");
    ppt.createSlide();
    ppt.write(fos);
    fos.close();
}
Comment 2 Javen O'Neal 2016-01-16 21:26:42 UTC
What revision was the test case from comment 1 added to the test suite?
Comment 3 Andreas Beeker 2016-01-16 22:56:16 UTC
(In reply to Javen O'Neal from comment #2)
> What revision was the test case from comment 1 added to the test suite?

I haven't added the test case, as this was a visual test only.
I usually only add testcases, when I've changed something on the code for it.