]> source.dussan.org Git - poi.git/commitdiff
Fixes/Updates to tests to go with big change in how slides/notes are tied to their...
authorNick Burch <nick@apache.org>
Mon, 27 Mar 2006 21:36:00 +0000 (21:36 +0000)
committerNick Burch <nick@apache.org>
Mon, 27 Mar 2006 21:36:00 +0000 (21:36 +0000)
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@389287 13f79535-47bb-0310-9956-ffa450edef68

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

index 86bf79d3892630014306a028f481a6250c46aaa4..b977fdbe1c5c8ed1920fa0c143053395fb24f3f2 100644 (file)
@@ -58,6 +58,6 @@ public class TestSlideChangeNotes extends TestCase {
 
                slideOne.setNotes(notesOne);
 
-               assertEquals(notesOne.getSheetNumber(), sa.getNotesID());
+               assertEquals(notesOne._getSheetNumber(), sa.getNotesID());
     }
 }
index 9bb5efa4abb7a9a00b0b564506051a4347ea8246..3dab026ecb06005fb68b54b37a807a5feaf58dfa 100644 (file)
@@ -42,7 +42,8 @@ public class TestSlides extends TestCase {
         \r
         Slide s1 = ppt.createSlide();\r
         assertTrue(ppt.getSlides().length == 1);\r
-        assertEquals(3, s1.getSheetNumber());\r
+        assertEquals(3, s1._getSheetRefId());\r
+        assertEquals(256, s1._getSheetNumber());\r
         assertEquals(1, s1.getSlideNumber());\r
 \r
         //serialize and read again\r
@@ -64,12 +65,14 @@ public class TestSlides extends TestCase {
         \r
         Slide s1 = ppt.createSlide();\r
         assertTrue(ppt.getSlides().length == 1);\r
-        assertEquals(3, s1.getSheetNumber());\r
+        assertEquals(3, s1._getSheetRefId());\r
+        assertEquals(256, 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(4, s2._getSheetRefId());\r
+        assertEquals(257, s2._getSheetNumber());\r
         assertEquals(2, s2.getSlideNumber());\r
 \r
         //serialize and read again\r
@@ -91,17 +94,20 @@ public class TestSlides extends TestCase {
         \r
         Slide s1 = ppt.createSlide();\r
         assertTrue(ppt.getSlides().length == 1);\r
-        assertEquals(3, s1.getSheetNumber());\r
+        assertEquals(3, s1._getSheetRefId());\r
+        assertEquals(256, 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(4, s2._getSheetRefId());\r
+        assertEquals(257, 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(5, s3._getSheetRefId());\r
+        assertEquals(258, s3._getSheetNumber());\r
         assertEquals(3, s3.getSlideNumber());\r
 \r
         //serialize and read again\r
index e204303a852ffa52b608072db9cf5d3c46b7eb01..afc1cf699783d4f1f71829a890da7f5feb028a00 100644 (file)
@@ -49,25 +49,31 @@ public class TestCounts extends TestCase {
                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());
+               // The ref IDs are 4 and 6
+               assertEquals(4, slides[0]._getSheetRefId());
+               assertEquals(6, slides[1]._getSheetRefId());
+               
+               // These are slides 1+2 -> 256+257
+               assertEquals(256, slides[0]._getSheetNumber());
+               assertEquals(257, 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);
+               // Two sheets -> two notes
+               // Note: there are also notes on the slide master
+               //assertEquals(3, notes.length); // When we do slide masters
+               assertEquals(2, notes.length);
                
                // First is for master
-               assertEquals(-2147483648, notes[0].getSlideInternalNumber());
+               //assertEquals(-2147483648, notes[0]._getSheetNumber());  // When we do slide masters
                
                // Next two are for the two slides
-               assertEquals(256, notes[1].getSlideInternalNumber());
-               assertEquals(257, notes[2].getSlideInternalNumber());
+               assertEquals(256, notes[0]._getSheetNumber());
+               assertEquals(257, notes[1]._getSheetNumber());
                
-               // They go between the slides
-               assertEquals(5, notes[1].getSheetNumber());
-               assertEquals(7, notes[2].getSheetNumber());
+               // They happen to go between the two slides in Ref terms
+               assertEquals(5, notes[0]._getSheetRefId());
+               assertEquals(7, notes[1]._getSheetRefId());
        }
 }
index e4d6590be460edd8a4ba2180d60f0daa418e6a09..0b2322cd05940e95564e93c7815cdc12b46dd452 100644 (file)
@@ -41,7 +41,7 @@ public class TestNotesText extends TestCase {
     }
 
     public void testNotesOne() throws Exception {
-               Notes notes = ss.getNotes()[1];
+               Notes notes = ss.getNotes()[0];
 
                String[] expectText = new String[] {"These are the notes for page 1"};
                assertEquals(expectText.length, notes.getTextRuns().length);
@@ -51,7 +51,7 @@ public class TestNotesText extends TestCase {
     }
 
        public void testNotesTwo() throws Exception {
-               Notes notes = ss.getNotes()[2];
+               Notes notes = ss.getNotes()[1];
                String[] expectText = new String[] {"These are the notes on page two, again lacking formatting"};
                assertEquals(expectText.length, notes.getTextRuns().length);
                for(int i=0; i<expectText.length; i++) {
index 76da976312dda6891f039e1f2551bec68333773c..ecc6aeaf34f6c00e111830a7e5ee52a236dca819 100644 (file)
@@ -20,9 +20,11 @@ public class TestRichTextRun extends TestCase {
        private SlideShow ss;
        private SlideShow ssRichA;
        private SlideShow ssRichB;
+       private SlideShow ssRichC;
        private HSLFSlideShow hss;
        private HSLFSlideShow hssRichA;
        private HSLFSlideShow hssRichB;
+       private HSLFSlideShow hssRichC;
        
     protected void setUp() throws Exception {
                String dirname = System.getProperty("HSLF.testdata.path");
@@ -41,6 +43,12 @@ public class TestRichTextRun extends TestCase {
                filename = dirname + "/Single_Coloured_Page_With_Fonts_and_Alignments.ppt";
                hssRichB = new HSLFSlideShow(filename);
                ssRichB = new SlideShow(hssRichB);
+               
+               // Rich test file C - has paragraph styles that run out before
+               //   the character ones do
+               filename = dirname + "/ParagraphStylesShorterThanCharStyles.ppt";
+               hssRichC = new HSLFSlideShow(filename);
+               ssRichC = new SlideShow(hssRichC);
        }
 
        /**
@@ -194,4 +202,13 @@ public class TestRichTextRun extends TestCase {
                        assertEquals("Courier", rtrRRa.getFontName());
                }
        }
+       
+       /**
+        * Test that we can do the right things when the paragraph styles
+        *  run out before the character styles do
+        * NOTE: Disabled, as we can't currently do this!
+        */
+       public void BROKENtestParagraphStylesShorterTheCharStyles() {
+               // TODO
+       }
 }