From 4a3ea104fe275e0d0f8d094f7bd1f6da57562d64 Mon Sep 17 00:00:00 2001 From: Andreas Beeker Date: Wed, 16 May 2018 21:57:49 +0000 Subject: #62037 - SlideNames should not be null but have a default as if accessed by VBA git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1831745 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/poi/sl/usermodel/BaseTestSlideShow.java | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'src/testcases/org/apache/poi/sl') diff --git a/src/testcases/org/apache/poi/sl/usermodel/BaseTestSlideShow.java b/src/testcases/org/apache/poi/sl/usermodel/BaseTestSlideShow.java index 347ea73a6c..c4daa50b3f 100644 --- a/src/testcases/org/apache/poi/sl/usermodel/BaseTestSlideShow.java +++ b/src/testcases/org/apache/poi/sl/usermodel/BaseTestSlideShow.java @@ -159,16 +159,20 @@ public abstract class BaseTestSlideShow { } @Test - public void shapeName() throws IOException { + public void shapeAndSlideName() throws IOException { final String file = "SampleShow.ppt"+(getClass().getSimpleName().contains("XML")?"x":""); - try (final InputStream is = slTests.openResourceAsStream(file)) { - try (final SlideShow ppt = SlideShowFactory.create(is)) { - final List shapes1 = ppt.getSlides().get(0).getShapes(); - assertEquals("The Title", shapes1.get(0).getShapeName()); - assertEquals("Another Subtitle", shapes1.get(1).getShapeName()); - final List shapes2 = ppt.getSlides().get(1).getShapes(); - assertEquals("Title 1", shapes2.get(0).getShapeName()); - assertEquals("Content Placeholder 2", shapes2.get(1).getShapeName()); + try (final InputStream is = slTests.openResourceAsStream(file); + final SlideShow ppt = SlideShowFactory.create(is)) { + final List shapes1 = ppt.getSlides().get(0).getShapes(); + assertEquals("The Title", shapes1.get(0).getShapeName()); + assertEquals("Another Subtitle", shapes1.get(1).getShapeName()); + final List shapes2 = ppt.getSlides().get(1).getShapes(); + assertEquals("Title 1", shapes2.get(0).getShapeName()); + assertEquals("Content Placeholder 2", shapes2.get(1).getShapeName()); + + for (final Slide slide : ppt.getSlides()) { + final String expected = slide.getSlideNumber()==1 ? "FirstSlide" : "Slide2"; + assertEquals(expected, slide.getSlideName()); } } } -- cgit v1.2.3