poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kiwiwi...@apache.org
Subject svn commit: r1692593 [14/17] - in /poi: site/src/documentation/content/xdocs/ trunk/ trunk/src/examples/src/org/apache/poi/hslf/examples/ trunk/src/examples/src/org/apache/poi/hssf/usermodel/examples/ trunk/src/examples/src/org/apache/poi/xslf/usermode...
Date Fri, 24 Jul 2015 21:47:58 GMT
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlideMaster.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlideMaster.java?rev=1692593&r1=1692592&r2=1692593&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlideMaster.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlideMaster.java Fri Jul 24 21:47:55 2015
@@ -17,64 +17,66 @@
 
 package org.apache.poi.hslf.model;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
+import java.util.List;
 
-import junit.framework.TestCase;
-
-import org.apache.poi.hslf.HSLFSlideShow;
+import org.apache.poi.POIDataSamples;
 import org.apache.poi.hslf.model.textproperties.CharFlagsTextProp;
 import org.apache.poi.hslf.record.Environment;
 import org.apache.poi.hslf.record.TextHeaderAtom;
-import org.apache.poi.hslf.usermodel.RichTextRun;
-import org.apache.poi.hslf.usermodel.SlideShow;
-import org.apache.poi.POIDataSamples;
+import org.apache.poi.hslf.usermodel.*;
+import org.junit.Test;
 
 /**
  * Tests for SlideMaster
  *
  * @author Yegor Kozlov
  */
-public final class TestSlideMaster extends TestCase{
+public final class TestSlideMaster {
     private static POIDataSamples _slTests = POIDataSamples.getSlideShowInstance();
 
     /**
      * The reference ppt has two masters.
      * Check we can read their attributes.
      */
+    @Test
     public void testSlideMaster() throws Exception {
-        SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("slide_master.ppt"));
+        HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream("slide_master.ppt"));
 
         Environment env = ppt.getDocumentRecord().getEnvironment();
 
-        SlideMaster[] master = ppt.getSlidesMasters();
-        assertEquals(2, master.length);
+        List<HSLFSlideMaster> master = ppt.getSlideMasters();
+        assertEquals(2, master.size());
 
         //character attributes
-        assertEquals(40, master[0].getStyleAttribute(TextHeaderAtom.TITLE_TYPE, 0, "font.size", true).getValue());
-        assertEquals(48, master[1].getStyleAttribute(TextHeaderAtom.TITLE_TYPE, 0, "font.size", true).getValue());
+        assertEquals(40, master.get(0).getStyleAttribute(TextHeaderAtom.TITLE_TYPE, 0, "font.size", true).getValue());
+        assertEquals(48, master.get(1).getStyleAttribute(TextHeaderAtom.TITLE_TYPE, 0, "font.size", true).getValue());
 
-        int font1 = master[0].getStyleAttribute(TextHeaderAtom.TITLE_TYPE, 0, "font.index", true).getValue();
-        int font2 = master[1].getStyleAttribute(TextHeaderAtom.TITLE_TYPE, 0, "font.index", true).getValue();
+        int font1 = master.get(0).getStyleAttribute(TextHeaderAtom.TITLE_TYPE, 0, "font.index", true).getValue();
+        int font2 = master.get(1).getStyleAttribute(TextHeaderAtom.TITLE_TYPE, 0, "font.index", true).getValue();
         assertEquals("Arial", env.getFontCollection().getFontWithId(font1));
         assertEquals("Georgia", env.getFontCollection().getFontWithId(font2));
 
-        CharFlagsTextProp prop1 = (CharFlagsTextProp)master[0].getStyleAttribute(TextHeaderAtom.TITLE_TYPE, 0, "char_flags", true);
+        CharFlagsTextProp prop1 = (CharFlagsTextProp)master.get(0).getStyleAttribute(TextHeaderAtom.TITLE_TYPE, 0, "char_flags", true);
         assertEquals(false, prop1.getSubValue(CharFlagsTextProp.BOLD_IDX));
         assertEquals(false, prop1.getSubValue(CharFlagsTextProp.ITALIC_IDX));
         assertEquals(true, prop1.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));
 
-        CharFlagsTextProp prop2 = (CharFlagsTextProp)master[1].getStyleAttribute(TextHeaderAtom.TITLE_TYPE, 0, "char_flags", true);
+        CharFlagsTextProp prop2 = (CharFlagsTextProp)master.get(1).getStyleAttribute(TextHeaderAtom.TITLE_TYPE, 0, "char_flags", true);
         assertEquals(false, prop2.getSubValue(CharFlagsTextProp.BOLD_IDX));
         assertEquals(true, prop2.getSubValue(CharFlagsTextProp.ITALIC_IDX));
         assertEquals(false, prop2.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));
 
         //now paragraph attributes
-        assertEquals(0x266B, master[0].getStyleAttribute(TextHeaderAtom.BODY_TYPE, 0, "bullet.char", false).getValue());
-        assertEquals(0x2022, master[1].getStyleAttribute(TextHeaderAtom.BODY_TYPE, 0, "bullet.char", false).getValue());
+        assertEquals(0x266B, master.get(0).getStyleAttribute(TextHeaderAtom.BODY_TYPE, 0, "bullet.char", false).getValue());
+        assertEquals(0x2022, master.get(1).getStyleAttribute(TextHeaderAtom.BODY_TYPE, 0, "bullet.char", false).getValue());
 
-        int b1 = master[0].getStyleAttribute(TextHeaderAtom.BODY_TYPE, 0, "bullet.font", false).getValue();
-        int b2 = master[1].getStyleAttribute(TextHeaderAtom.BODY_TYPE, 0, "bullet.font", false).getValue();
+        int b1 = master.get(0).getStyleAttribute(TextHeaderAtom.BODY_TYPE, 0, "bullet.font", false).getValue();
+        int b2 = master.get(1).getStyleAttribute(TextHeaderAtom.BODY_TYPE, 0, "bullet.font", false).getValue();
         assertEquals("Arial", env.getFontCollection().getFontWithId(b1));
         assertEquals("Georgia", env.getFontCollection().getFontWithId(b2));
     }
@@ -82,19 +84,20 @@ public final class TestSlideMaster exten
     /**
      * Test we can read default text attributes for a title master sheet
      */
+    @Test
     public void testTitleMasterTextAttributes() throws Exception {
-        SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("slide_master.ppt"));
-        TitleMaster[] master = ppt.getTitleMasters();
-        assertEquals(1, master.length);
+        HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream("slide_master.ppt"));
+        List<HSLFTitleMaster> master = ppt.getTitleMasters();
+        assertEquals(1, master.size());
 
-        assertEquals(32, master[0].getStyleAttribute(TextHeaderAtom.CENTER_TITLE_TYPE, 0, "font.size", true).getValue());
-        CharFlagsTextProp prop1 = (CharFlagsTextProp)master[0].getStyleAttribute(TextHeaderAtom.CENTER_TITLE_TYPE, 0, "char_flags", true);
+        assertEquals(32, master.get(0).getStyleAttribute(TextHeaderAtom.CENTER_TITLE_TYPE, 0, "font.size", true).getValue());
+        CharFlagsTextProp prop1 = (CharFlagsTextProp)master.get(0).getStyleAttribute(TextHeaderAtom.CENTER_TITLE_TYPE, 0, "char_flags", true);
         assertEquals(true, prop1.getSubValue(CharFlagsTextProp.BOLD_IDX));
         assertEquals(false, prop1.getSubValue(CharFlagsTextProp.ITALIC_IDX));
         assertEquals(true, prop1.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));
 
-        assertEquals(20, master[0].getStyleAttribute(TextHeaderAtom.CENTRE_BODY_TYPE, 0, "font.size", true).getValue());
-        CharFlagsTextProp prop2 = (CharFlagsTextProp)master[0].getStyleAttribute(TextHeaderAtom.CENTRE_BODY_TYPE, 0, "char_flags", true);
+        assertEquals(20, master.get(0).getStyleAttribute(TextHeaderAtom.CENTRE_BODY_TYPE, 0, "font.size", true).getValue());
+        CharFlagsTextProp prop2 = (CharFlagsTextProp)master.get(0).getStyleAttribute(TextHeaderAtom.CENTRE_BODY_TYPE, 0, "char_flags", true);
         assertEquals(true, prop2.getSubValue(CharFlagsTextProp.BOLD_IDX));
         assertEquals(false, prop2.getSubValue(CharFlagsTextProp.ITALIC_IDX));
         assertEquals(false, prop2.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));
@@ -103,25 +106,25 @@ public final class TestSlideMaster exten
     /**
      * Slide 3 has title layout and follows the TitleMaster. Verify that.
      */
+    @Test
     public void testTitleMaster() throws Exception {
-        SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("slide_master.ppt"));
-        Slide slide = ppt.getSlides()[2];
-        MasterSheet masterSheet = slide.getMasterSheet();
-        assertTrue(masterSheet instanceof TitleMaster);
-
-        TextRun[] txt = slide.getTextRuns();
-        for (int i = 0; i < txt.length; i++) {
-            RichTextRun rt = txt[i].getRichTextRuns()[0];
-            switch(txt[i].getRunType()){
+        HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream("slide_master.ppt"));
+        HSLFSlide slide = ppt.getSlides().get(2);
+        HSLFMasterSheet masterSheet = slide.getMasterSheet();
+        assertTrue(masterSheet instanceof HSLFTitleMaster);
+
+        for (List<HSLFTextParagraph> txt : slide.getTextParagraphs()) {
+            HSLFTextRun rt = txt.get(0).getTextRuns().get(0);
+            switch(txt.get(0).getRunType()){
                 case TextHeaderAtom.CENTER_TITLE_TYPE:
-                    assertEquals("Arial", rt.getFontName());
-                    assertEquals(32, rt.getFontSize());
+                    assertEquals("Arial", rt.getFontFamily());
+                    assertEquals(32, rt.getFontSize(), 0);
                     assertEquals(true, rt.isBold());
                     assertEquals(true, rt.isUnderlined());
                     break;
                 case TextHeaderAtom.CENTRE_BODY_TYPE:
-                    assertEquals("Courier New", rt.getFontName());
-                    assertEquals(20, rt.getFontSize());
+                    assertEquals("Courier New", rt.getFontFamily());
+                    assertEquals(20, rt.getFontSize(), 0);
                     assertEquals(true, rt.isBold());
                     assertEquals(false, rt.isUnderlined());
                     break;
@@ -132,47 +135,47 @@ public final class TestSlideMaster exten
     /**
      * If a style attribute is not set ensure it is read from the master
      */
+    @Test
     public void testMasterAttributes() throws Exception {
-        SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("slide_master.ppt"));
-        Slide[] slide = ppt.getSlides();
-        assertEquals(3, slide.length);
-        TextRun[] trun;
-
-        trun = slide[0].getTextRuns();
-        for (int i = 0; i < trun.length; i++) {
-            if (trun[i].getRunType() == TextHeaderAtom.TITLE_TYPE){
-                RichTextRun rt = trun[i].getRichTextRuns()[0];
-                assertEquals(40, rt.getFontSize());
+        HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream("slide_master.ppt"));
+        List<HSLFSlide> slide = ppt.getSlides();
+        assertEquals(3, slide.size());
+        for (List<HSLFTextParagraph> tparas : slide.get(0).getTextParagraphs()) {
+            HSLFTextParagraph tpara = tparas.get(0);
+            if (tpara.getRunType() == TextHeaderAtom.TITLE_TYPE){
+                HSLFTextRun rt = tpara.getTextRuns().get(0);
+                assertEquals(40, rt.getFontSize(), 0);
                 assertEquals(true, rt.isUnderlined());
-                assertEquals("Arial", rt.getFontName());
-            } else if (trun[i].getRunType() == TextHeaderAtom.BODY_TYPE){
-                RichTextRun rt;
-                rt = trun[i].getRichTextRuns()[0];
-                assertEquals(0, rt.getIndentLevel());
-                assertEquals(32, rt.getFontSize());
-                assertEquals("Arial", rt.getFontName());
-
-                rt = trun[i].getRichTextRuns()[1];
-                assertEquals(1, rt.getIndentLevel());
-                assertEquals(28, rt.getFontSize());
-                assertEquals("Arial", rt.getFontName());
+                assertEquals("Arial", rt.getFontFamily());
+            } else if (tpara.getRunType() == TextHeaderAtom.BODY_TYPE){
+                HSLFTextRun rt = tpara.getTextRuns().get(0);
+                assertEquals(0, tpara.getIndentLevel());
+                assertEquals(32, rt.getFontSize(), 0);
+                assertEquals("Arial", rt.getFontFamily());
+
+                tpara = tparas.get(1);
+                rt = tpara.getTextRuns().get(0);
+                assertEquals(1, tpara.getIndentLevel());
+                assertEquals(28, rt.getFontSize(), 0);
+                assertEquals("Arial", rt.getFontFamily());
 
             }
         }
 
-        trun = slide[1].getTextRuns();
-        for (int i = 0; i < trun.length; i++) {
-            if (trun[i].getRunType() == TextHeaderAtom.TITLE_TYPE){
-                RichTextRun rt = trun[i].getRichTextRuns()[0];
-                assertEquals(48, rt.getFontSize());
+        ;
+        for (List<HSLFTextParagraph> tparas : slide.get(1).getTextParagraphs()) {
+            HSLFTextParagraph tpara = tparas.get(0);
+            if (tpara.getRunType() == TextHeaderAtom.TITLE_TYPE){
+                HSLFTextRun rt = tpara.getTextRuns().get(0);
+                assertEquals(48, rt.getFontSize(), 0);
                 assertEquals(true, rt.isItalic());
-                assertEquals("Georgia", rt.getFontName());
-            } else if (trun[i].getRunType() == TextHeaderAtom.BODY_TYPE){
-                RichTextRun rt;
-                rt = trun[i].getRichTextRuns()[0];
-                assertEquals(0, rt.getIndentLevel());
-                assertEquals(32, rt.getFontSize());
-                assertEquals("Courier New", rt.getFontName());
+                assertEquals("Georgia", rt.getFontFamily());
+            } else if (tpara.getRunType() == TextHeaderAtom.BODY_TYPE){
+                HSLFTextRun rt;
+                rt = tpara.getTextRuns().get(0);
+                assertEquals(0, tpara.getIndentLevel());
+                assertEquals(32, rt.getFontSize(), 0);
+                assertEquals("Courier New", rt.getFontFamily());
             }
         }
 
@@ -181,20 +184,21 @@ public final class TestSlideMaster exten
     /**
      * Check we can dynamically assign a slide master to a slide.
      */
+    @Test
     public void testChangeSlideMaster() throws Exception {
-        SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("slide_master.ppt"));
-        SlideMaster[] master = ppt.getSlidesMasters();
-        Slide[] slide = ppt.getSlides();
+        HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream("slide_master.ppt"));
+        List<HSLFSlideMaster> master = ppt.getSlideMasters();
+        List<HSLFSlide> slide = ppt.getSlides();
         int sheetNo;
 
         //each slide uses its own master
-        assertEquals(slide[0].getMasterSheet()._getSheetNumber(), master[0]._getSheetNumber());
-        assertEquals(slide[1].getMasterSheet()._getSheetNumber(), master[1]._getSheetNumber());
+        assertEquals(slide.get(0).getMasterSheet()._getSheetNumber(), master.get(0)._getSheetNumber());
+        assertEquals(slide.get(1).getMasterSheet()._getSheetNumber(), master.get(1)._getSheetNumber());
 
         //all slides use the first master slide
-        sheetNo = master[0]._getSheetNumber();
-        for (int i = 0; i < slide.length; i++) {
-            slide[i].setMasterSheet(master[0]);
+        sheetNo = master.get(0)._getSheetNumber();
+        for (HSLFSlide s : slide) {
+            s.setMasterSheet(master.get(0));
         }
 
         ByteArrayOutputStream out;
@@ -203,11 +207,11 @@ public final class TestSlideMaster exten
         ppt.write(out);
         out.close();
 
-        ppt = new SlideShow(new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray())));
-        master = ppt.getSlidesMasters();
+        ppt = new HSLFSlideShow(new HSLFSlideShowImpl(new ByteArrayInputStream(out.toByteArray())));
+        master = ppt.getSlideMasters();
         slide = ppt.getSlides();
-        for (int i = 0; i < slide.length; i++) {
-            assertEquals(sheetNo, slide[i].getMasterSheet()._getSheetNumber());
+        for (HSLFSlide s : slide) {
+            assertEquals(sheetNo, s.getMasterSheet()._getSheetNumber());
         }
     }
 
@@ -215,33 +219,23 @@ public final class TestSlideMaster exten
      * Varify we can read attrubutes for different identtation levels.
      * (typical for the "bullted body" placeholder)
      */
+    @Test
     public void testIndentation() throws Exception {
-        SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("slide_master.ppt"));
-        Slide slide = ppt.getSlides()[0];
-        TextRun[] trun;
-
-        trun = slide.getTextRuns();
-        for (int i = 0; i < trun.length; i++) {
-            if (trun[i].getRunType() == TextHeaderAtom.TITLE_TYPE){
-                RichTextRun rt = trun[i].getRichTextRuns()[0];
-                assertEquals(40, rt.getFontSize());
+        HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream("slide_master.ppt"));
+        HSLFSlide slide = ppt.getSlides().get(0);
+        
+        for (List<HSLFTextParagraph> tparas : slide.getTextParagraphs()) {
+            HSLFTextParagraph tpara = tparas.get(0);
+            if (tpara.getRunType() == TextHeaderAtom.TITLE_TYPE){
+                HSLFTextRun rt = tpara.getTextRuns().get(0);
+                assertEquals(40, rt.getFontSize(), 0);
                 assertEquals(true, rt.isUnderlined());
-                assertEquals("Arial", rt.getFontName());
-            } else if (trun[i].getRunType() == TextHeaderAtom.BODY_TYPE){
-                RichTextRun[] rt = trun[i].getRichTextRuns();
-                for (int j = 0; j < rt.length; j++) {
-                    int indent = rt[j].getIndentLevel();
-                    switch (indent){
-                        case 0:
-                            assertEquals(32, rt[j].getFontSize());
-                            break;
-                        case 1:
-                            assertEquals(28, rt[j].getFontSize());
-                            break;
-                        case 2:
-                            assertEquals(24, rt[j].getFontSize());
-                            break;
-                    }
+                assertEquals("Arial", rt.getFontFamily());
+            } else if (tpara.getRunType() == TextHeaderAtom.BODY_TYPE){
+                int indents[] = { 32, 28, 24 };
+                for (HSLFTextRun rt : tpara.getTextRuns()) {
+                    int indent = tpara.getIndentLevel();
+                    assertEquals(indents[indent], rt.getFontSize(), 0);
                 }
             }
         }

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlides.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlides.java?rev=1692593&r1=1692592&r2=1692593&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlides.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlides.java Fri Jul 24 21:47:55 2015
@@ -17,13 +17,15 @@
 
 package org.apache.poi.hslf.model;
 
-import junit.framework.TestCase;
-import org.apache.poi.hslf.HSLFSlideShow;
-import org.apache.poi.hslf.usermodel.SlideShow;
-import org.apache.poi.POIDataSamples;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
-import java.io.ByteArrayOutputStream;
 import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+
+import org.apache.poi.POIDataSamples;
+import org.apache.poi.hslf.usermodel.*;
+import org.junit.Test;
 
 /**
  * Test adding new slides to a ppt.
@@ -32,18 +34,19 @@ import java.io.ByteArrayInputStream;
  *  stuff does
  * @author Yegor Kozlov
  */
-public final class TestSlides extends TestCase {
+public final class TestSlides {
 
     /**
      * Add 1 slide to an empty ppt.
      * @throws Exception
      */
+    @Test
     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);
+        HSLFSlideShow ppt = new HSLFSlideShow(new HSLFSlideShowImpl( TestSlides.class.getResourceAsStream("/org/apache/poi/hslf/data/empty.ppt") ));
+        assertTrue(ppt.getSlides().isEmpty());
 
-        Slide s1 = ppt.createSlide();
-        assertTrue(ppt.getSlides().length == 1);
+        HSLFSlide s1 = ppt.createSlide();
+        assertEquals(1, ppt.getSlides().size());
         assertEquals(3, s1._getSheetRefId());
         assertEquals(256, s1._getSheetNumber());
         assertEquals(1, s1.getSlideNumber());
@@ -53,61 +56,63 @@ public final class TestSlides extends Te
         ppt.write(out);
         out.close();
 
-        ppt = new SlideShow(new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray())));
-        assertTrue(ppt.getSlides().length == 1);
+        ppt = new HSLFSlideShow(new HSLFSlideShowImpl(new ByteArrayInputStream(out.toByteArray())));
+        assertEquals(1, ppt.getSlides().size());
     }
 
     /**
      * Add 2 slides to an empty ppt
      * @throws Exception
      */
+    @Test
     public void testAddSlides2() throws Exception {
-        SlideShow ppt = new SlideShow(new HSLFSlideShow( TestSlides.class.getResourceAsStream("/org/apache/poi/hslf/data/empty.ppt") ));
-        assertTrue(ppt.getSlides().length == 0);
+        HSLFSlideShow ppt = new HSLFSlideShow(new HSLFSlideShowImpl( TestSlides.class.getResourceAsStream("/org/apache/poi/hslf/data/empty.ppt") ));
+        assertTrue(ppt.getSlides().isEmpty());
 
-        Slide s1 = ppt.createSlide();
-        assertTrue(ppt.getSlides().length == 1);
+        HSLFSlide s1 = ppt.createSlide();
+        assertEquals(1, ppt.getSlides().size());
         assertEquals(3, s1._getSheetRefId());
         assertEquals(256, s1._getSheetNumber());
         assertEquals(1, s1.getSlideNumber());
 
-        Slide s2 = ppt.createSlide();
-        assertTrue(ppt.getSlides().length == 2);
+        HSLFSlide s2 = ppt.createSlide();
+        assertEquals(2, ppt.getSlides().size());
         assertEquals(4, s2._getSheetRefId());
         assertEquals(257, s2._getSheetNumber());
         assertEquals(2, s2.getSlideNumber());
 
         //serialize and read again
-         ByteArrayOutputStream out = new ByteArrayOutputStream();
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
         ppt.write(out);
         out.close();
 
-        ppt = new SlideShow(new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray())));
-        assertTrue(ppt.getSlides().length == 2);
+        ppt = new HSLFSlideShow(new HSLFSlideShowImpl(new ByteArrayInputStream(out.toByteArray())));
+        assertEquals(2, ppt.getSlides().size());
     }
 
     /**
      * Add 3 slides to an empty ppt
      * @throws Exception
      */
+    @Test
     public void testAddSlides3() throws Exception {
-        SlideShow ppt = new SlideShow(new HSLFSlideShow( TestSlides.class.getResourceAsStream("/org/apache/poi/hslf/data/empty.ppt") ));
-        assertTrue(ppt.getSlides().length == 0);
+        HSLFSlideShow ppt = new HSLFSlideShow(new HSLFSlideShowImpl( TestSlides.class.getResourceAsStream("/org/apache/poi/hslf/data/empty.ppt") ));
+        assertTrue(ppt.getSlides().isEmpty());
 
-        Slide s1 = ppt.createSlide();
-        assertTrue(ppt.getSlides().length == 1);
+        HSLFSlide s1 = ppt.createSlide();
+        assertEquals(1, ppt.getSlides().size());
         assertEquals(3, s1._getSheetRefId());
         assertEquals(256, s1._getSheetNumber());
         assertEquals(1, s1.getSlideNumber());
 
-        Slide s2 = ppt.createSlide();
-        assertTrue(ppt.getSlides().length == 2);
+        HSLFSlide s2 = ppt.createSlide();
+        assertEquals(2, ppt.getSlides().size());
         assertEquals(4, s2._getSheetRefId());
         assertEquals(257, s2._getSheetNumber());
         assertEquals(2, s2.getSlideNumber());
 
-        Slide s3 = ppt.createSlide();
-        assertTrue(ppt.getSlides().length == 3);
+        HSLFSlide s3 = ppt.createSlide();
+        assertEquals(3, ppt.getSlides().size());
         assertEquals(5, s3._getSheetRefId());
         assertEquals(258, s3._getSheetNumber());
         assertEquals(3, s3.getSlideNumber());
@@ -118,18 +123,18 @@ public final class TestSlides extends Te
         ppt.write(out);
         out.close();
 
-        ppt = new SlideShow(new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray())));
-        assertTrue(ppt.getSlides().length == 3);
+        ppt = new HSLFSlideShow(new HSLFSlideShowImpl(new ByteArrayInputStream(out.toByteArray())));
+        assertEquals(3, ppt.getSlides().size());
 
         // Check IDs are still right
-        s1 = ppt.getSlides()[0];
+        s1 = ppt.getSlides().get(0);
         assertEquals(256, s1._getSheetNumber());
         assertEquals(3, s1._getSheetRefId());
-        s2 = ppt.getSlides()[1];
+        s2 = ppt.getSlides().get(1);
         assertEquals(257, s2._getSheetNumber());
         assertEquals(4, s2._getSheetRefId());
-        s3 = ppt.getSlides()[2];;
-        assertTrue(ppt.getSlides().length == 3);
+        s3 = ppt.getSlides().get(2);;
+        assertEquals(3, ppt.getSlides().size());
         assertEquals(258, s3._getSheetNumber());
         assertEquals(5, s3._getSheetRefId());
     }
@@ -137,25 +142,26 @@ public final class TestSlides extends Te
     /**
      * Add slides to ppt which already has two slides
      */
+    @Test
     public void testAddSlides2to3() throws Exception {
         POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
-        SlideShow ppt = new SlideShow(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
+        HSLFSlideShow ppt = new HSLFSlideShow(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
 
-        assertTrue(ppt.getSlides().length == 2);
+        assertEquals(2, ppt.getSlides().size());
 
         // First slide is 256 / 4
-        Slide s1 = ppt.getSlides()[0];
+        HSLFSlide s1 = ppt.getSlides().get(0);
         assertEquals(256, s1._getSheetNumber());
         assertEquals(4, s1._getSheetRefId());
 
         // Last slide is 257 / 6
-        Slide s2 = ppt.getSlides()[1];
+        HSLFSlide s2 = ppt.getSlides().get(1);
         assertEquals(257, s2._getSheetNumber());
         assertEquals(6, s2._getSheetRefId());
 
         // Add another slide, goes in at the end
-        Slide s3 = ppt.createSlide();
-        assertTrue(ppt.getSlides().length == 3);
+        HSLFSlide s3 = ppt.createSlide();
+        assertEquals(3, ppt.getSlides().size());
         assertEquals(258, s3._getSheetNumber());
         assertEquals(8, s3._getSheetRefId());
 
@@ -165,19 +171,19 @@ public final class TestSlides extends Te
         ppt.write(out);
         out.close();
 
-        ppt = new SlideShow(new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray())));
-        assertTrue(ppt.getSlides().length == 3);
+        ppt = new HSLFSlideShow(new HSLFSlideShowImpl(new ByteArrayInputStream(out.toByteArray())));
+        assertEquals(3, ppt.getSlides().size());
 
 
         // Check IDs are still right
-        s1 = ppt.getSlides()[0];
+        s1 = ppt.getSlides().get(0);
         assertEquals(256, s1._getSheetNumber());
         assertEquals(4, s1._getSheetRefId());
-        s2 = ppt.getSlides()[1];
+        s2 = ppt.getSlides().get(1);
         assertEquals(257, s2._getSheetNumber());
         assertEquals(6, s2._getSheetRefId());
-        s3 = ppt.getSlides()[2];;
-        assertTrue(ppt.getSlides().length == 3);
+        s3 = ppt.getSlides().get(2);
+        assertEquals(3, ppt.getSlides().size());
         assertEquals(258, s3._getSheetNumber());
         assertEquals(8, s3._getSheetRefId());
     }

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTable.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTable.java?rev=1692593&r1=1692592&r2=1692593&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTable.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTable.java Fri Jul 24 21:47:55 2015
@@ -17,17 +17,27 @@
 
 package org.apache.poi.hslf.model;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
-import junit.framework.TestCase;
+import java.util.List;
 
 import org.apache.poi.POIDataSamples;
-import org.apache.poi.hslf.HSLFSlideShow;
-import org.apache.poi.hslf.extractor.PowerPointExtractor;
 import org.apache.poi.hslf.record.TextHeaderAtom;
-import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.hslf.usermodel.HSLFShape;
+import org.apache.poi.hslf.usermodel.HSLFSlide;
+import org.apache.poi.hslf.usermodel.HSLFSlideShow;
+import org.apache.poi.hslf.usermodel.HSLFTable;
+import org.apache.poi.hslf.usermodel.HSLFTableCell;
+import org.apache.poi.sl.usermodel.Shape;
+import org.apache.poi.sl.usermodel.Slide;
+import org.apache.poi.sl.usermodel.SlideShow;
+import org.apache.poi.sl.usermodel.TableShape;
 import org.junit.Test;
 
 /**
@@ -35,26 +45,27 @@ import org.junit.Test;
  *
  * @author Yegor Kozlov
  */
-public final class TestTable extends TestCase {
+public final class TestTable {
     private static POIDataSamples _slTests = POIDataSamples.getSlideShowInstance();
 
     /**
      * Test that ShapeFactory works properly and returns <code>Table</code>
      */
+    @Test
     public void testShapeFactory() throws Exception {
-        SlideShow ppt = new SlideShow();
+        HSLFSlideShow ppt = new HSLFSlideShow();
 
-        Slide slide = ppt.createSlide();
+        HSLFSlide slide = ppt.createSlide();
 
-        Table tbl = new Table(2, 5);
+        HSLFTable tbl = new HSLFTable(2, 5);
         slide.addShape(tbl);
 
-        TableCell cell = tbl.getCell(0, 0);
+        HSLFTableCell cell = tbl.getCell(0, 0);
         //table cells have type=TextHeaderAtom.OTHER_TYPE, see bug #46033
-        assertEquals(TextHeaderAtom.OTHER_TYPE, cell.getTextRun().getRunType());
+        assertEquals(TextHeaderAtom.OTHER_TYPE, cell.getTextParagraphs().get(0).getRunType());
 
-        assertTrue(slide.getShapes()[0] instanceof Table);
-        Table tbl2 = (Table)slide.getShapes()[0];
+        assertTrue(slide.getShapes().get(0) instanceof HSLFTable);
+        HSLFTable tbl2 = (HSLFTable)slide.getShapes().get(0);
         assertEquals(tbl.getNumberOfColumns(), tbl2.getNumberOfColumns());
         assertEquals(tbl.getNumberOfRows(), tbl2.getNumberOfRows());
 
@@ -62,10 +73,10 @@ public final class TestTable extends Tes
         ppt.write(out);
         out.close();
 
-        ppt = new SlideShow(new ByteArrayInputStream(out.toByteArray()));
-        slide = ppt.getSlides()[0];
-        assertTrue(slide.getShapes()[0] instanceof Table);
-        Table tbl3 = (Table)slide.getShapes()[0];
+        ppt = new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray()));
+        slide = ppt.getSlides().get(0);
+        assertTrue(slide.getShapes().get(0) instanceof HSLFTable);
+        HSLFTable tbl3 = (HSLFTable)slide.getShapes().get(0);
         assertEquals(tbl.getNumberOfColumns(), tbl3.getNumberOfColumns());
         assertEquals(tbl.getNumberOfRows(), tbl3.getNumberOfRows());
     }
@@ -73,34 +84,36 @@ public final class TestTable extends Tes
     /**
      * Error constructing Table when rownum=1
      */
+    @Test
     public void test45889(){
-        SlideShow ppt = new SlideShow();
-        Slide slide = ppt.createSlide();
-        Shape[] shapes;
-        Table tbl1 = new Table(1, 5);
+        HSLFSlideShow ppt = new HSLFSlideShow();
+        HSLFSlide slide = ppt.createSlide();
+        List<HSLFShape> shapes;
+        HSLFTable tbl1 = new HSLFTable(1, 5);
         assertEquals(5, tbl1.getNumberOfColumns());
         assertEquals(1, tbl1.getNumberOfRows());
         slide.addShape(tbl1);
 
         shapes = slide.getShapes();
-        assertEquals(1, shapes.length);
+        assertEquals(1, shapes.size());
 
-        Table tbl2 = (Table)shapes[0];
+        HSLFTable tbl2 = (HSLFTable)shapes.get(0);
         assertSame(tbl1.getSpContainer(), tbl2.getSpContainer());
 
         assertEquals(tbl1.getNumberOfColumns(), tbl2.getNumberOfColumns());
         assertEquals(tbl1.getNumberOfRows(), tbl2.getNumberOfRows());
     }
 
+    @Test
     public void testIllegalCOnstruction(){
         try {
-            new Table(0, 5);
+            new HSLFTable(0, 5);
             fail("Table(rownum, colnum) must throw IllegalArgumentException if any of tghe arguments is less than 1");
         } catch (IllegalArgumentException e){
 
         }
         try {
-            new Table(5, 0);
+            new HSLFTable(5, 0);
             fail("Table(rownum, colnum) must throw IllegalArgumentException if any of tghe arguments is less than 1");
         } catch (IllegalArgumentException e){
 
@@ -113,23 +126,23 @@ public final class TestTable extends Tes
      */
     @Test
     public void test57820() throws Exception {
-        SlideShow ppt = new SlideShow(new HSLFSlideShow(_slTests.openResourceAsStream("bug57820-initTableNullRefrenceException.ppt")));
+        SlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream("bug57820-initTableNullRefrenceException.ppt"));
 
-        Slide[] slides = ppt.getSlides();
-        assertEquals(1, slides.length);
+        List<? extends Slide<?,?,?>> slides = ppt.getSlides();
+        assertEquals(1, slides.size());
 
-        Shape[] shapes = slides[0].getShapes(); //throws NullPointerException
+        List<? extends Shape> shapes = slides.get(0).getShapes(); //throws NullPointerException
 
-        Table tbl = null;
-        for(int idx = 0; idx < shapes.length; idx++) {
-            if(shapes[idx] instanceof Table) {
-                tbl = (Table)shapes[idx];
+        TableShape tbl = null;
+        for(Shape s : shapes) {
+            if(s instanceof TableShape) {
+                tbl = (TableShape)s;
                 break;
             }
         }
 
         assertNotNull(tbl);
 
-        assertEquals(-1, tbl.getAnchor().y);
+        assertEquals(-1, tbl.getAnchor().getY(), 0);
     }
 }

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRunReWrite.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRunReWrite.java?rev=1692593&r1=1692592&r2=1692593&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRunReWrite.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRunReWrite.java Fri Jul 24 21:47:55 2015
@@ -17,15 +17,18 @@
 
 package org.apache.poi.hslf.model;
 
+import static org.junit.Assert.assertEquals;
 
-import junit.framework.TestCase;
-import java.io.*;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.util.List;
 
-import org.apache.poi.hslf.HSLFSlideShow;
-import org.apache.poi.hslf.usermodel.RichTextRun;
-import org.apache.poi.hslf.usermodel.SlideShow;
-import org.apache.poi.poifs.filesystem.*;
 import org.apache.poi.POIDataSamples;
+import org.apache.poi.hslf.usermodel.*;
+import org.apache.poi.poifs.filesystem.DocumentEntry;
+import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * Tests that if we load something up, get a TextRun, set the text
@@ -34,54 +37,59 @@ import org.apache.poi.POIDataSamples;
  *
  * @author Nick Burch (nick at torchbox dot com)
  */
-public final class TestTextRunReWrite extends TestCase {
+public final class TestTextRunReWrite {
 	// HSLFSlideShow primed on the test data
-	private HSLFSlideShow hss;
+	private HSLFSlideShowImpl hss;
 	// HSLFSlideShow primed on the test data
-	private SlideShow ss;
+	private HSLFSlideShow ss;
 	// POIFS primed on the test data
 	private POIFSFileSystem pfs;
 
 	/**
 	 * Load up a test PPT file with rich data
 	 */
+	@Before
     public void setUp() throws Exception {
         POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
 		String filename = "Single_Coloured_Page_With_Fonts_and_Alignments.ppt";
 		pfs = new POIFSFileSystem(slTests.openResourceAsStream(filename));
-		hss = new HSLFSlideShow(pfs);
-		ss = new SlideShow(hss);
+		hss = new HSLFSlideShowImpl(pfs);
+		ss = new HSLFSlideShow(hss);
     }
 
-    public void testWritesOutTheSameNonRich() throws Exception {
-    	// Grab the first text run on the first sheet
-    	TextRun tr1 = ss.getSlides()[0].getTextRuns()[0];
-    	TextRun tr2 = ss.getSlides()[0].getTextRuns()[1];
-
+    @Test
+	public void testWritesOutTheSameNonRich() throws Exception {
     	// Ensure the text lengths are as we'd expect to start with
-    	assertEquals(1, ss.getSlides().length);
-    	assertEquals(2, ss.getSlides()[0].getTextRuns().length);
-    	assertEquals(30, tr1.getText().length());
-    	assertEquals(179, tr2.getText().length());
-
-    	assertEquals(1, tr1.getRichTextRuns().length);
-    	assertEquals(30, tr1.getRichTextRuns()[0].getLength());
-    	assertEquals(30, tr1.getRichTextRuns()[0].getText().length());
-    	assertEquals(31, tr1.getRichTextRuns()[0]._getRawCharacterStyle().getCharactersCovered());
-    	assertEquals(31, tr1.getRichTextRuns()[0]._getRawParagraphStyle().getCharactersCovered());
+    	assertEquals(1, ss.getSlides().size());
+    	assertEquals(2, ss.getSlides().get(0).getTextParagraphs().size());
+
+        // Grab the first text run on the first sheet
+        List<HSLFTextParagraph> tr1 = ss.getSlides().get(0).getTextParagraphs().get(0);
+        List<HSLFTextParagraph> tr2 = ss.getSlides().get(0).getTextParagraphs().get(1);
+    	
+    	
+    	assertEquals(30, HSLFTextParagraph.getRawText(tr1).length());
+    	assertEquals(179, HSLFTextParagraph.getRawText(tr2).length());
+
+    	assertEquals(1, tr1.size());
+    	assertEquals(30, HSLFTextParagraph.getText(tr1).length());
+    	assertEquals(30, HSLFTextParagraph.getRawText(tr1).length());
+    	assertEquals(31, tr1.get(0).getTextRuns().get(0).getCharacterStyle().getCharactersCovered());
+    	assertEquals(31, tr1.get(0).getParagraphStyle().getCharactersCovered());
 
     	// Set the text to be as it is now
-    	tr1.setText( tr1.getText() );
+    	HSLFTextParagraph.setText(tr1, HSLFTextParagraph.getRawText(tr1));
+    	tr1 = ss.getSlides().get(0).getTextParagraphs().get(0);
 
     	// Check the text lengths are still right
-    	assertEquals(30, tr1.getText().length());
-    	assertEquals(179, tr2.getText().length());
+    	assertEquals(30, HSLFTextParagraph.getRawText(tr1).length());
+    	assertEquals(179, HSLFTextParagraph.getRawText(tr2).length());
 
-    	assertEquals(1, tr1.getRichTextRuns().length);
-    	assertEquals(30, tr1.getRichTextRuns()[0].getLength());
-    	assertEquals(30, tr1.getRichTextRuns()[0].getText().length());
-    	assertEquals(31, tr1.getRichTextRuns()[0]._getRawCharacterStyle().getCharactersCovered());
-    	assertEquals(31, tr1.getRichTextRuns()[0]._getRawParagraphStyle().getCharactersCovered());
+        assertEquals(1, tr1.size());
+        assertEquals(30, HSLFTextParagraph.getText(tr1).length());
+        assertEquals(30, HSLFTextParagraph.getRawText(tr1).length());
+        assertEquals(31, tr1.get(0).getTextRuns().get(0).getCharacterStyle().getCharactersCovered());
+        assertEquals(31, tr1.get(0).getParagraphStyle().getCharactersCovered());
 
 
 		// Write the slideshow out to a byte array
@@ -110,35 +118,35 @@ public final class TestTextRunReWrite ex
 		}
 	}
 
+    @Test
     public void testWritesOutTheSameRich() throws Exception {
     	// Grab the first text run on the first sheet
-    	TextRun tr1 = ss.getSlides()[0].getTextRuns()[0];
+    	List<HSLFTextParagraph> tr1 = ss.getSlides().get(0).getTextParagraphs().get(0);
 
     	// Get the first rich text run
-    	RichTextRun rtr1 = tr1.getRichTextRuns()[0];
+    	HSLFTextRun rtr1 = tr1.get(0).getTextRuns().get(0);
 
 
     	// Check that the text sizes are as expected
-    	assertEquals(1, tr1.getRichTextRuns().length);
-    	assertEquals(30, tr1.getText().length());
-    	assertEquals(30, tr1.getRichTextRuns()[0].getText().length());
+    	assertEquals(1, tr1.get(0).getTextRuns().size());
+        assertEquals(30, HSLFTextParagraph.getRawText(tr1).length());
     	assertEquals(30, rtr1.getLength());
-    	assertEquals(30, rtr1.getText().length());
-    	assertEquals(31, rtr1._getRawCharacterStyle().getCharactersCovered());
-    	assertEquals(31, rtr1._getRawParagraphStyle().getCharactersCovered());
+    	assertEquals(30, rtr1.getRawText().length());
+    	assertEquals(31, rtr1.getCharacterStyle().getCharactersCovered());
+    	assertEquals(31, tr1.get(0).getParagraphStyle().getCharactersCovered());
 
     	// Set the text to be as it is now
-    	rtr1.setText( rtr1.getText() );
-    	rtr1 = tr1.getRichTextRuns()[0];
+    	rtr1.setText( rtr1.getRawText() );
+    	rtr1 = tr1.get(0).getTextRuns().get(0);
 
     	// Check that the text sizes are still as expected
-    	assertEquals(1, tr1.getRichTextRuns().length);
-    	assertEquals(30, tr1.getText().length());
-    	assertEquals(30, tr1.getRichTextRuns()[0].getText().length());
+    	assertEquals(1, tr1.get(0).getTextRuns().size());
+    	assertEquals(30, HSLFTextParagraph.getRawText(tr1).length());
+    	assertEquals(30, tr1.get(0).getTextRuns().get(0).getRawText().length());
     	assertEquals(30, rtr1.getLength());
-    	assertEquals(30, rtr1.getText().length());
-    	assertEquals(31, rtr1._getRawCharacterStyle().getCharactersCovered());
-    	assertEquals(31, rtr1._getRawParagraphStyle().getCharactersCovered());
+    	assertEquals(30, rtr1.getRawText().length());
+    	assertEquals(31, rtr1.getCharacterStyle().getCharactersCovered());
+    	assertEquals(31, tr1.get(0).getParagraphStyle().getCharactersCovered());
 
 
 		// Write the slideshow out to a byte array

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestCurrentUserAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestCurrentUserAtom.java?rev=1692593&r1=1692592&r2=1692593&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestCurrentUserAtom.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestCurrentUserAtom.java Fri Jul 24 21:47:55 2015
@@ -24,8 +24,8 @@ import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
 
 import org.apache.poi.POIDataSamples;
-import org.apache.poi.hslf.HSLFSlideShow;
 import org.apache.poi.hslf.exceptions.EncryptedPowerPointFileException;
+import org.apache.poi.hslf.usermodel.HSLFSlideShowImpl;
 import org.apache.poi.poifs.filesystem.DocumentEntry;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 import org.junit.Test;
@@ -72,7 +72,7 @@ public final class TestCurrentUserAtom {
 		new CurrentUserAtom(fs);
 		assertTrue(true); // not yet failed
 		
-		new HSLFSlideShow(fs);
+		new HSLFSlideShowImpl(fs);
 	}
 
 	@Test

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestDocument.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestDocument.java?rev=1692593&r1=1692592&r2=1692593&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestDocument.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestDocument.java Fri Jul 24 21:47:55 2015
@@ -19,7 +19,7 @@ package org.apache.poi.hslf.record;
 
 import junit.framework.TestCase;
 
-import org.apache.poi.hslf.HSLFSlideShow;
+import org.apache.poi.hslf.usermodel.HSLFSlideShowImpl;
 import org.apache.poi.poifs.filesystem.*;
 import org.apache.poi.POIDataSamples;
 
@@ -30,14 +30,14 @@ import org.apache.poi.POIDataSamples;
  */
 public final class TestDocument extends TestCase {
 	// HSLFSlideShow primed on the test data
-	private HSLFSlideShow ss;
+	private HSLFSlideShowImpl ss;
 	// POIFS primed on the test data
 	private POIFSFileSystem pfs;
 
 	public TestDocument() throws Exception {
         POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
 		pfs = new POIFSFileSystem(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
-		ss = new HSLFSlideShow(pfs);
+		ss = new HSLFSlideShowImpl(pfs);
 	}
 
 	private Document getDocRecord() {

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestDocumentEncryption.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestDocumentEncryption.java?rev=1692593&r1=1692592&r2=1692593&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestDocumentEncryption.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestDocumentEncryption.java Fri Jul 24 21:47:55 2015
@@ -33,11 +33,8 @@ import org.apache.poi.hpsf.DocumentSumma
 import org.apache.poi.hpsf.PropertySet;
 import org.apache.poi.hpsf.PropertySetFactory;
 import org.apache.poi.hpsf.SummaryInformation;
-import org.apache.poi.hslf.HSLFSlideShow;
 import org.apache.poi.hslf.exceptions.EncryptedPowerPointFileException;
-import org.apache.poi.hslf.model.Slide;
-import org.apache.poi.hslf.usermodel.PictureData;
-import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.hslf.usermodel.*;
 import org.apache.poi.hssf.record.crypto.Biff8EncryptionKey;
 import org.apache.poi.poifs.crypt.CryptoFunctions;
 import org.apache.poi.poifs.crypt.EncryptionInfo;
@@ -71,8 +68,8 @@ public class TestDocumentEncryption {
         for (String pptFile : encPpts) {
             try {
                 NPOIFSFileSystem fs = new NPOIFSFileSystem(slTests.getFile(pptFile), true);
-                HSLFSlideShow hss = new HSLFSlideShow(fs);
-                new SlideShow(hss);
+                HSLFSlideShowImpl hss = new HSLFSlideShowImpl(fs);
+                new HSLFSlideShow(hss);
                 fs.close();
             } catch (EncryptedPowerPointFileException e) {
                 fail(pptFile+" can't be decrypted");
@@ -85,9 +82,9 @@ public class TestDocumentEncryption {
         String pptFile = "cryptoapi-proc2356.ppt";
         Biff8EncryptionKey.setCurrentUserPassword("crypto");
         NPOIFSFileSystem fs = new NPOIFSFileSystem(slTests.getFile(pptFile), true);
-        HSLFSlideShow hss = new HSLFSlideShow(fs);
+        HSLFSlideShowImpl hss = new HSLFSlideShowImpl(fs);
         // need to cache data (i.e. read all data) before changing the key size
-        PictureData picsExpected[] = hss.getPictures();
+        HSLFPictureData picsExpected[] = hss.getPictures();
         hss.getDocumentSummaryInformation();
         EncryptionInfo ei = hss.getDocumentEncryptionAtom().getEncryptionInfo();
         ((CryptoAPIEncryptionHeader)ei.getHeader()).setKeySize(0x78);
@@ -97,8 +94,8 @@ public class TestDocumentEncryption {
         fs.close();
         
         fs = new NPOIFSFileSystem(new ByteArrayInputStream(bos.toByteArray()));
-        hss = new HSLFSlideShow(fs);
-        PictureData picsActual[] = hss.getPictures();
+        hss = new HSLFSlideShowImpl(fs);
+        HSLFPictureData picsActual[] = hss.getPictures();
         fs.close();
         
         assertEquals(picsExpected.length, picsActual.length);
@@ -112,7 +109,7 @@ public class TestDocumentEncryption {
         /* documents with multiple edits need to be normalized for encryption */
         String pptFile = "57272_corrupted_usereditatom.ppt";
         NPOIFSFileSystem fs = new NPOIFSFileSystem(slTests.getFile(pptFile), true);
-        HSLFSlideShow hss = new HSLFSlideShow(fs);
+        HSLFSlideShowImpl hss = new HSLFSlideShowImpl(fs);
         hss.normalizeRecords();
         
         // normalized ppt
@@ -128,7 +125,7 @@ public class TestDocumentEncryption {
         // decrypted
         ByteArrayInputStream bis = new ByteArrayInputStream(encrypted.toByteArray());
         fs = new NPOIFSFileSystem(bis);
-        hss = new HSLFSlideShow(fs);
+        hss = new HSLFSlideShowImpl(fs);
         Biff8EncryptionKey.setCurrentUserPassword(null);
         ByteArrayOutputStream actual = new ByteArrayOutputStream();
         hss.write(actual);
@@ -143,11 +140,12 @@ public class TestDocumentEncryption {
         // http://blogs.msdn.com/b/openspecification/archive/2009/05/08/dominic-salemno.aspx
         Biff8EncryptionKey.setCurrentUserPassword("crypto");
         NPOIFSFileSystem fs = new NPOIFSFileSystem(slTests.getFile("cryptoapi-proc2356.ppt"));
-        HSLFSlideShow hss = new HSLFSlideShow(fs);
-        SlideShow ss = new SlideShow(hss);
+        HSLFSlideShowImpl hss = new HSLFSlideShowImpl(fs);
+        HSLFSlideShow ss = new HSLFSlideShow(hss);
         
-        Slide slide = ss.getSlides()[0];
-        assertEquals("Dominic Salemno", slide.getTextRuns()[0].getText());
+        HSLFSlide slide = ss.getSlides().get(0);
+        String rawText = HSLFTextParagraph.getRawText(slide.getTextParagraphs().get(0));
+        assertEquals("Dominic Salemno", rawText);
 
         String picCmp[][] = {
             {"0","nKsDTKqxTCR8LFkVVWlP9GSTvZ0="},
@@ -160,9 +158,9 @@ public class TestDocumentEncryption {
         };
         
         MessageDigest md = CryptoFunctions.getMessageDigest(HashAlgorithm.sha1);
-        PictureData pd[] = hss.getPictures();
+        HSLFPictureData pd[] = hss.getPictures();
         int i = 0;
-        for (PictureData p : pd) {
+        for (HSLFPictureData p : pd) {
             byte hash[] = md.digest(p.getData());
             assertEquals(Integer.parseInt(picCmp[i][0]), p.getOffset());
             assertEquals(picCmp[i][1], Base64.encodeBase64String(hash));

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExHyperlink.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExHyperlink.java?rev=1692593&r1=1692592&r2=1692593&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExHyperlink.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExHyperlink.java Fri Jul 24 21:47:55 2015
@@ -25,8 +25,8 @@ import java.util.List;
 import junit.framework.AssertionFailedError;
 import junit.framework.TestCase;
 
-import org.apache.poi.hslf.HSLFSlideShow;
-import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.hslf.usermodel.HSLFSlideShow;
+import org.apache.poi.hslf.usermodel.HSLFSlideShowImpl;
 import org.apache.poi.POIDataSamples;
 
 /**
@@ -99,8 +99,8 @@ public final class TestExHyperlink exten
 
 	public void testRealFile() throws Exception {
         POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
-		HSLFSlideShow hss = new HSLFSlideShow(slTests.openResourceAsStream("WithLinks.ppt"));
-		SlideShow ss = new SlideShow(hss);
+		HSLFSlideShowImpl hss = new HSLFSlideShowImpl(slTests.openResourceAsStream("WithLinks.ppt"));
+		HSLFSlideShow ss = new HSLFSlideShow(hss);
 
 		// Get the document
 		Document doc = ss.getDocumentRecord();

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExObjList.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExObjList.java?rev=1692593&r1=1692592&r2=1692593&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExObjList.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExObjList.java Fri Jul 24 21:47:55 2015
@@ -20,8 +20,8 @@ package org.apache.poi.hslf.record;
 
 import junit.framework.TestCase;
 
-import org.apache.poi.hslf.HSLFSlideShow;
-import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.hslf.usermodel.HSLFSlideShow;
+import org.apache.poi.hslf.usermodel.HSLFSlideShowImpl;
 import org.apache.poi.POIDataSamples;
 
 /**
@@ -32,8 +32,8 @@ import org.apache.poi.POIDataSamples;
 public class TestExObjList extends TestCase {
 	public void testRealFile() throws Exception {
         POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
-		HSLFSlideShow hss = new HSLFSlideShow(slTests.openResourceAsStream("WithLinks.ppt"));
-		SlideShow ss = new SlideShow(hss);
+		HSLFSlideShowImpl hss = new HSLFSlideShowImpl(slTests.openResourceAsStream("WithLinks.ppt"));
+		HSLFSlideShow ss = new HSLFSlideShow(hss);
 
 		// Get the document
 		Document doc = ss.getDocumentRecord();

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestRecordContainer.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestRecordContainer.java?rev=1692593&r1=1692592&r2=1692593&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestRecordContainer.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestRecordContainer.java Fri Jul 24 21:47:55 2015
@@ -20,7 +20,7 @@ package org.apache.poi.hslf.record;
 
 import junit.framework.TestCase;
 
-import org.apache.poi.hslf.HSLFSlideShow;
+import org.apache.poi.hslf.usermodel.HSLFSlideShowImpl;
 import org.apache.poi.POIDataSamples;
 
 /**
@@ -149,7 +149,7 @@ public final class TestRecordContainer e
 
 		// Find a real RecordContainer record
         POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
-		HSLFSlideShow hss = new HSLFSlideShow(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
+		HSLFSlideShowImpl hss = new HSLFSlideShowImpl(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
 
 		Record[] r = hss.getRecords();
 		for(int i=0; i<r.length; i++) {

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestSlideAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestSlideAtom.java?rev=1692593&r1=1692592&r2=1692593&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestSlideAtom.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestSlideAtom.java Fri Jul 24 21:47:55 2015
@@ -24,7 +24,7 @@ import java.io.FileOutputStream;
 import junit.framework.TestCase;
 
 import org.apache.poi.hslf.record.SlideAtom.SSlideLayoutAtom;
-import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.hslf.usermodel.HSLFSlideShow;
 
 /**
  * Tests that SlideAtom works properly
@@ -77,16 +77,16 @@ public final class TestSlideAtom extends
 	}
 	
 	public void testSSSlideInfoAtom() throws Exception {
-		SlideShow ss = new SlideShow();
-		org.apache.poi.hslf.model.Slide	slide1 = ss.createSlide(), slide2 = ss.createSlide();
+		HSLFSlideShow ss = new HSLFSlideShow();
+		org.apache.poi.hslf.usermodel.HSLFSlide	slide1 = ss.createSlide(), slide2 = ss.createSlide();
 		slide2.setHidden(true);
 
 		ByteArrayOutputStream bos = new ByteArrayOutputStream(4096);
 		ss.write(bos);
 		ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
-		ss = new SlideShow(bis);
-		slide1 = ss.getSlides()[0];
-		slide2 = ss.getSlides()[1];
+		ss = new HSLFSlideShow(bis);
+		slide1 = ss.getSlides().get(0);
+		slide2 = ss.getSlides().get(1);
 		assertFalse(slide1.getHidden());
 		assertTrue(slide2.getHidden());
 	}

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestSound.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestSound.java?rev=1692593&r1=1692592&r2=1692593&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestSound.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestSound.java Fri Jul 24 21:47:55 2015
@@ -22,7 +22,7 @@ import junit.framework.AssertionFailedEr
 import junit.framework.TestCase;
 
 import org.apache.poi.POIDataSamples;
-import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.hslf.usermodel.HSLFSlideShow;
 
 /**
  * Tests Sound-related records: SoundCollection(2020), Sound(2022) and
@@ -34,7 +34,7 @@ public final class TestSound extends Tes
 	public void testRealFile() throws Exception {
         POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
 
-		SlideShow ppt = new SlideShow(slTests.openResourceAsStream("sound.ppt"));
+		HSLFSlideShow ppt = new HSLFSlideShow(slTests.openResourceAsStream("sound.ppt"));
 
 		// Get the document
 		Document doc = ppt.getDocumentRecord();

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestStyleTextPropAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestStyleTextPropAtom.java?rev=1692593&r1=1692592&r2=1692593&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestStyleTextPropAtom.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestStyleTextPropAtom.java Fri Jul 24 21:47:55 2015
@@ -17,25 +17,22 @@
 
 package org.apache.poi.hslf.record;
 
-import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.*;
 
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
-import java.util.LinkedList;
+import java.util.List;
 
-import junit.framework.TestCase;
-
-import org.apache.poi.hslf.model.textproperties.CharFlagsTextProp;
-import org.apache.poi.hslf.model.textproperties.TextProp;
-import org.apache.poi.hslf.model.textproperties.TextPropCollection;
+import org.apache.poi.hslf.model.textproperties.*;
 import org.apache.poi.util.HexDump;
+import org.junit.Test;
 
 /**
  * Tests that StyleTextPropAtom works properly
  *
  * @author Nick Burch (nick at torchbox dot com)
  */
-public final class TestStyleTextPropAtom extends TestCase {
+public final class TestStyleTextPropAtom {
     /** From a real file: a paragraph with 4 different styles */
     private static final byte[] data_a = new byte[] {
       0, 0, 0xA1-256, 0x0F, 0x2A, 0, 0, 0,
@@ -140,6 +137,7 @@ public final class TestStyleTextPropAtom
     };
     private static final int data_d_text_len = 0xA0-1;
 
+    @Test
     public void testRecordType() {
         StyleTextPropAtom stpa = new StyleTextPropAtom(data_a,0,data_a.length);
         StyleTextPropAtom stpb = new StyleTextPropAtom(data_b,0,data_b.length);
@@ -150,6 +148,7 @@ public final class TestStyleTextPropAtom
     }
 
 
+    @Test
     public void testCharacterStyleCounts() {
         StyleTextPropAtom stpa = new StyleTextPropAtom(data_a,0,data_a.length);
         StyleTextPropAtom stpb = new StyleTextPropAtom(data_b,0,data_b.length);
@@ -164,6 +163,7 @@ public final class TestStyleTextPropAtom
         assertEquals(5, stpb.getCharacterStyles().size());
     }
 
+    @Test
     public void testParagraphStyleCounts() {
         StyleTextPropAtom stpa = new StyleTextPropAtom(data_a,0,data_a.length);
         StyleTextPropAtom stpb = new StyleTextPropAtom(data_b,0,data_b.length);
@@ -179,6 +179,7 @@ public final class TestStyleTextPropAtom
     }
 
 
+    @Test
     public void testCharacterStyleLengths() {
         StyleTextPropAtom stpa = new StyleTextPropAtom(data_a,0,data_a.length);
         StyleTextPropAtom stpb = new StyleTextPropAtom(data_b,0,data_b.length);
@@ -188,7 +189,7 @@ public final class TestStyleTextPropAtom
         stpb.setParentTextSize(data_b_text_len);
 
         // 54 chars, 21 + 17 + 16
-        LinkedList<TextPropCollection> a_ch_l = stpa.getCharacterStyles();
+        List<TextPropCollection> a_ch_l = stpa.getCharacterStyles();
         TextPropCollection a_ch_1 = a_ch_l.get(0);
         TextPropCollection a_ch_2 = a_ch_l.get(1);
         TextPropCollection a_ch_3 = a_ch_l.get(2);
@@ -197,7 +198,7 @@ public final class TestStyleTextPropAtom
         assertEquals(16, a_ch_3.getCharactersCovered());
 
         // 179 chars, 30 + 28 + 25
-        LinkedList<TextPropCollection> b_ch_l = stpb.getCharacterStyles();
+        List<TextPropCollection> b_ch_l = stpb.getCharacterStyles();
         TextPropCollection b_ch_1 = b_ch_l.get(0);
         TextPropCollection b_ch_2 = b_ch_l.get(1);
         TextPropCollection b_ch_3 = b_ch_l.get(2);
@@ -209,11 +210,12 @@ public final class TestStyleTextPropAtom
     }
 
 
+    @Test
     public void testCharacterPropOrdering() {
         StyleTextPropAtom stpb = new StyleTextPropAtom(data_b,0,data_b.length);
         stpb.setParentTextSize(data_b_text_len);
 
-        LinkedList<TextPropCollection> b_ch_l = stpb.getCharacterStyles();
+        List<TextPropCollection> b_ch_l = stpb.getCharacterStyles();
         TextPropCollection b_ch_1 = b_ch_l.get(0);
         TextPropCollection b_ch_2 = b_ch_l.get(1);
         TextPropCollection b_ch_3 = b_ch_l.get(2);
@@ -256,11 +258,12 @@ public final class TestStyleTextPropAtom
         assertEquals(24, tp_4_3.getValue());
     }
 
+    @Test
     public void testParagraphProps() {
         StyleTextPropAtom stpb = new StyleTextPropAtom(data_b,0,data_b.length);
         stpb.setParentTextSize(data_b_text_len);
 
-        LinkedList<TextPropCollection> b_p_l = stpb.getParagraphStyles();
+        List<TextPropCollection> b_p_l = stpb.getParagraphStyles();
         TextPropCollection b_p_1 = b_p_l.get(0);
         TextPropCollection b_p_2 = b_p_l.get(1);
         TextPropCollection b_p_3 = b_p_l.get(2);
@@ -300,11 +303,12 @@ public final class TestStyleTextPropAtom
         assertEquals(80, tp_4_2.getValue());
     }
 
+    @Test
     public void testCharacterProps() {
         StyleTextPropAtom stpb = new StyleTextPropAtom(data_b,0,data_b.length);
         stpb.setParentTextSize(data_b_text_len);
 
-        LinkedList<TextPropCollection> b_ch_l = stpb.getCharacterStyles();
+        List<TextPropCollection> b_ch_l = stpb.getCharacterStyles();
         TextPropCollection b_ch_1 = b_ch_l.get(0);
         TextPropCollection b_ch_2 = b_ch_l.get(1);
         TextPropCollection b_ch_3 = b_ch_l.get(2);
@@ -371,17 +375,19 @@ public final class TestStyleTextPropAtom
         assertEquals(0x0003, cf_4_1.getValue());
     }
 
+    @SuppressWarnings("unused")
+    @Test
     public void testFindAddTextProp() {
         StyleTextPropAtom stpb = new StyleTextPropAtom(data_b,0,data_b.length);
         stpb.setParentTextSize(data_b_text_len);
 
-        LinkedList<TextPropCollection> b_p_l = stpb.getParagraphStyles();
+        List<TextPropCollection> b_p_l = stpb.getParagraphStyles();
         TextPropCollection b_p_1 = b_p_l.get(0);
         TextPropCollection b_p_2 = b_p_l.get(1);
         TextPropCollection b_p_3 = b_p_l.get(2);
         TextPropCollection b_p_4 = b_p_l.get(3);
 
-        LinkedList<TextPropCollection> b_ch_l = stpb.getCharacterStyles();
+        List<TextPropCollection> b_ch_l = stpb.getCharacterStyles();
         TextPropCollection b_ch_1 = b_ch_l.get(0);
         TextPropCollection b_ch_2 = b_ch_l.get(1);
         TextPropCollection b_ch_3 = b_ch_l.get(2);
@@ -425,13 +431,14 @@ public final class TestStyleTextPropAtom
      * Try to recreate an existing StyleTextPropAtom (a) from the empty
      *  constructor, and setting the required properties
      */
+    @Test
     public void testCreateAFromScatch() throws Exception {
         // Start with an empty one
         StyleTextPropAtom stpa = new StyleTextPropAtom(54);
 
         // Don't need to touch the paragraph styles
         // Add two more character styles
-        LinkedList<TextPropCollection> cs = stpa.getCharacterStyles();
+        List<TextPropCollection> cs = stpa.getCharacterStyles();
 
         // First char style is boring, and 21 long
         TextPropCollection tpca = cs.get(0);
@@ -462,13 +469,14 @@ public final class TestStyleTextPropAtom
      * Try to recreate an existing StyleTextPropAtom (b) from the empty
      *  constructor, and setting the required properties
      */
+    @Test
     public void testCreateBFromScatch() throws Exception {
         // Start with an empty one
         StyleTextPropAtom stpa = new StyleTextPropAtom(data_b_text_len);
 
 
         // Need 4 paragraph styles
-        LinkedList<TextPropCollection> ps = stpa.getParagraphStyles();
+        List<TextPropCollection> ps = stpa.getParagraphStyles();
 
         // First is 30 long, left aligned, normal spacing
         TextPropCollection tppa = ps.get(0);
@@ -503,7 +511,7 @@ public final class TestStyleTextPropAtom
 
 
         // Now do 4 character styles
-        LinkedList<TextPropCollection> cs = stpa.getCharacterStyles();
+        List<TextPropCollection> cs = stpa.getCharacterStyles();
 
         // First is 30 long, bold and font size
         TextPropCollection tpca = cs.get(0);
@@ -568,16 +576,16 @@ public final class TestStyleTextPropAtom
         // Compare in detail to b
         StyleTextPropAtom stpb = new StyleTextPropAtom(data_b,0,data_b.length);
         stpb.setParentTextSize(data_b_text_len);
-        LinkedList<TextPropCollection> psb = stpb.getParagraphStyles();
-        LinkedList<TextPropCollection> csb = stpb.getCharacterStyles();
+        List<TextPropCollection> psb = stpb.getParagraphStyles();
+        List<TextPropCollection> csb = stpb.getCharacterStyles();
 
         assertEquals(psb.size(), ps.size());
         assertEquals(csb.size(), cs.size());
 
         // Ensure Paragraph Character styles match
         for(int z=0; z<2; z++) {
-            LinkedList<TextPropCollection> lla = cs;
-            LinkedList<TextPropCollection> llb = csb;
+            List<TextPropCollection> lla = cs;
+            List<TextPropCollection> llb = csb;
             int upto = 5;
             if(z == 1) {
                 lla = ps;
@@ -632,32 +640,46 @@ public final class TestStyleTextPropAtom
         }
     }
 
+    @Test
     public void testWriteA() {
         doReadWrite(data_a, -1);
     }
 
+    @Test
     public void testLoadWriteA() {
         doReadWrite(data_b, data_b_text_len);
     }
 
 
+    @Test
     public void testWriteB() {
         doReadWrite(data_b, -1);
     }
 
+    @Test
     public void testLoadWriteB() {
         doReadWrite(data_b, data_b_text_len);
     }
 
+    @Test
     public void testLoadWriteC() {
-        doReadWrite(data_c, data_c_text_len);
+        // BitMaskTextProperties will sanitize the output
+        byte expected[] = data_c.clone();
+        expected[56] = 0;
+        expected[68] = 0;
+        doReadWrite(data_c, expected, data_c_text_len);
     }
 
+    @Test
     public void testLoadWriteD() {
         doReadWrite(data_d, data_d_text_len);
     }
 
     protected void doReadWrite(byte[] data, int textlen) {
+        doReadWrite(data, data, textlen);
+    }
+    
+    protected void doReadWrite(byte[] data, byte[] expected, int textlen) {
         StyleTextPropAtom stpb = new StyleTextPropAtom(data, 0,data.length);
         if(textlen != -1) stpb.setParentTextSize(textlen);
 
@@ -669,15 +691,16 @@ public final class TestStyleTextPropAtom
         }
         byte[] bytes = out.toByteArray();
 
-        assertEquals(data.length, bytes.length);
+        assertEquals(expected.length, bytes.length);
         try {
-            assertArrayEquals(data, bytes);
+            assertArrayEquals(expected, bytes);
         } catch (Throwable e){
             //print hex dump if failed
-            assertEquals(HexDump.toHex(data), HexDump.toHex(bytes));
+            assertEquals(HexDump.toHex(expected), HexDump.toHex(bytes));
         }
     }
 
+    @Test
     public void testNotEnoughDataProp() {
         // We don't have enough data in the record to cover
         //  all the properties the mask says we have
@@ -691,16 +714,17 @@ public final class TestStyleTextPropAtom
     /**
      * Check the test data for Bug 40143.
      */
-    public void testBug40143() {
+   @Test
+   public void testBug40143() {
         StyleTextPropAtom atom = new StyleTextPropAtom(data_d, 0, data_d.length);
         atom.setParentTextSize(data_d_text_len);
 
-        TextPropCollection prprops = atom.getParagraphStyles().getFirst();
+        TextPropCollection prprops = atom.getParagraphStyles().get(0);
         assertEquals(data_d_text_len+1, prprops.getCharactersCovered());
         assertEquals(1, prprops.getTextPropList().size()); //1 property found
         assertEquals(1, prprops.findByName("alignment").getValue());
 
-        TextPropCollection chprops = atom.getCharacterStyles().getFirst();
+        TextPropCollection chprops = atom.getCharacterStyles().get(0);
         assertEquals(data_d_text_len+1, chprops.getCharactersCovered());
         assertEquals(5, chprops.getTextPropList().size()); //5 properties found
         assertEquals(1, chprops.findByName("char_flags").getValue());
@@ -713,13 +737,15 @@ public final class TestStyleTextPropAtom
     /**
      * Check the test data for Bug 42677.
      */
+     @Test
      public void test42677() {
         int length = 18;
-        byte[] data = {0x00, 0x00, (byte)0xA1, 0x0F, 0x28, 0x00, 0x00, 0x00,
-                       0x13, 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , (byte)0xF1 , 0x20 , 0x00, 0x00 , 0x00 , 0x00 ,
-                       0x22 , 0x20 , 0x00 , 0x00 , 0x64 , 0x00 , 0x00 , 0x00 , 0x00 , (byte)0xFF ,
-                       0x00 , 0x00 , 0x13 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x63 , 0x00 ,
-                       0x00 , 0x00 , 0x01 , 0x00 , 0x00 , 0x00 , 0x0F , 0x00
+        byte[] data = {
+            0x00, 0x00, (byte)0xA1, 0x0F, 0x28, 0x00, 0x00, 0x00,
+            0x13, 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , (byte)0xF1 , 0x20 , 0x00, 0x00 , 0x00 , 0x00 ,
+            0x22 , 0x20 , 0x00 , 0x00 , 0x64 , 0x00 , 0x00 , 0x00 , 0x00 , (byte)0xFF ,
+            0x00 , 0x00 , 0x13 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x63 , 0x00 ,
+            0x00 , 0x00 , 0x01 , 0x00 , 0x00 , 0x00 , 0x0F , 0x00
         };
         doReadWrite(data, length);
 
@@ -737,6 +763,7 @@ public final class TestStyleTextPropAtom
      *   00 00 00 01 18 00 00 01 18 01 00 00 00 01 1C 00 00 01 1C
      * </StyleTextPropAtom>
      */
+     @Test
     public void test45815() {
         int length = 19;
         byte[] data = {
@@ -752,7 +779,13 @@ public final class TestStyleTextPropAtom
                 0x01, 0x18, 0x01, 0x00, 0x00, 0x00, 0x01, 0x1C, 0x00, 0x00,
                 0x01, 0x1C
         };
-        doReadWrite(data, length);
+
+        // changed original data: ... 0x41 and 0x06 don't match
+        // the bitmask text properties will sanitize the bytes and thus the bytes differ
+        byte[] exptected = data.clone();
+        exptected[18] = 0;
+        
+        doReadWrite(data, exptected, length);
     }
 
 }

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextSpecInfoAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextSpecInfoAtom.java?rev=1692593&r1=1692592&r2=1692593&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextSpecInfoAtom.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextSpecInfoAtom.java Fri Jul 24 21:47:55 2015
@@ -42,14 +42,14 @@ public final class TestTextSpecInfoAtom
 
     public void testRead() {
         TextSpecInfoAtom spec = new TextSpecInfoAtom(data_1, 0, data_1.length);
-        TextSpecInfoAtom.TextSpecInfoRun[] run = spec.getTextSpecInfoRuns();
+        TextSpecInfoRun[] run = spec.getTextSpecInfoRuns();
         assertEquals(5, run.length);
 
-        assertEquals(10, run[0].length());
-        assertEquals(1, run[1].length());
-        assertEquals(70, run[2].length());
-        assertEquals(9, run[3].length());
-        assertEquals(32, run[4].length());
+        assertEquals(10, run[0].getLength());
+        assertEquals(1, run[1].getLength());
+        assertEquals(70, run[2].getLength());
+        assertEquals(9, run[3].getLength());
+        assertEquals(32, run[4].getLength());
 
     }
 
@@ -66,10 +66,10 @@ public final class TestTextSpecInfoAtom
         TextSpecInfoAtom spec = new TextSpecInfoAtom(data_1, 0, data_1.length);
         spec.reset(32);  //length of the parent text
 
-        TextSpecInfoAtom.TextSpecInfoRun[] run = spec.getTextSpecInfoRuns();
+        TextSpecInfoRun[] run = spec.getTextSpecInfoRuns();
         assertEquals(1, run.length);
 
-        assertEquals(32, run[0].length());
+        assertEquals(32, run[0].getLength());
 
         //serialize and read again
         ByteArrayOutputStream out = new ByteArrayOutputStream();
@@ -77,9 +77,9 @@ public final class TestTextSpecInfoAtom
 
         byte[] result = out.toByteArray();
         TextSpecInfoAtom spec2 = new TextSpecInfoAtom(result, 0, result.length);
-        TextSpecInfoAtom.TextSpecInfoRun[] run2 = spec2.getTextSpecInfoRuns();
+        TextSpecInfoRun[] run2 = spec2.getTextSpecInfoRuns();
         assertEquals(1, run2.length);
 
-        assertEquals(32, run2[0].length());
+        assertEquals(32, run2[0].getLength());
     }
 }

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTxMasterStyleAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTxMasterStyleAtom.java?rev=1692593&r1=1692592&r2=1692593&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTxMasterStyleAtom.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTxMasterStyleAtom.java Fri Jul 24 21:47:55 2015
@@ -25,7 +25,7 @@ import junit.framework.TestCase;
 
 import org.apache.poi.hslf.model.textproperties.TextProp;
 import org.apache.poi.hslf.model.textproperties.TextPropCollection;
-import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.hslf.usermodel.HSLFSlideShow;
 
 
 /**
@@ -36,10 +36,10 @@ import org.apache.poi.hslf.usermodel.Sli
  * @author Yegor Kozlov
  */
 public final class TestTxMasterStyleAtom extends TestCase {
-    protected SlideShow _ppt;
+    protected HSLFSlideShow _ppt;
 
     public void setUp() {
-        _ppt = new SlideShow();
+        _ppt = new HSLFSlideShow();
     }
 
     public void testDefaultStyles()  {
@@ -84,13 +84,13 @@ public final class TestTxMasterStyleAtom
         TextProp prop;
 
         //paragraph styles
-        props = txmaster.getParagraphStyles()[0];
+        props = txmaster.getParagraphStyles().get(0);
 
         prop = props.findByName("alignment");
         assertEquals(1, prop.getValue()); //title has center alignment
 
         //character styles
-        props = txmaster.getCharacterStyles()[0];
+        props = txmaster.getCharacterStyles().get(0);
 
         prop = props.findByName("font.color");
         assertEquals(0x3000000, prop.getValue());
@@ -110,27 +110,27 @@ public final class TestTxMasterStyleAtom
         TextPropCollection props;
         TextProp prop;
 
-        TextPropCollection[] prstyles = txmaster.getParagraphStyles();
-        TextPropCollection[] chstyles = txmaster.getCharacterStyles();
+        List<TextPropCollection> prstyles = txmaster.getParagraphStyles();
+        List<TextPropCollection> chstyles = txmaster.getCharacterStyles();
         assertEquals("TxMasterStyleAtom for TextHeaderAtom.BODY_TYPE " +
-                "must contain styles for 5 indentation levels", 5, prstyles.length);
+                "must contain styles for 5 indentation levels", 5, prstyles.size());
         assertEquals("TxMasterStyleAtom for TextHeaderAtom.BODY_TYPE " +
-                "must contain styles for 5 indentation levels", 5, chstyles.length);
+                "must contain styles for 5 indentation levels", 5, chstyles.size());
 
         //paragraph styles
-        props = prstyles[0];
+        props = prstyles.get(0);
 
         prop = props.findByName("alignment");
         assertEquals(0, prop.getValue());
 
 
-        for (int i = 0; i < prstyles.length; i++) {
-            assertNotNull("text.offset is null for indentation level " + i, prstyles[i].findByName("text.offset"));
-            assertNotNull("bullet.offset is null for indentation level " + i, prstyles[i].findByName("bullet.offset"));
+        for (int i = 0; i < prstyles.size(); i++) {
+            assertNotNull("text.offset is null for indentation level " + i, prstyles.get(i).findByName("text.offset"));
+            assertNotNull("bullet.offset is null for indentation level " + i, prstyles.get(i).findByName("bullet.offset"));
         }
 
         //character styles
-        props = chstyles[0];
+        props = chstyles.get(0);
 
         prop = props.findByName("font.color");
         assertEquals(0x1000000, prop.getValue());
@@ -150,13 +150,13 @@ public final class TestTxMasterStyleAtom
         TextProp prop;
 
         //paragraph styles
-        props = txmaster.getParagraphStyles()[0];
+        props = txmaster.getParagraphStyles().get(0);
 
         prop = props.findByName("alignment");
         assertEquals(0, prop.getValue());
 
         //character styles
-        props = txmaster.getCharacterStyles()[0];
+        props = txmaster.getCharacterStyles().get(0);
 
         prop = props.findByName("font.color");
         assertEquals(0x1000000, prop.getValue());
@@ -176,13 +176,13 @@ public final class TestTxMasterStyleAtom
         TextProp prop;
 
         //paragraph styles
-        props = txmaster.getParagraphStyles()[0];
+        props = txmaster.getParagraphStyles().get(0);
 
         prop = props.findByName("alignment");
         assertEquals(0, prop.getValue()); //title has center alignment
 
         //character styles
-        props = txmaster.getCharacterStyles()[0];
+        props = txmaster.getCharacterStyles().get(0);
 
         prop = props.findByName("font.color");
         assertEquals(0x1000000, prop.getValue());

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/AllHSLFUserModelTests.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/AllHSLFUserModelTests.java?rev=1692593&r1=1692592&r2=1692593&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/AllHSLFUserModelTests.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/AllHSLFUserModelTests.java Fri Jul 24 21:47:55 2015
@@ -37,7 +37,10 @@ import org.junit.runners.Suite;
     TestSheetText.class,
     TestSlideOrdering.class,
     TestSoundData.class,
-    TestFontRendering.class
+    TestFontRendering.class,
+    TestPicture.class,
+    TestTextRun.class,
+    TestTextShape.class
 })
 public class AllHSLFUserModelTests {
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message