diff options
author | Yegor Kozlov <yegor@apache.org> | 2012-02-22 13:23:31 +0000 |
---|---|---|
committer | Yegor Kozlov <yegor@apache.org> | 2012-02-22 13:23:31 +0000 |
commit | e94b5e52f1969378e5b55659c2ebc15a047f6457 (patch) | |
tree | fdc976b404ae050a47c327c080957e5904bea754 /src | |
parent | 299fbffd753b8fbbb30da0dea1cfa2abf6eb6bf9 (diff) | |
download | poi-e94b5e52f1969378e5b55659c2ebc15a047f6457.tar.gz poi-e94b5e52f1969378e5b55659c2ebc15a047f6457.zip |
Bugzilla 52599 - avoid duplicate text when rendering slides in HSLF
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1292273 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
4 files changed, 24 insertions, 2 deletions
diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index 99cb798d00..d2367da522 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -34,6 +34,7 @@ <changes> <release version="3.8-beta6" date="2012-??-??"> + <action dev="poi-developers" type="fix">52599 - avoid duplicate text when rendering slides in HSLF</action> <action dev="poi-developers" type="fix">52598 - respect slide background when rendering slides in HSLF</action> <action dev="poi-developers" type="fix">51731 - fixed painting shape outlines in HSLF</action> <action dev="poi-developers" type="fix">52701 - fixed seting vertical alignment for XSLFTableCell</action> diff --git a/src/scratchpad/src/org/apache/poi/hslf/model/Slide.java b/src/scratchpad/src/org/apache/poi/hslf/model/Slide.java index 7822d8cd11..0decdaa448 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/model/Slide.java +++ b/src/scratchpad/src/org/apache/poi/hslf/model/Slide.java @@ -91,6 +91,7 @@ public final class Slide extends Sheet for(int k=0; k<_otherRuns.length; i++, k++) { _runs[i] = _otherRuns[k]; _runs[i].setSheet(this); + _runs[i].setIndex(-1); // runs found in PPDrawing are not linked with SlideListWithTexts } } diff --git a/src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java b/src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java index 65c4459d17..5eb3930638 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java +++ b/src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java @@ -48,7 +48,7 @@ public final class TextRun private SlideShow slideShow; private Sheet _sheet; private int shapeId; - private int slwtIndex; //position in the owning SlideListWithText + private int slwtIndex = -1; //position in the owning SlideListWithText /** * all text run records that follow TextHeaderAtom. * (there can be misc InteractiveInfo, TxInteractiveInfo and other records) diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextShape.java b/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextShape.java index 7285f5120a..48b6df54a6 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextShape.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextShape.java @@ -47,7 +47,7 @@ public final class TestTextShape extends TestCase { assertNotNull(shape.getEscherTextboxWrapper()); assertEquals("", shape.getText()); assertSame(run, shape.createTextRun()); - + assertEquals(-1, run.getIndex()); } public void testCreateTextBox(){ @@ -195,4 +195,24 @@ public final class TestTextShape extends TestCase { assertEquals(0.05, tx.getMarginTop()*Shape.EMU_PER_POINT/Shape.EMU_PER_INCH, 0.01); assertEquals(0.05, tx.getMarginBottom()*Shape.EMU_PER_POINT/Shape.EMU_PER_INCH, 0.01); } + + public void test52599() throws IOException { + SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("52599.ppt")); + + Slide slide = ppt.getSlides()[0]; + Shape[] sh = slide.getShapes(); + assertEquals(3, sh.length); + + TextShape sh0 = (TextShape)sh[0]; + assertEquals(null, sh0.getText()); + assertEquals(null, sh0.getTextRun()); + + TextShape sh1 = (TextShape)sh[1]; + assertEquals(null, sh1.getText()); + assertEquals(null, sh1.getTextRun()); + + TextShape sh2 = (TextShape)sh[2]; + assertEquals("this box should be shown just once", sh2.getText()); + assertEquals(-1, sh2.getTextRun().getIndex()); + } } |