joonda commented on code in PR #994:
URL: https://github.com/apache/poi/pull/994#discussion_r2686312340
##########
poi-ooxml/src/test/java/org/apache/poi/xslf/usermodel/TestXSLFTextShape.java:
##########
@@ -982,4 +984,36 @@ void metroBlob() throws IOException,
ReflectiveOperationException {
assertEquals(textExp, textAct);
}
}
+
+ @Test
+ void testClearTextMaintainOneParagraph() throws IOException {
+ try (XMLSlideShow ppt = new XMLSlideShow()) {
+ XSLFSlide slide = ppt.createSlide();
+ XSLFAutoShape shape = slide.createAutoShape();
+
+ XSLFTextParagraph p = shape.addNewTextParagraph();
+ p.addNewTextRun().setText("This text will be cleared");
+
+ shape.clearText();
+
+ assertEquals(1, shape.getTextParagraphs().size(),
+ "After clearText(), there should be exactly one empty paragraph
for OOXML compliance.");
+
+ try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
Review Comment:
i've updated the test to use `UnsynchronizedByteArrayOutputStream`.
Thank you for the review!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]