]> source.dussan.org Git - poi.git/commitdiff
Fix for bug 41015 - add in another paragraph property
authorNick Burch <nick@apache.org>
Tue, 28 Nov 2006 15:34:20 +0000 (15:34 +0000)
committerNick Burch <nick@apache.org>
Tue, 28 Nov 2006 15:34:20 +0000 (15:34 +0000)
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@480093 13f79535-47bb-0310-9956-ffa450edef68

src/scratchpad/src/org/apache/poi/hslf/record/StyleTextPropAtom.java
src/scratchpad/testcases/org/apache/poi/hslf/data/bug-41015.ppt [new file with mode: 0644]
src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRun.java

index 3e99ccbf48db6f1e0a846ae04f386206e0a2246c..209a74767145ca4a59f1eb4e7768e1df5fb1ba76 100644 (file)
@@ -102,7 +102,8 @@ public class StyleTextPropAtom extends RecordAtom
                                new TextProp(2, 0x4000, "spaceafter"),
                                new TextProp(2, 0x8000, "para_unknown_4"),
                                new TextProp(2, 0x10000, "para_unknown_5"),
-                               new TextProp(2, 0xA0000, "para_unknown_6")
+                               new TextProp(2, 0xA0000, "para_unknown_6"),
+                               new TextProp(2, 0x200000, "para_unknown_7")
        };
        /** All the different kinds of character properties we might handle */
        public static TextProp[] characterTextPropTypes = new TextProp[] {
diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/data/bug-41015.ppt b/src/scratchpad/testcases/org/apache/poi/hslf/data/bug-41015.ppt
new file mode 100644 (file)
index 0000000..b804a60
Binary files /dev/null and b/src/scratchpad/testcases/org/apache/poi/hslf/data/bug-41015.ppt differ
index c35a6a0c6af4f39fd055afebba555e9e02927d3f..7fddde62287359a1fc57913f6cf551f7a12ac501 100644 (file)
@@ -412,4 +412,36 @@ public class TestTextRun extends TestCase {
                assertEquals(tpCC.getTextPropList(), ntpCC.getTextPropList());
                assertEquals(tpDC.getTextPropList(), ntpDC.getTextPropList());
     }
+    
+
+       /**
+        * Test case for Bug 41015.
+        *
+        * In some cases RichTextRun.getText() threw StringIndexOutOfBoundsException because
+        * of the wrong list of potential paragraph properties defined in StyleTextPropAtom.
+        *
+        */
+       public void testBug41015() throws Exception {
+               RichTextRun[] rt;
+               
+               SlideShow ppt = new SlideShow(new HSLFSlideShow(System.getProperty("HSLF.testdata.path") + "/bug-41015.ppt"));
+               Slide sl = ppt.getSlides()[0];
+               TextRun[] txt = sl.getTextRuns();
+               assertEquals(2, txt.length);
+               
+               rt = txt[0].getRichTextRuns();
+               assertEquals(1, rt.length);
+               assertEquals(0, rt[0].getIndentLevel());
+               assertEquals("sdfsdfsdf", rt[0].getText());
+               
+               rt = txt[1].getRichTextRuns();
+               assertEquals(2, rt.length);
+               assertEquals(0, rt[0].getIndentLevel());
+               assertEquals("Sdfsdfsdf\n" +
+                       "Dfgdfg\n" +
+                       "Dfgdfgdfg\n", rt[0].getText());
+               assertEquals(1, rt[1].getIndentLevel());
+               assertEquals("Sdfsdfs\n" +
+                       "Sdfsdf\n", rt[1].getText());
+       }
 }