]> source.dussan.org Git - poi.git/commitdiff
Add disabled unit test for bug #54916
authorNick Burch <nick@apache.org>
Wed, 26 Jun 2013 00:45:18 +0000 (00:45 +0000)
committerNick Burch <nick@apache.org>
Wed, 26 Jun 2013 00:45:18 +0000 (00:45 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1496696 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/testcases/org/apache/poi/xslf/TestXSLFBugs.java
test-data/slideshow/OverlappingRelations.pptx [new file with mode: 0644]

index e971aee47f09a3ce8fc556bb8cc714040b8d2577..8c1600fff8a49a34a30159bed86ce62d87c88c8d 100644 (file)
 ==================================================================== */
 package org.apache.poi.xslf;
 
-import junit.framework.TestCase;
+import java.net.URI;
+import java.util.List;
+
+import org.apache.poi.POITestCase;
 import org.apache.poi.POIXMLDocumentPart;
 import org.apache.poi.openxml4j.opc.PackagePart;
+import org.apache.poi.xslf.usermodel.DrawingParagraph;
+import org.apache.poi.xslf.usermodel.DrawingTextBody;
 import org.apache.poi.xslf.usermodel.XMLSlideShow;
 import org.apache.poi.xslf.usermodel.XSLFRelation;
 import org.apache.poi.xslf.usermodel.XSLFSlide;
 import org.apache.poi.xslf.usermodel.XSLFSlideLayout;
 
-import java.net.URI;
-import java.util.List;
-
-public class TestXSLFBugs extends TestCase {
+public class TestXSLFBugs extends POITestCase {
 
     @SuppressWarnings("deprecation")
     public void test51187() throws Exception {
@@ -106,4 +108,42 @@ public class TestXSLFBugs extends TestCase {
           }
        }
     }
+    
+    /**
+     * A slideshow can have more than one rID pointing to a given 
+     *  slide, eg presentation.xml rID1 -> slide1.xml, but slide1.xml 
+     *  rID2 -> slide3.xml
+     */
+    public void DISABLEDtest54916() throws Exception {
+        XMLSlideShow ss = XSLFTestDataSamples.openSampleDocument("OverlappingRelations.pptx");
+        XSLFSlide slide; 
+        
+        // Should find 4 slides
+        assertEquals(4, ss.getSlides().length);
+        
+        // Check the text, to see we got them in order
+        slide = ss.getSlides()[0];
+        assertContains("POI cannot read this", getSlideText(slide));
+        
+        slide = ss.getSlides()[1];
+        assertContains("POI can read this", getSlideText(slide));
+        assertContains("Has a relationship to another slide", getSlideText(slide));
+        
+        slide = ss.getSlides()[2];
+        assertContains("POI can read this", getSlideText(slide));
+        
+        slide = ss.getSlides()[3];
+        assertContains("POI can read this", getSlideText(slide));
+    }
+    
+    protected String getSlideText(XSLFSlide slide) {
+        StringBuffer text = new StringBuffer();
+        for(DrawingTextBody textBody : slide.getCommonSlideData().getDrawingText()) {
+            for (DrawingParagraph p : textBody.getParagraphs()) {
+                text.append(p.getText());
+                text.append("\n");
+            }
+        }
+        return text.toString();
+    }
 }
diff --git a/test-data/slideshow/OverlappingRelations.pptx b/test-data/slideshow/OverlappingRelations.pptx
new file mode 100644 (file)
index 0000000..7551630
Binary files /dev/null and b/test-data/slideshow/OverlappingRelations.pptx differ