]> source.dussan.org Git - poi.git/commitdiff
More slide related tests
authorNick Burch <nick@apache.org>
Sun, 26 Mar 2006 19:08:10 +0000 (19:08 +0000)
committerNick Burch <nick@apache.org>
Sun, 26 Mar 2006 19:08:10 +0000 (19:08 +0000)
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@388942 13f79535-47bb-0310-9956-ffa450edef68

src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlides.java
src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestCounts.java

index a60c873530b3c3a560fa6caad7f988103f452de6..9bb5efa4abb7a9a00b0b564506051a4347ea8246 100644 (file)
@@ -39,8 +39,11 @@ public class TestSlides extends TestCase {
     public void testAddSlides1() throws Exception {\r
         SlideShow ppt = new SlideShow(new HSLFSlideShow( TestSlides.class.getResourceAsStream("/org/apache/poi/hslf/data/empty.ppt") ));\r
         assertTrue(ppt.getSlides().length == 0);\r
-        ppt.createSlide();\r
+        \r
+        Slide s1 = ppt.createSlide();\r
         assertTrue(ppt.getSlides().length == 1);\r
+        assertEquals(3, s1.getSheetNumber());\r
+        assertEquals(1, s1.getSlideNumber());\r
 \r
         //serialize and read again\r
         ByteArrayOutputStream out = new ByteArrayOutputStream();\r
@@ -61,9 +64,13 @@ public class TestSlides extends TestCase {
         \r
         Slide s1 = ppt.createSlide();\r
         assertTrue(ppt.getSlides().length == 1);\r
+        assertEquals(3, s1.getSheetNumber());\r
+        assertEquals(1, s1.getSlideNumber());\r
         \r
         Slide s2 = ppt.createSlide();\r
         assertTrue(ppt.getSlides().length == 2);\r
+        assertEquals(4, s2.getSheetNumber());\r
+        assertEquals(2, s2.getSlideNumber());\r
 \r
         //serialize and read again\r
          ByteArrayOutputStream out = new ByteArrayOutputStream();\r
@@ -84,12 +91,18 @@ public class TestSlides extends TestCase {
         \r
         Slide s1 = ppt.createSlide();\r
         assertTrue(ppt.getSlides().length == 1);\r
+        assertEquals(3, s1.getSheetNumber());\r
+        assertEquals(1, s1.getSlideNumber());\r
         \r
         Slide s2 = ppt.createSlide();\r
         assertTrue(ppt.getSlides().length == 2);\r
+        assertEquals(4, s2.getSheetNumber());\r
+        assertEquals(2, s2.getSlideNumber());\r
 \r
         Slide s3 = ppt.createSlide();\r
         assertTrue(ppt.getSlides().length == 3);\r
+        assertEquals(5, s3.getSheetNumber());\r
+        assertEquals(3, s3.getSlideNumber());\r
 \r
         //serialize and read again\r
          ByteArrayOutputStream out = new ByteArrayOutputStream();\r
index 13aa468d9d48f17cbe7111557e8601931720af54..e204303a852ffa52b608072db9cf5d3c46b7eb01 100644 (file)
@@ -44,11 +44,30 @@ public class TestCounts extends TestCase {
                Slide[] slides = ss.getSlides();
                // Two sheets - master sheet is seperate
                assertEquals(2, slides.length);
+               
+               // They are slides 1+2
+               assertEquals(1, slides[0].getSlideNumber());
+               assertEquals(2, slides[1].getSlideNumber());
+               
+               // The internal IDs are 4 and 6
+               assertEquals(4, slides[0].getSheetNumber());
+               assertEquals(6, slides[1].getSheetNumber());
        }
 
     public void testNotesCount() throws Exception {
                Notes[] notes = ss.getNotes();
                // Two sheets -> two notes, plus the notes on the slide master
                assertEquals(3, notes.length);
+               
+               // First is for master
+               assertEquals(-2147483648, notes[0].getSlideInternalNumber());
+               
+               // Next two are for the two slides
+               assertEquals(256, notes[1].getSlideInternalNumber());
+               assertEquals(257, notes[2].getSlideInternalNumber());
+               
+               // They go between the slides
+               assertEquals(5, notes[1].getSheetNumber());
+               assertEquals(7, notes[2].getSheetNumber());
        }
 }