]> source.dussan.org Git - poi.git/commitdiff
test that original slide is not modified
authorPJ Fanning <fanningpj@apache.org>
Mon, 15 Aug 2022 13:19:34 +0000 (13:19 +0000)
committerPJ Fanning <fanningpj@apache.org>
Mon, 15 Aug 2022 13:19:34 +0000 (13:19 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1903438 13f79535-47bb-0310-9956-ffa450edef68

poi-ooxml/src/test/java/org/apache/poi/xslf/usermodel/TestXSLFShape.java

index a88063e7f075fbd403cbbc0688b6f238fb4c64ef..5e479e83c7dd7e44cf31d9b924a5ab22eec1f286 100644 (file)
@@ -220,6 +220,23 @@ class TestXSLFShape {
                         }
                     }
                 }
+                XSLFSlide ppt2Slide0 = ppt2.getSlides().get(0);
+                int shapeNumber = 0;
+                for (XSLFShape shape : ppt2Slide0.getShapes()) {
+                    if (shape instanceof XSLFTextShape) {
+                        XSLFTextShape textShape = (XSLFTextShape) shape;
+                        List<XSLFTextParagraph> textBoxParagraphs = textShape.getTextParagraphs();
+                        List<XSLFTextRun> textBoxParagraphTextRuns = textBoxParagraphs.stream()
+                                .map(XSLFTextParagraph::getTextRuns)
+                                .flatMap(List::stream)
+                                .collect(Collectors.toList());
+                        assertEquals(1, textBoxParagraphTextRuns.size());
+                        String expected = shapeNumber == 0 ? "Learning PPTX" : "Cloud";
+                        assertEquals(expected, textBoxParagraphTextRuns.get(0).getRawText());
+                    }
+                    shapeNumber++;
+                }
+
             }
         }
     }