From a0e489bb4d8d27f311cf5be7e75269a8f390ff8b Mon Sep 17 00:00:00 2001 From: Yegor Kozlov Date: Thu, 24 May 2007 11:38:36 +0000 Subject: [PATCH] fixed bug 42485: All TextBoxes inside ShapeGroups have null TextRuns git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@541274 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/poi/hslf/model/ShapeGroup.java | 1 + .../org/apache/poi/hslf/data/42485.ppt | Bin 0 -> 18944 bytes .../apache/poi/hslf/usermodel/TestBugs.java | 30 +++++++++++++++--- 3 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 src/scratchpad/testcases/org/apache/poi/hslf/data/42485.ppt diff --git a/src/scratchpad/src/org/apache/poi/hslf/model/ShapeGroup.java b/src/scratchpad/src/org/apache/poi/hslf/model/ShapeGroup.java index 0b9071dcc0..8519e88af3 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/model/ShapeGroup.java +++ b/src/scratchpad/src/org/apache/poi/hslf/model/ShapeGroup.java @@ -64,6 +64,7 @@ public class ShapeGroup extends Shape{ // Create the Shape for it EscherContainerRecord container = (EscherContainerRecord)r; Shape shape = ShapeFactory.createShape(container, this); + shape.setSheet(getSheet()); shapeList.add( shape ); } else { // Should we do anything special with these non diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/data/42485.ppt b/src/scratchpad/testcases/org/apache/poi/hslf/data/42485.ppt new file mode 100644 index 0000000000000000000000000000000000000000..e9e3dda1e5cc9c6773dff15d7a1fce2c42b18aee GIT binary patch literal 18944 zcmeHP4{%&X8UNmUm*$dOduh|u7O;JkP8+l-G3j7CFy%@@ECq(xrnb}q3C$(BA<1Pf zDQywtz)=yc#wml;KTrgnilf%iQ4y4kh#!>2%ub z6*P~P{~`&z1zJyn@*F?_Pz0dPivdAE37`~E1_%MB0;U1N0P3AEAMFajOh6@I7T`UA z*?>8K;{eA4P5`_YFc&Zn-~vtr7(A?xm5G(W8j0htAG$b8dQc~1J2aAinFWh66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zDC zHX`d8P%xRNg%cs4+S0jli8^!Vd<{LB`7X0w=DGZ{ARUwavgSQcB1Xd#ku8-fnoq(H zWNftRmA#Hd#YmgfnjPH=R~N_%8H=-X@I&Y`FqfWk{K{})X4t$Nr7X?wImp1IhPJGOTTXv|}8e zj9h^GMQv##ek#jvCpr@Q>7oorv%@1De;eiUNsqscaz!To>ilgiY2@#fA1#nq9_}4K zW3aaUv9lz4<)(~}86SDOHYay)Uq z^2AG#!|`ih?oX~rr8zm6{LSnZq?qlo?34Y&CrtAVi}?+U)~J*DO6Kp?UtFf(8#ljd zEGx3Hrv#wSljKbN6U>!>jWS=|H%cwuOw>v}zFx6StW)r1MPoOsXc|ci`-i`jjYX55 zJr)&ppdtb|0~FK(>ag-k^sEFGr>XWtP|*Mi8Ubg4f_gv$?#>1kjp(UY?TMhG859uK zf&xM_R$dP(SbtcxCxVJj$o>LQu>llx06HOo3qi#OP_RL@$3um-#H07R6r|aJ(*g7* zwrR;9i6;8^U7h#*O$GM{<85gA$^rH7B4(oJ;=wOI{dask3(2eaH{2EC|K?7d7a*JH zQ2%cQSI$9wIsU0jT-4`yAHHMFiIhM+{=rcKfBOHk;UX{YLpzZ-3CF=g@Xjt%@|nmJ Xb3;A@^Bj{|9F07u6m-~s^ZNe*^dyZq literal 0 HcmV?d00001 diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java b/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java index e79d05bc54..89f97959d7 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java @@ -19,10 +19,7 @@ package org.apache.poi.hslf.usermodel; import junit.framework.TestCase; import org.apache.poi.hslf.HSLFSlideShow; -import org.apache.poi.hslf.model.Picture; -import org.apache.poi.hslf.model.Slide; -import org.apache.poi.hslf.model.Notes; -import org.apache.poi.hslf.model.TextRun; +import org.apache.poi.hslf.model.*; import java.io.*; import java.util.HashSet; @@ -118,4 +115,29 @@ public class TestBugs extends TestCase { } } } + + /** + * Bug 42485: All TextBoxes inside ShapeGroups have null TextRuns + */ + public void test42485 () throws Exception { + FileInputStream is = new FileInputStream(new File(cwd, "42485.ppt")); + HSLFSlideShow hslf = new HSLFSlideShow(is); + is.close(); + + SlideShow ppt = new SlideShow(hslf); + Shape[] shape = ppt.getSlides()[0].getShapes(); + for (int i = 0; i < shape.length; i++) { + if(shape[i] instanceof ShapeGroup){ + ShapeGroup group = (ShapeGroup)shape[i]; + Shape[] sh = group.getShapes(); + for (int j = 0; j < sh.length; j++) { + if( sh[j] instanceof TextBox){ + TextBox txt = (TextBox)sh[j]; + assertNotNull(txt.getTextRun()); + } + } + } + } + } + } -- 2.39.5