poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kiwiwi...@apache.org
Subject svn commit: r1711845 - in /poi/trunk: src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java test-data/slideshow/bug45088.ppt
Date Sun, 01 Nov 2015 19:37:24 GMT
Author: kiwiwings
Date: Sun Nov  1 19:37:24 2015
New Revision: 1711845

URL: http://svn.apache.org/viewvc?rev=1711845&view=rev
Log:
#45088 - POI-HSLF changeTextInRichTextRun corrupts presentation

Added:
    poi/trunk/test-data/slideshow/bug45088.ppt   (with props)
Modified:
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java?rev=1711845&r1=1711844&r2=1711845&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java Sun Nov
 1 19:37:24 2015
@@ -689,4 +689,34 @@ public final class TestBugs {
         
         ppt2.close();
     }
+    
+    @Test
+    public void bug45088() throws IOException {
+        String template = "[SYSDATE]";
+        String textExp = "REPLACED_DATE_WITH_A_LONG_ONE";
+        
+        HSLFSlideShow ppt1 = (HSLFSlideShow)SlideShowFactory.create(_slTests.getFile("bug45088.ppt"));
+        for (HSLFSlide slide : ppt1.getSlides()) {
+            for (List<HSLFTextParagraph> paraList : slide.getTextParagraphs()) {
+                for (HSLFTextParagraph para : paraList) {
+                    for (HSLFTextRun run : para.getTextRuns()) {
+                        String text = run.getRawText();
+                        if (text != null && text.contains(template)) {
+                            String replacedText = text.replace(template, textExp);
+                            run.setText(replacedText);
+                            para.setDirty();
+                        }
+                    }
+                }
+            }
+        }
+
+        HSLFSlideShow ppt2 = HSLFTestDataSamples.writeOutAndReadBack(ppt1);
+        ppt1.close();
+        
+        HSLFTextBox tb = (HSLFTextBox)ppt2.getSlides().get(0).getShapes().get(1);
+        String textAct = tb.getTextParagraphs().get(0).getTextRuns().get(0).getRawText().trim();
+        assertEquals(textExp, textAct);
+        ppt2.close();
+    }
 }

Added: poi/trunk/test-data/slideshow/bug45088.ppt
URL: http://svn.apache.org/viewvc/poi/trunk/test-data/slideshow/bug45088.ppt?rev=1711845&view=auto
==============================================================================
Binary file - no diff available.

Propchange: poi/trunk/test-data/slideshow/bug45088.ppt
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message