Browse Source

Add a test to check for a NullPointerException in XSLFTableCell

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1752862 13f79535-47bb-0310-9956-ffa450edef68
tags/REL_3_15_BETA3
Dominik Stadler 7 years ago
parent
commit
73217cecae

+ 1
- 1
src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableCell.java View File

@@ -756,4 +756,4 @@ public class XSLFTableCell extends XSLFTextShape implements TableCell<XSLFShape,
return (tps == null) ? null : tps.getTcTxStyle();
}
}
}
}

+ 22
- 0
src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java View File

@@ -24,10 +24,16 @@ import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.List;
import org.apache.poi.sl.draw.DrawFactory;
import org.apache.poi.sl.usermodel.Slide;
import org.apache.poi.sl.usermodel.TableCell.BorderEdge;
import org.apache.poi.sl.usermodel.VerticalAlignment;
import org.apache.poi.xslf.XSLFTestDataSamples;
@@ -193,4 +199,20 @@ public class TestXSLFTable {
ppt.close();
}
@Test
public void checkNullPointerException() {
XMLSlideShow ss = XSLFTestDataSamples.openSampleDocument("au.asn.aes.www_conferences_2011_presentations_Fri_20Room4Level4_20930_20Maloney.pptx");
Dimension pgsize = ss.getPageSize();
for (Slide<?, ?> s : ss.getSlides()) {
BufferedImage img = new BufferedImage(pgsize.width, pgsize.height, BufferedImage.TYPE_INT_ARGB);
Graphics2D graphics = img.createGraphics();
// draw stuff
s.draw(graphics);
graphics.dispose();
img.flush();
}
}
}

BIN
test-data/slideshow/au.asn.aes.www_conferences_2011_presentations_Fri_20Room4Level4_20930_20Maloney.pptx View File


Loading…
Cancel
Save