https://issues.apache.org/bugzilla/show_bug.cgi?id=57250

            Bug ID: 57250
           Summary: XMLSlideShow.setSlideOrder() produces corrupted
                    CTSlideIdList
           Product: POI
           Version: 3.11-dev
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSLF
          Assignee: [email protected]
          Reporter: [email protected]

I guess the bug was introduced by commit 1620997 (Bug 56854 - XMLBeans
performance when using getXXXList() and other proxy methods).

Tested with version 3.11-beta3.

The setSlideOrder() method removes old slide at wrong position:

after insert:
<xml-fragment xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main";
xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships";
xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main";>
  <p:sldId id="257" r:id="rId7"/>
  <p:sldId id="256" r:id="rId2"/>
  <p:sldId id="257" r:id="rId7"/>
</xml-fragment>

after remove:
<xml-fragment xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main";
xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships";
xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main";>
  <p:sldId id="257" r:id="rId7"/>
  <p:sldId id="257" r:id="rId7"/>
</xml-fragment>

Finally the presentation refers to the same slide twice and the old slide is
not more reachable.

The following unit test fails (create a slide show insert-infront.pptx with a
single slide containing text "Test me"):

    @Test
    public void testInsertInfront() throws Exception {
       XMLSlideShow ss =
XSLFTestDataSamples.openSampleDocument("insert-infront.pptx");
       XSLFSlide slide;

       assertEquals(1, ss.getSlides().length);

       slide = ss.getSlides()[0];
       assertContains(getSlideText(slide), "Test me");

       slide = ss.createSlide();
       ss.setSlideOrder(slide, 0);
       slide.createTextBox().setText("New slide");

       // Save and re-load
       ss = XSLFTestDataSamples.writeOutAndReadBack(ss);

       assertEquals(2, ss.getSlides().length);

       slide = ss.getSlides()[0];
       assertContains(getSlideText(slide), "New slide");

       slide = ss.getSlides()[1];
       assertContains(getSlideText(slide), "Test me");
    }

-- 
You are receiving this mail because:
You are the assignee for the bug.

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

Reply via email to