From: Nick Burch Date: Sun, 26 Mar 2006 19:08:10 +0000 (+0000) Subject: More slide related tests X-Git-Tag: REL_3_0_ALPHA3~144 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f691514b2d4c18dae6691217db2b6d1db4922147;p=poi.git More slide related tests git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@388942 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlides.java b/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlides.java index a60c873530..9bb5efa4ab 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlides.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlides.java @@ -39,8 +39,11 @@ public class TestSlides extends TestCase { public void testAddSlides1() throws Exception { SlideShow ppt = new SlideShow(new HSLFSlideShow( TestSlides.class.getResourceAsStream("/org/apache/poi/hslf/data/empty.ppt") )); assertTrue(ppt.getSlides().length == 0); - ppt.createSlide(); + + Slide s1 = ppt.createSlide(); assertTrue(ppt.getSlides().length == 1); + assertEquals(3, s1.getSheetNumber()); + assertEquals(1, s1.getSlideNumber()); //serialize and read again ByteArrayOutputStream out = new ByteArrayOutputStream(); @@ -61,9 +64,13 @@ public class TestSlides extends TestCase { Slide s1 = ppt.createSlide(); assertTrue(ppt.getSlides().length == 1); + assertEquals(3, s1.getSheetNumber()); + assertEquals(1, s1.getSlideNumber()); Slide s2 = ppt.createSlide(); assertTrue(ppt.getSlides().length == 2); + assertEquals(4, s2.getSheetNumber()); + assertEquals(2, s2.getSlideNumber()); //serialize and read again ByteArrayOutputStream out = new ByteArrayOutputStream(); @@ -84,12 +91,18 @@ public class TestSlides extends TestCase { Slide s1 = ppt.createSlide(); assertTrue(ppt.getSlides().length == 1); + assertEquals(3, s1.getSheetNumber()); + assertEquals(1, s1.getSlideNumber()); Slide s2 = ppt.createSlide(); assertTrue(ppt.getSlides().length == 2); + assertEquals(4, s2.getSheetNumber()); + assertEquals(2, s2.getSlideNumber()); Slide s3 = ppt.createSlide(); assertTrue(ppt.getSlides().length == 3); + assertEquals(5, s3.getSheetNumber()); + assertEquals(3, s3.getSlideNumber()); //serialize and read again ByteArrayOutputStream out = new ByteArrayOutputStream(); diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestCounts.java b/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestCounts.java index 13aa468d9d..e204303a85 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestCounts.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestCounts.java @@ -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()); } }