aboutsummaryrefslogtreecommitdiffstats
path: root/src/scratchpad/testcases
diff options
context:
space:
mode:
authorYegor Kozlov <yegor@apache.org>2009-02-01 15:07:25 +0000
committerYegor Kozlov <yegor@apache.org>2009-02-01 15:07:25 +0000
commitf6fae6e2d1ab4f9dc08bdaa3059b5f040bb02f4e (patch)
treeb092b60ddd297380801d370866788246fb92cdb9 /src/scratchpad/testcases
parentd01cd80981cc07a6b7e13430a49faac3bd76be54 (diff)
downloadpoi-f6fae6e2d1ab4f9dc08bdaa3059b5f040bb02f4e.tar.gz
poi-f6fae6e2d1ab4f9dc08bdaa3059b5f040bb02f4e.zip
added a method to remove slides
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@739775 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/scratchpad/testcases')
-rw-r--r--src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestAddingSlides.java44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestAddingSlides.java b/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestAddingSlides.java
index 02c6beb53b..17f8fcb68c 100644
--- a/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestAddingSlides.java
+++ b/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestAddingSlides.java
@@ -225,4 +225,48 @@ public final class TestAddingSlides extends TestCase {
assertEquals(8, s3._getSheetRefId());
assertEquals(3, s3.getSlideNumber());
}
+
+ /**
+ * Test SlideShow#removeSlide
+ */
+ public void testRemoving() throws Exception {
+ SlideShow ppt = new SlideShow();
+ Slide slide1 = ppt.createSlide();
+ Slide slide2 = ppt.createSlide();
+
+ Slide[] s1 = ppt.getSlides();
+ assertEquals(2, s1.length);
+ try {
+ ppt.removeSlide(-1);
+ fail("expected exception");
+ } catch (Exception e){
+ ;
+ }
+
+ try {
+ ppt.removeSlide(2);
+ fail("expected exception");
+ } catch (Exception e){
+ ;
+ }
+
+ assertEquals(1, slide1.getSlideNumber());
+
+ Slide removedSlide = ppt.removeSlide(0);
+ Slide[] s2 = ppt.getSlides();
+ assertEquals(1, s2.length);
+ assertSame(slide1, removedSlide);
+ assertSame(slide2, s2[0]);
+
+ assertEquals(0, slide2.getSlideNumber());
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ ppt.write(out);
+
+ ppt = new SlideShow(new ByteArrayInputStream(out.toByteArray()));
+
+ Slide[] s3 = ppt.getSlides();
+ assertEquals(1, s3.length);
+ }
+
}