From 3a42bc32471de792187f9423f22228eec65a15b6 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Mon, 15 Aug 2022 13:19:34 +0000 Subject: [PATCH] test that original slide is not modified git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1903438 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/xslf/usermodel/TestXSLFShape.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/poi-ooxml/src/test/java/org/apache/poi/xslf/usermodel/TestXSLFShape.java b/poi-ooxml/src/test/java/org/apache/poi/xslf/usermodel/TestXSLFShape.java index a88063e7f0..5e479e83c7 100644 --- a/poi-ooxml/src/test/java/org/apache/poi/xslf/usermodel/TestXSLFShape.java +++ b/poi-ooxml/src/test/java/org/apache/poi/xslf/usermodel/TestXSLFShape.java @@ -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 textBoxParagraphs = textShape.getTextParagraphs(); + List 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++; + } + } } } -- 2.39.5