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
This commit is contained in:
Dominik Stadler 2016-07-15 18:24:11 +00:00
parent 45fc872dde
commit 73217cecae
3 changed files with 23 additions and 1 deletions

View File

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

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();
}
}
}