]> source.dussan.org Git - poi.git/commitdiff
Regression tests: Add test which triggers reading header/footer of PPTX files so...
authorDominik Stadler <centic@apache.org>
Thu, 5 Jul 2018 19:54:24 +0000 (19:54 +0000)
committerDominik Stadler <centic@apache.org>
Thu, 5 Jul 2018 19:54:24 +0000 (19:54 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1835184 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/testcases/org/apache/poi/xslf/extractor/TestXSLFPowerPointExtractor.java
test-data/slideshow/aascu.org_hbcu_leadershipsummit_cooper_.pptx [new file with mode: 0755]

index be712a00459114297ec5505c5d50fe9b6f6dc334..e63762d2909b081b06fdfd8511d315b81719e4e2 100644 (file)
@@ -33,6 +33,8 @@ import org.apache.poi.ooxml.extractor.ExtractorFactory;
 import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
 import org.apache.poi.sl.extractor.SlideShowExtractor;
 import org.apache.poi.xslf.usermodel.XMLSlideShow;
+import org.apache.poi.xslf.usermodel.XSLFShape;
+import org.apache.poi.xslf.usermodel.XSLFTextParagraph;
 import org.apache.xmlbeans.XmlException;
 import org.junit.Test;
 
@@ -48,7 +50,7 @@ public class TestXSLFPowerPointExtractor {
     @Test
     public void testGetSimpleText() throws IOException {
         try (XMLSlideShow xmlA = openPPTX("sample.pptx");
-             SlideShowExtractor extractor = new SlideShowExtractor(xmlA)) {
+             SlideShowExtractor<XSLFShape, XSLFTextParagraph> extractor = new SlideShowExtractor<>(xmlA)) {
 
             extractor.getText();
 
@@ -160,7 +162,7 @@ public class TestXSLFPowerPointExtractor {
     @Test
     public void testGetComments() throws IOException {
         try (XMLSlideShow xml = openPPTX("45545_Comment.pptx");
-            SlideShowExtractor extractor = new SlideShowExtractor(xml)) {
+             SlideShowExtractor<XSLFShape, XSLFTextParagraph> extractor = new SlideShowExtractor<>(xml)) {
             extractor.setCommentsByDefault(true);
 
             String text = extractor.getText();
@@ -178,7 +180,7 @@ public class TestXSLFPowerPointExtractor {
     @Test
        public void testGetMasterText() throws Exception {
            try (XMLSlideShow xml = openPPTX("WithMaster.pptx");
-            SlideShowExtractor extractor = new SlideShowExtractor(xml)) {
+             SlideShowExtractor<XSLFShape, XSLFTextParagraph> extractor = new SlideShowExtractor<>(xml)) {
             extractor.setSlidesByDefault(true);
             extractor.setNotesByDefault(false);
             extractor.setMasterByDefault(true);
@@ -215,7 +217,7 @@ public class TestXSLFPowerPointExtractor {
        @Test
        public void testTable() throws Exception {
         try (XMLSlideShow xml = openPPTX("present1.pptx");
-            SlideShowExtractor extractor = new SlideShowExtractor(xml)) {
+             SlideShowExtractor<XSLFShape, XSLFTextParagraph> extractor = new SlideShowExtractor<>(xml)) {
 
             String text = extractor.getText();
             assertTrue(text.length() > 0);
@@ -240,7 +242,7 @@ public class TestXSLFPowerPointExtractor {
             String filename = "testPPT." + extension;
 
             try (XMLSlideShow xml = openPPTX(filename);
-                SlideShowExtractor extractor = new SlideShowExtractor(xml)) {
+                 SlideShowExtractor<XSLFShape, XSLFTextParagraph> extractor = new SlideShowExtractor<>(xml)) {
 
                 String text = extractor.getText();
                 if (extension.equals("thmx")) {
@@ -299,7 +301,7 @@ public class TestXSLFPowerPointExtractor {
     @Test
     public void bug54570() throws IOException {
         try (XMLSlideShow xml = openPPTX("bug54570.pptx");
-            SlideShowExtractor extractor = new SlideShowExtractor(xml)) {
+             SlideShowExtractor<XSLFShape, XSLFTextParagraph> extractor = new SlideShowExtractor<>(xml)) {
             String text = extractor.getText();
             assertNotNull(text);
         }
@@ -310,4 +312,17 @@ public class TestXSLFPowerPointExtractor {
             return new XMLSlideShow(is);
         }
     }
+
+    @Test
+    public void setSlTests() throws IOException {
+        try (XMLSlideShow xml = openPPTX("aascu.org_hbcu_leadershipsummit_cooper_.pptx")) {
+            SlideShowExtractor<XSLFShape, XSLFTextParagraph> extractor = new SlideShowExtractor<>(xml);
+            assertNotNull(extractor);
+            extractor.setSlidesByDefault(true);
+            extractor.setNotesByDefault(true);
+            extractor.setMasterByDefault(true);
+
+            assertNotNull(extractor.getText());
+        }
+    }
 }
diff --git a/test-data/slideshow/aascu.org_hbcu_leadershipsummit_cooper_.pptx b/test-data/slideshow/aascu.org_hbcu_leadershipsummit_cooper_.pptx
new file mode 100755 (executable)
index 0000000..14b71bc
Binary files /dev/null and b/test-data/slideshow/aascu.org_hbcu_leadershipsummit_cooper_.pptx differ