From 49fb78cc39752ce094869b5d27e1708cbf6adb0c Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Tue, 28 Nov 2006 15:34:20 +0000 Subject: [PATCH] Fix for bug 41015 - add in another paragraph property git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@480093 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/hslf/record/StyleTextPropAtom.java | 3 +- .../org/apache/poi/hslf/data/bug-41015.ppt | Bin 0 -> 12800 bytes .../apache/poi/hslf/model/TestTextRun.java | 32 ++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 src/scratchpad/testcases/org/apache/poi/hslf/data/bug-41015.ppt diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/StyleTextPropAtom.java b/src/scratchpad/src/org/apache/poi/hslf/record/StyleTextPropAtom.java index 3e99ccbf48..209a747671 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/record/StyleTextPropAtom.java +++ b/src/scratchpad/src/org/apache/poi/hslf/record/StyleTextPropAtom.java @@ -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 index 0000000000000000000000000000000000000000..b804a602102c0beffc7805484021a3e1aafb1bbb GIT binary patch literal 12800 zcmeHN3vg7`8UF9R8?r#cU9ySdqi{v4SRqE@Fm$xAYM>8v$QbNsYim-n8+KfFGrNmG zw7S-*wWuvlC=%@;_!uLtEv-<5s-yRpW?OXLQCY5){*fu3-mqO z!MySe%M(vlHLz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%SH$EQyVRbcze`Y$Ui1$`a9KG z-;>9|D9U*nfciSa{brr(@%3mr!}mN-mz>A(L#JK#3Fxc^T)g?l*B*mT$H}|=9omZn z-~5PuuDa=T34iU}rS3c#{7t3}e~rPD;Ab+m$K;S-|0!5G|N2*{^?zC}jCQ2b&iqtY eB6TTO|3a*Ihx%=|BlA&q;V*J2x%4x={{IE!7TPrc literal 0 HcmV?d00001 diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRun.java b/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRun.java index c35a6a0c6a..7fddde6228 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRun.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRun.java @@ -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()); + } } -- 2.39.5