You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ki...@apache.org on 2015/07/24 23:47:58 UTC

svn commit: r1692593 [16/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...

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestPictures.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestPictures.java?rev=1692593&r1=1692592&r2=1692593&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestPictures.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestPictures.java Fri Jul 24 21:47:55 2015
@@ -22,20 +22,12 @@ import static org.junit.Assert.assertArr
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.net.URL;
+import java.util.List;
 
 import junit.framework.TestCase;
 
 import org.apache.poi.POIDataSamples;
-import org.apache.poi.hslf.HSLFSlideShow;
-import org.apache.poi.hslf.blip.DIB;
-import org.apache.poi.hslf.blip.EMF;
-import org.apache.poi.hslf.blip.JPEG;
-import org.apache.poi.hslf.blip.PICT;
-import org.apache.poi.hslf.blip.PNG;
-import org.apache.poi.hslf.blip.WMF;
-import org.apache.poi.hslf.model.Picture;
-import org.apache.poi.hslf.model.Shape;
-import org.apache.poi.hslf.model.Slide;
+import org.apache.poi.hslf.blip.*;
 
 /**
  * Test adding/reading pictures
@@ -51,12 +43,12 @@ public final class TestPictures extends
      * Test read/write Macintosh PICT
      */
     public void testPICT() throws Exception {
-        SlideShow ppt = new SlideShow();
+        HSLFSlideShow ppt = new HSLFSlideShow();
 
-        Slide slide = ppt.createSlide();
+        HSLFSlide slide = ppt.createSlide();
         byte[] src_bytes = slTests.readFile("cow.pict");
-        int idx = ppt.addPicture(src_bytes, Picture.PICT);
-        Picture pict = new Picture(idx);
+        int idx = ppt.addPicture(src_bytes, HSLFPictureShape.PICT);
+        HSLFPictureShape pict = new HSLFPictureShape(idx);
         assertEquals(idx, pict.getPictureIndex());
         slide.addShape(pict);
 
@@ -65,21 +57,21 @@ public final class TestPictures extends
         ppt.write(out);
         out.close();
 
-        ppt = new SlideShow(new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray())));
+        ppt = new HSLFSlideShow(new HSLFSlideShowImpl(new ByteArrayInputStream(out.toByteArray())));
 
         //make sure we can read this picture shape and it refers to the correct picture data
-        Shape[] sh = ppt.getSlides()[0].getShapes();
-        assertEquals(1, sh.length);
-        pict = (Picture)sh[0];
+        List<HSLFShape> sh = ppt.getSlides().get(0).getShapes();
+        assertEquals(1, sh.size());
+        pict = (HSLFPictureShape)sh.get(0);
         assertEquals(idx, pict.getPictureIndex());
 
         //check picture data
-        PictureData[] pictures = ppt.getPictureData();
+        HSLFPictureData[] pictures = ppt.getPictureData();
         //the Picture shape refers to the PictureData object in the Presentation
         assertEquals(pict.getPictureData(), pictures[0]);
 
         assertEquals(1, pictures.length);
-        assertEquals(Picture.PICT, pictures[0].getType());
+        assertEquals(HSLFPictureShape.PICT, pictures[0].getType());
         assertTrue(pictures[0] instanceof PICT);
         //compare the content of the initial file with what is stored in the PictureData
         byte[] ppt_bytes = pictures[0].getData();
@@ -96,12 +88,12 @@ public final class TestPictures extends
      * Test read/write WMF
      */
     public void testWMF() throws Exception {
-        SlideShow ppt = new SlideShow();
+        HSLFSlideShow ppt = new HSLFSlideShow();
 
-        Slide slide = ppt.createSlide();
+        HSLFSlide slide = ppt.createSlide();
         byte[] src_bytes = slTests.readFile("santa.wmf");
-        int idx = ppt.addPicture(src_bytes, Picture.WMF);
-        Picture pict = new Picture(idx);
+        int idx = ppt.addPicture(src_bytes, HSLFPictureShape.WMF);
+        HSLFPictureShape pict = new HSLFPictureShape(idx);
         assertEquals(idx, pict.getPictureIndex());
         slide.addShape(pict);
 
@@ -110,21 +102,21 @@ public final class TestPictures extends
         ppt.write(out);
         out.close();
 
-        ppt = new SlideShow(new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray())));
+        ppt = new HSLFSlideShow(new HSLFSlideShowImpl(new ByteArrayInputStream(out.toByteArray())));
 
         //make sure we can read this picture shape and it refers to the correct picture data
-        Shape[] sh = ppt.getSlides()[0].getShapes();
-        assertEquals(1, sh.length);
-        pict = (Picture)sh[0];
+        List<HSLFShape> sh = ppt.getSlides().get(0).getShapes();
+        assertEquals(1, sh.size());
+        pict = (HSLFPictureShape)sh.get(0);
         assertEquals(idx, pict.getPictureIndex());
 
         //check picture data
-        PictureData[] pictures = ppt.getPictureData();
+        HSLFPictureData[] pictures = ppt.getPictureData();
         //the Picture shape refers to the PictureData object in the Presentation
         assertEquals(pict.getPictureData(), pictures[0]);
 
         assertEquals(1, pictures.length);
-        assertEquals(Picture.WMF, pictures[0].getType());
+        assertEquals(HSLFPictureShape.WMF, pictures[0].getType());
         assertTrue(pictures[0] instanceof WMF);
         //compare the content of the initial file with what is stored in the PictureData
         byte[] ppt_bytes = pictures[0].getData();
@@ -141,13 +133,13 @@ public final class TestPictures extends
      * Test read/write EMF
      */
     public void testEMF() throws Exception {
-        SlideShow ppt = new SlideShow();
+        HSLFSlideShow ppt = new HSLFSlideShow();
 
-        Slide slide = ppt.createSlide();
+        HSLFSlide slide = ppt.createSlide();
         byte[] src_bytes = slTests.readFile("wrench.emf");
-        int idx = ppt.addPicture(src_bytes, Picture.EMF);
+        int idx = ppt.addPicture(src_bytes, HSLFPictureShape.EMF);
 
-        Picture pict = new Picture(idx);
+        HSLFPictureShape pict = new HSLFPictureShape(idx);
         assertEquals(idx, pict.getPictureIndex());
         slide.addShape(pict);
 
@@ -156,21 +148,21 @@ public final class TestPictures extends
         ppt.write(out);
         out.close();
 
-        ppt = new SlideShow(new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray())));
+        ppt = new HSLFSlideShow(new HSLFSlideShowImpl(new ByteArrayInputStream(out.toByteArray())));
 
         //make sure we can get this picture shape and it refers to the correct picture data
-        Shape[] sh = ppt.getSlides()[0].getShapes();
-        assertEquals(1, sh.length);
-        pict = (Picture)sh[0];
+        List<HSLFShape> sh = ppt.getSlides().get(0).getShapes();
+        assertEquals(1, sh.size());
+        pict = (HSLFPictureShape)sh.get(0);
         assertEquals(idx, pict.getPictureIndex());
 
         //check picture data
-        PictureData[] pictures = ppt.getPictureData();
+        HSLFPictureData[] pictures = ppt.getPictureData();
         //the Picture shape refers to the PictureData object in the Presentation
         assertEquals(pict.getPictureData(), pictures[0]);
 
         assertEquals(1, pictures.length);
-        assertEquals(Picture.EMF, pictures[0].getType());
+        assertEquals(HSLFPictureShape.EMF, pictures[0].getType());
         assertTrue(pictures[0] instanceof EMF);
         //compare the content of the initial file with what is stored in the PictureData
         byte[] ppt_bytes = pictures[0].getData();
@@ -181,12 +173,12 @@ public final class TestPictures extends
      * Test read/write PNG
      */
     public void testPNG() throws Exception {
-        SlideShow ppt = new SlideShow();
+        HSLFSlideShow ppt = new HSLFSlideShow();
 
-        Slide slide = ppt.createSlide();
+        HSLFSlide slide = ppt.createSlide();
         byte[] src_bytes = slTests.readFile("tomcat.png");
-        int idx = ppt.addPicture(src_bytes, Picture.PNG);
-        Picture pict = new Picture(idx);
+        int idx = ppt.addPicture(src_bytes, HSLFPictureShape.PNG);
+        HSLFPictureShape pict = new HSLFPictureShape(idx);
         assertEquals(idx, pict.getPictureIndex());
         slide.addShape(pict);
 
@@ -195,21 +187,21 @@ public final class TestPictures extends
         ppt.write(out);
         out.close();
 
-        ppt = new SlideShow(new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray())));
+        ppt = new HSLFSlideShow(new HSLFSlideShowImpl(new ByteArrayInputStream(out.toByteArray())));
 
         //make sure we can read this picture shape and it refers to the correct picture data
-        Shape[] sh = ppt.getSlides()[0].getShapes();
-        assertEquals(1, sh.length);
-        pict = (Picture)sh[0];
+        List<HSLFShape> sh = ppt.getSlides().get(0).getShapes();
+        assertEquals(1, sh.size());
+        pict = (HSLFPictureShape)sh.get(0);
         assertEquals(idx, pict.getPictureIndex());
 
         //check picture data
-        PictureData[] pictures = ppt.getPictureData();
+        HSLFPictureData[] pictures = ppt.getPictureData();
         //the Picture shape refers to the PictureData object in the Presentation
         assertEquals(pict.getPictureData(), pictures[0]);
 
         assertEquals(1, pictures.length);
-        assertEquals(Picture.PNG, pictures[0].getType());
+        assertEquals(HSLFPictureShape.PNG, pictures[0].getType());
         assertTrue(pictures[0] instanceof PNG);
         //compare the content of the initial file with what is stored in the PictureData
         byte[] ppt_bytes = pictures[0].getData();
@@ -220,13 +212,13 @@ public final class TestPictures extends
      * Test read/write JPEG
      */
     public void testJPEG() throws Exception {
-        SlideShow ppt = new SlideShow();
+        HSLFSlideShow ppt = new HSLFSlideShow();
 
-        Slide slide = ppt.createSlide();
+        HSLFSlide slide = ppt.createSlide();
         byte[] src_bytes = slTests.readFile("clock.jpg");
-        int idx = ppt.addPicture(src_bytes, Picture.JPEG);
+        int idx = ppt.addPicture(src_bytes, HSLFPictureShape.JPEG);
 
-        Picture pict = new Picture(idx);
+        HSLFPictureShape pict = new HSLFPictureShape(idx);
         assertEquals(idx, pict.getPictureIndex());
         slide.addShape(pict);
 
@@ -235,21 +227,21 @@ public final class TestPictures extends
         ppt.write(out);
         out.close();
 
-        ppt = new SlideShow(new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray())));
+        ppt = new HSLFSlideShow(new HSLFSlideShowImpl(new ByteArrayInputStream(out.toByteArray())));
 
         //make sure we can read this picture shape and it refers to the correct picture data
-        Shape[] sh = ppt.getSlides()[0].getShapes();
-        assertEquals(1, sh.length);
-        pict = (Picture)sh[0];
+        List<HSLFShape> sh = ppt.getSlides().get(0).getShapes();
+        assertEquals(1, sh.size());
+        pict = (HSLFPictureShape)sh.get(0);
         assertEquals(idx, pict.getPictureIndex());
 
         //check picture data
-        PictureData[] pictures = ppt.getPictureData();
+        HSLFPictureData[] pictures = ppt.getPictureData();
         //the Picture shape refers to the PictureData object in the Presentation
         assertEquals(pict.getPictureData(), pictures[0]);
 
         assertEquals(1, pictures.length);
-        assertEquals(Picture.JPEG, pictures[0].getType());
+        assertEquals(HSLFPictureShape.JPEG, pictures[0].getType());
         assertTrue(pictures[0] instanceof JPEG);
         //compare the content of the initial file with what is stored in the PictureData
         byte[] ppt_bytes = pictures[0].getData();
@@ -260,12 +252,12 @@ public final class TestPictures extends
      * Test read/write DIB
      */
     public void testDIB() throws Exception {
-        SlideShow ppt = new SlideShow();
+        HSLFSlideShow ppt = new HSLFSlideShow();
 
-        Slide slide = ppt.createSlide();
+        HSLFSlide slide = ppt.createSlide();
         byte[] src_bytes = slTests.readFile("clock.dib");
-        int idx = ppt.addPicture(src_bytes, Picture.DIB);
-        Picture pict = new Picture(idx);
+        int idx = ppt.addPicture(src_bytes, HSLFPictureShape.DIB);
+        HSLFPictureShape pict = new HSLFPictureShape(idx);
         assertEquals(idx, pict.getPictureIndex());
         slide.addShape(pict);
 
@@ -274,21 +266,21 @@ public final class TestPictures extends
         ppt.write(out);
         out.close();
 
-        ppt = new SlideShow(new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray())));
+        ppt = new HSLFSlideShow(new HSLFSlideShowImpl(new ByteArrayInputStream(out.toByteArray())));
 
         //make sure we can read this picture shape and it refers to the correct picture data
-        Shape[] sh = ppt.getSlides()[0].getShapes();
-        assertEquals(1, sh.length);
-        pict = (Picture)sh[0];
+        List<HSLFShape> sh = ppt.getSlides().get(0).getShapes();
+        assertEquals(1, sh.size());
+        pict = (HSLFPictureShape)sh.get(0);
         assertEquals(idx, pict.getPictureIndex());
 
         //check picture data
-        PictureData[] pictures = ppt.getPictureData();
+        HSLFPictureData[] pictures = ppt.getPictureData();
         //the Picture shape refers to the PictureData object in the Presentation
         assertEquals(pict.getPictureData(), pictures[0]);
 
         assertEquals(1, pictures.length);
-        assertEquals(Picture.DIB, pictures[0].getType());
+        assertEquals(HSLFPictureShape.DIB, pictures[0].getType());
         assertTrue(pictures[0] instanceof DIB);
         //compare the content of the initial file with what is stored in the PictureData
         byte[] ppt_bytes = pictures[0].getData();
@@ -301,34 +293,34 @@ public final class TestPictures extends
     public void testReadPictures() throws Exception {
 
         byte[] src_bytes, ppt_bytes, b1, b2;
-        Picture pict;
-        PictureData pdata;
+        HSLFPictureShape pict;
+        HSLFPictureData pdata;
 
-        SlideShow ppt = new SlideShow(slTests.openResourceAsStream("pictures.ppt"));
-        Slide[] slides = ppt.getSlides();
-        PictureData[] pictures = ppt.getPictureData();
+        HSLFSlideShow ppt = new HSLFSlideShow(slTests.openResourceAsStream("pictures.ppt"));
+        List<HSLFSlide> slides = ppt.getSlides();
+        HSLFPictureData[] pictures = ppt.getPictureData();
         assertEquals(5, pictures.length);
 
-        pict = (Picture)slides[0].getShapes()[0]; //the first slide contains JPEG
+        pict = (HSLFPictureShape)slides.get(0).getShapes().get(0); //the first slide contains JPEG
         pdata = pict.getPictureData();
         assertTrue(pdata instanceof JPEG);
-        assertEquals(Picture.JPEG, pdata.getType());
+        assertEquals(HSLFPictureShape.JPEG, pdata.getType());
         src_bytes = pdata.getData();
         ppt_bytes = slTests.readFile("clock.jpg");
         assertArrayEquals(src_bytes, ppt_bytes);
 
-        pict = (Picture)slides[1].getShapes()[0]; //the second slide contains PNG
+        pict = (HSLFPictureShape)slides.get(1).getShapes().get(0); //the second slide contains PNG
         pdata = pict.getPictureData();
         assertTrue(pdata instanceof PNG);
-        assertEquals(Picture.PNG, pdata.getType());
+        assertEquals(HSLFPictureShape.PNG, pdata.getType());
         src_bytes = pdata.getData();
         ppt_bytes = slTests.readFile("tomcat.png");
         assertArrayEquals(src_bytes, ppt_bytes);
 
-        pict = (Picture)slides[2].getShapes()[0]; //the third slide contains WMF
+        pict = (HSLFPictureShape)slides.get(2).getShapes().get(0); //the third slide contains WMF
         pdata = pict.getPictureData();
         assertTrue(pdata instanceof WMF);
-        assertEquals(Picture.WMF, pdata.getType());
+        assertEquals(HSLFPictureShape.WMF, pdata.getType());
         src_bytes = pdata.getData();
         ppt_bytes = slTests.readFile("santa.wmf");
         assertEquals(src_bytes.length, ppt_bytes.length);
@@ -339,10 +331,10 @@ public final class TestPictures extends
         System.arraycopy(ppt_bytes, 22, b2, 0, b2.length);
         assertArrayEquals(b1, b2);
 
-        pict = (Picture)slides[3].getShapes()[0]; //the forth slide contains PICT
+        pict = (HSLFPictureShape)slides.get(3).getShapes().get(0); //the forth slide contains PICT
         pdata = pict.getPictureData();
         assertTrue(pdata instanceof PICT);
-        assertEquals(Picture.PICT, pdata.getType());
+        assertEquals(HSLFPictureShape.PICT, pdata.getType());
         src_bytes = pdata.getData();
         ppt_bytes = slTests.readFile("cow.pict");
         assertEquals(src_bytes.length, ppt_bytes.length);
@@ -353,10 +345,10 @@ public final class TestPictures extends
         System.arraycopy(ppt_bytes, 512, b2, 0, b2.length);
         assertArrayEquals(b1, b2);
 
-        pict = (Picture)slides[4].getShapes()[0]; //the fifth slide contains EMF
+        pict = (HSLFPictureShape)slides.get(4).getShapes().get(0); //the fifth slide contains EMF
         pdata = pict.getPictureData();
         assertTrue(pdata instanceof EMF);
-        assertEquals(Picture.EMF, pdata.getType());
+        assertEquals(HSLFPictureShape.EMF, pdata.getType());
         src_bytes = pdata.getData();
         ppt_bytes = slTests.readFile("wrench.emf");
         assertArrayEquals(src_bytes, ppt_bytes);
@@ -368,33 +360,33 @@ public final class TestPictures extends
 	 *  crazy pictures of type 0, we do our best.
 	 */
 	public void testZeroPictureType() throws Exception {
-		HSLFSlideShow hslf = new HSLFSlideShow(slTests.openResourceAsStream("PictureTypeZero.ppt"));
+		HSLFSlideShowImpl hslf = new HSLFSlideShowImpl(slTests.openResourceAsStream("PictureTypeZero.ppt"));
 
 		// Should still have 2 real pictures
 		assertEquals(2, hslf.getPictures().length);
 		// Both are real pictures, both WMF
-		assertEquals(Picture.WMF, hslf.getPictures()[0].getType());
-		assertEquals(Picture.WMF, hslf.getPictures()[1].getType());
+		assertEquals(HSLFPictureShape.WMF, hslf.getPictures()[0].getType());
+		assertEquals(HSLFPictureShape.WMF, hslf.getPictures()[1].getType());
 
 		// Now test what happens when we use the SlideShow interface
-		SlideShow ppt = new SlideShow(hslf);
-        Slide[] slides = ppt.getSlides();
-        PictureData[] pictures = ppt.getPictureData();
-        assertEquals(12, slides.length);
+		HSLFSlideShow ppt = new HSLFSlideShow(hslf);
+        List<HSLFSlide> slides = ppt.getSlides();
+        HSLFPictureData[] pictures = ppt.getPictureData();
+        assertEquals(12, slides.size());
         assertEquals(2, pictures.length);
 
-		Picture pict;
-		PictureData pdata;
+		HSLFPictureShape pict;
+		HSLFPictureData pdata;
 
-        pict = (Picture)slides[0].getShapes()[1]; // 2nd object on 1st slide
+        pict = (HSLFPictureShape)slides.get(0).getShapes().get(1); // 2nd object on 1st slide
         pdata = pict.getPictureData();
         assertTrue(pdata instanceof WMF);
-        assertEquals(Picture.WMF, pdata.getType());
+        assertEquals(HSLFPictureShape.WMF, pdata.getType());
 
-        pict = (Picture)slides[0].getShapes()[2]; // 3rd object on 1st slide
+        pict = (HSLFPictureShape)slides.get(0).getShapes().get(2); // 3rd object on 1st slide
         pdata = pict.getPictureData();
         assertTrue(pdata instanceof WMF);
-        assertEquals(Picture.WMF, pdata.getType());
+        assertEquals(HSLFPictureShape.WMF, pdata.getType());
 	}
 
     /**
@@ -404,42 +396,42 @@ public final class TestPictures extends
 	public void disabled_testZeroPictureLength() throws Exception {
         // take the data from www instead of test directory
         URL url = new URL("http://www.cs.sfu.ca/~anoop/courses/CMPT-882-Fall-2002/chris.ppt");
-		HSLFSlideShow hslf = new HSLFSlideShow(url.openStream());
+		HSLFSlideShowImpl hslf = new HSLFSlideShowImpl(url.openStream());
 
 		// Should still have 2 real pictures
 		assertEquals(2, hslf.getPictures().length);
 		// Both are real pictures, both WMF
-		assertEquals(Picture.WMF, hslf.getPictures()[0].getType());
-		assertEquals(Picture.WMF, hslf.getPictures()[1].getType());
+		assertEquals(HSLFPictureShape.WMF, hslf.getPictures()[0].getType());
+		assertEquals(HSLFPictureShape.WMF, hslf.getPictures()[1].getType());
 
 		// Now test what happens when we use the SlideShow interface
-		SlideShow ppt = new SlideShow(hslf);
-        Slide[] slides = ppt.getSlides();
-        PictureData[] pictures = ppt.getPictureData();
-        assertEquals(27, slides.length);
+		HSLFSlideShow ppt = new HSLFSlideShow(hslf);
+        List<HSLFSlide> slides = ppt.getSlides();
+        HSLFPictureData[] pictures = ppt.getPictureData();
+        assertEquals(27, slides.size());
         assertEquals(2, pictures.length);
 
-		Picture pict;
-		PictureData pdata;
+		HSLFPictureShape pict;
+		HSLFPictureData pdata;
 
-        pict = (Picture)slides[6].getShapes()[13];
+        pict = (HSLFPictureShape)slides.get(6).getShapes().get(13);
         pdata = pict.getPictureData();
         assertTrue(pdata instanceof WMF);
-        assertEquals(Picture.WMF, pdata.getType());
+        assertEquals(HSLFPictureShape.WMF, pdata.getType());
 
-        pict = (Picture)slides[7].getShapes()[13];
+        pict = (HSLFPictureShape)slides.get(7).getShapes().get(13);
         pdata = pict.getPictureData();
         assertTrue(pdata instanceof WMF);
-        assertEquals(Picture.WMF, pdata.getType());
+        assertEquals(HSLFPictureShape.WMF, pdata.getType());
 
         //add a new picture, it should be correctly appended to the Pictures stream
         ByteArrayOutputStream out = new ByteArrayOutputStream();
-        for(PictureData p : pictures) p.write(out);
+        for(HSLFPictureData p : pictures) p.write(out);
         out.close();
 
         int streamSize = out.size();
 
-        PictureData data = PictureData.create(Picture.JPEG);
+        HSLFPictureData data = HSLFPictureData.create(HSLFPictureShape.JPEG);
         data.setData(new byte[100]);
         int offset = hslf.addPicture(data);
         assertEquals(streamSize, offset);
@@ -448,20 +440,20 @@ public final class TestPictures extends
     }
 
     public void testGetPictureName() throws Exception {
-        SlideShow ppt = new SlideShow(slTests.openResourceAsStream("ppt_with_png.ppt"));
-        Slide slide = ppt.getSlides()[0];
+        HSLFSlideShow ppt = new HSLFSlideShow(slTests.openResourceAsStream("ppt_with_png.ppt"));
+        HSLFSlide slide = ppt.getSlides().get(0);
 
-        Picture p = (Picture)slide.getShapes()[0]; //the first slide contains JPEG
+        HSLFPictureShape p = (HSLFPictureShape)slide.getShapes().get(0); //the first slide contains JPEG
         assertEquals("test", p.getPictureName());
     }
 
     public void testSetPictureName() throws Exception {
-        SlideShow ppt = new SlideShow();
+        HSLFSlideShow ppt = new HSLFSlideShow();
 
-        Slide slide = ppt.createSlide();
+        HSLFSlide slide = ppt.createSlide();
         byte[] img = slTests.readFile("tomcat.png");
-        int idx = ppt.addPicture(img, Picture.PNG);
-        Picture pict = new Picture(idx);
+        int idx = ppt.addPicture(img, HSLFPictureShape.PNG);
+        HSLFPictureShape pict = new HSLFPictureShape(idx);
         pict.setPictureName("tomcat.png");
         slide.addShape(pict);
 
@@ -470,9 +462,9 @@ public final class TestPictures extends
         ppt.write(out);
         out.close();
 
-        ppt = new SlideShow(new ByteArrayInputStream(out.toByteArray()));
+        ppt = new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray()));
 
-        Picture p = (Picture)ppt.getSlides()[0].getShapes()[0];
+        HSLFPictureShape p = (HSLFPictureShape)ppt.getSlides().get(0).getShapes().get(0);
         assertEquals("tomcat.png", p.getPictureName());
     }
 }

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestReOrderingSlides.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestReOrderingSlides.java?rev=1692593&r1=1692592&r2=1692593&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestReOrderingSlides.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestReOrderingSlides.java Fri Jul 24 21:47:55 2015
@@ -18,55 +18,58 @@
 package org.apache.poi.hslf.usermodel;
 
 
+import static org.junit.Assert.assertEquals;
+
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 
-import junit.framework.TestCase;
-import org.apache.poi.hslf.*;
-import org.apache.poi.hslf.model.*;
 import org.apache.poi.POIDataSamples;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * Tests that SlideShow can re-order slides properly
  *
  * @author Nick Burch (nick at torchbox dot com)
  */
-public final class TestReOrderingSlides extends TestCase {
+public final class TestReOrderingSlides {
 	// A SlideShow with one slide
-	private HSLFSlideShow hss_one;
-	private SlideShow ss_one;
+	private HSLFSlideShowImpl hss_one;
+	private HSLFSlideShow ss_one;
 
 	// A SlideShow with two slides
-	private HSLFSlideShow hss_two;
-	private SlideShow ss_two;
+	private HSLFSlideShowImpl hss_two;
+	private HSLFSlideShow ss_two;
 
 	// A SlideShow with three slides
-	private HSLFSlideShow hss_three;
-	private SlideShow ss_three;
+	private HSLFSlideShowImpl hss_three;
+	private HSLFSlideShow ss_three;
 
 	/**
 	 * Create/open the slideshows
 	 */
+	@Before
 	public void setUp() throws Exception {
         POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
 
-		hss_one = new HSLFSlideShow(slTests.openResourceAsStream("Single_Coloured_Page.ppt"));
-		ss_one = new SlideShow(hss_one);
+		hss_one = new HSLFSlideShowImpl(slTests.openResourceAsStream("Single_Coloured_Page.ppt"));
+		ss_one = new HSLFSlideShow(hss_one);
 
-		hss_two = new HSLFSlideShow(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
-		ss_two = new SlideShow(hss_two);
+		hss_two = new HSLFSlideShowImpl(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
+		ss_two = new HSLFSlideShow(hss_two);
 
-		hss_three = new HSLFSlideShow(slTests.openResourceAsStream("incorrect_slide_order.ppt"));
-		ss_three = new SlideShow(hss_three);
+		hss_three = new HSLFSlideShowImpl(slTests.openResourceAsStream("incorrect_slide_order.ppt"));
+		ss_three = new HSLFSlideShow(hss_three);
 	}
 
 	/**
 	 * Test that we can "re-order" a slideshow with only 1 slide on it
 	 */
+	@Test
 	public void testReOrder1() throws Exception {
 		// Has one slide
-		assertEquals(1, ss_one.getSlides().length);
-		Slide s1 = ss_one.getSlides()[0];
+		assertEquals(1, ss_one.getSlides().size());
+		HSLFSlide s1 = ss_one.getSlides().get(0);
 
 		// Check slide 1 is as expected
 		assertEquals(256, s1._getSheetNumber());
@@ -81,14 +84,14 @@ public final class TestReOrderingSlides
 		hss_one.write(baos);
 		ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
 
-		HSLFSlideShow hss_read = new HSLFSlideShow(bais);
-		SlideShow ss_read = new SlideShow(hss_read);
+		HSLFSlideShowImpl hss_read = new HSLFSlideShowImpl(bais);
+		HSLFSlideShow ss_read = new HSLFSlideShow(hss_read);
 
 		// Check it still has 1 slide
-		assertEquals(1, ss_read.getSlides().length);
+		assertEquals(1, ss_read.getSlides().size());
 
 		// And check it's as expected
-		s1 = ss_read.getSlides()[0];
+		s1 = ss_read.getSlides().get(0);
 		assertEquals(256, s1._getSheetNumber());
 		assertEquals(3, s1._getSheetRefId());
 		assertEquals(1, s1.getSlideNumber());
@@ -98,11 +101,12 @@ public final class TestReOrderingSlides
 	 * Test doing a dummy re-order on a slideshow with
 	 *  two slides in it
 	 */
+    @Test
 	public void testReOrder2() throws Exception {
 		// Has two slides
-		assertEquals(2, ss_two.getSlides().length);
-		Slide s1 = ss_two.getSlides()[0];
-		Slide s2 = ss_two.getSlides()[1];
+		assertEquals(2, ss_two.getSlides().size());
+		HSLFSlide s1 = ss_two.getSlides().get(0);
+		HSLFSlide s2 = ss_two.getSlides().get(1);
 
 		// Check slide 1 is as expected
 		assertEquals(256, s1._getSheetNumber());
@@ -121,15 +125,15 @@ public final class TestReOrderingSlides
 		hss_two.write(baos);
 		ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
 
-		HSLFSlideShow hss_read = new HSLFSlideShow(bais);
-		SlideShow ss_read = new SlideShow(hss_read);
+		HSLFSlideShowImpl hss_read = new HSLFSlideShowImpl(bais);
+		HSLFSlideShow ss_read = new HSLFSlideShow(hss_read);
 
 		// Check it still has 2 slides
-		assertEquals(2, ss_read.getSlides().length);
+		assertEquals(2, ss_read.getSlides().size());
 
 		// And check it's as expected
-		s1 = ss_read.getSlides()[0];
-		s2 = ss_read.getSlides()[1];
+		s1 = ss_read.getSlides().get(0);
+		s2 = ss_read.getSlides().get(1);
 		assertEquals(256, s1._getSheetNumber());
 		assertEquals(4, s1._getSheetRefId());
 		assertEquals(1, s1.getSlideNumber());
@@ -141,11 +145,12 @@ public final class TestReOrderingSlides
 	/**
 	 * Test re-ordering slides in a slideshow with 2 slides on it
 	 */
+    @Test
 	public void testReOrder2swap() throws Exception {
 		// Has two slides
-		assertEquals(2, ss_two.getSlides().length);
-		Slide s1 = ss_two.getSlides()[0];
-		Slide s2 = ss_two.getSlides()[1];
+		assertEquals(2, ss_two.getSlides().size());
+		HSLFSlide s1 = ss_two.getSlides().get(0);
+		HSLFSlide s2 = ss_two.getSlides().get(1);
 
 		// Check slide 1 is as expected
 		assertEquals(256, s1._getSheetNumber());
@@ -164,15 +169,15 @@ public final class TestReOrderingSlides
 		hss_two.write(baos);
 		ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
 
-		HSLFSlideShow hss_read = new HSLFSlideShow(bais);
-		SlideShow ss_read = new SlideShow(hss_read);
+		HSLFSlideShowImpl hss_read = new HSLFSlideShowImpl(bais);
+		HSLFSlideShow ss_read = new HSLFSlideShow(hss_read);
 
 		// Check it still has 2 slides
-		assertEquals(2, ss_read.getSlides().length);
+		assertEquals(2, ss_read.getSlides().size());
 
 		// And check it's as expected
-		s1 = ss_read.getSlides()[0];
-		s2 = ss_read.getSlides()[1];
+		s1 = ss_read.getSlides().get(0);
+		s2 = ss_read.getSlides().get(1);
 		assertEquals(257, s1._getSheetNumber());
 		assertEquals(6, s1._getSheetRefId());
 		assertEquals(1, s1.getSlideNumber());
@@ -185,12 +190,13 @@ public final class TestReOrderingSlides
 	 * Test doing a dummy re-order on a slideshow with
 	 *  three slides in it
 	 */
+    @Test
 	public void testReOrder3() throws Exception {
 		// Has three slides
-		assertEquals(3, ss_three.getSlides().length);
-		Slide s1 = ss_three.getSlides()[0];
-		Slide s2 = ss_three.getSlides()[1];
-		Slide s3 = ss_three.getSlides()[2];
+		assertEquals(3, ss_three.getSlides().size());
+		HSLFSlide s1 = ss_three.getSlides().get(0);
+		HSLFSlide s2 = ss_three.getSlides().get(1);
+		HSLFSlide s3 = ss_three.getSlides().get(2);
 
 		// Check slide 1 is as expected
 		assertEquals(256, s1._getSheetNumber());
@@ -213,16 +219,16 @@ public final class TestReOrderingSlides
 		hss_three.write(baos);
 		ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
 
-		HSLFSlideShow hss_read = new HSLFSlideShow(bais);
-		SlideShow ss_read = new SlideShow(hss_read);
+		HSLFSlideShowImpl hss_read = new HSLFSlideShowImpl(bais);
+		HSLFSlideShow ss_read = new HSLFSlideShow(hss_read);
 
 		// Check it still has 3 slides
-		assertEquals(3, ss_read.getSlides().length);
+		assertEquals(3, ss_read.getSlides().size());
 
 		// And check it's as expected
-		s1 = ss_read.getSlides()[0];
-		s2 = ss_read.getSlides()[1];
-		s3 = ss_read.getSlides()[2];
+		s1 = ss_read.getSlides().get(0);
+		s2 = ss_read.getSlides().get(1);
+		s3 = ss_read.getSlides().get(2);
 
 		assertEquals(256, s1._getSheetNumber());
 		assertEquals(3, s1._getSheetRefId());
@@ -238,12 +244,13 @@ public final class TestReOrderingSlides
 	/**
 	 * Test re-ordering slides in a slideshow with 3 slides on it
 	 */
+    @Test
 	public void testReOrder3swap() throws Exception {
 		// Has three slides
-		assertEquals(3, ss_three.getSlides().length);
-		Slide s1 = ss_three.getSlides()[0];
-		Slide s2 = ss_three.getSlides()[1];
-		Slide s3 = ss_three.getSlides()[2];
+		assertEquals(3, ss_three.getSlides().size());
+		HSLFSlide s1 = ss_three.getSlides().get(0);
+		HSLFSlide s2 = ss_three.getSlides().get(1);
+		HSLFSlide s3 = ss_three.getSlides().get(2);
 
 		// Check slide 1 is as expected
 		assertEquals(256, s1._getSheetNumber());
@@ -262,25 +269,37 @@ public final class TestReOrderingSlides
 		// (1 -> 2, 2 -> 3)
 		ss_three.reorderSlide(3, 1);
 
+		// refresh the slides
+		s1 = ss_three.getSlides().get(0);
+        s2 = ss_three.getSlides().get(1);
+        s3 = ss_three.getSlides().get(2);
+		
+		assertEquals(1, s1.getSlideNumber());
+        assertEquals(2, s2.getSlideNumber());
+        assertEquals(3, s3.getSlideNumber());
+        
+        assertEquals("Slide 3", ((HSLFTextShape)s1.getShapes().get(0)).getText());
+        assertEquals("Slide 1", ((HSLFTextShape)s3.getShapes().get(0)).getText());
+
 		// Write out, and read back in
 		ByteArrayOutputStream baos = new ByteArrayOutputStream();
 		hss_three.write(baos);
 		ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
 
-		HSLFSlideShow hss_read = new HSLFSlideShow(bais);
-		SlideShow ss_read = new SlideShow(hss_read);
+		HSLFSlideShowImpl hss_read = new HSLFSlideShowImpl(bais);
+		HSLFSlideShow ss_read = new HSLFSlideShow(hss_read);
 
 		// Check it still has 3 slides
-		assertEquals(3, ss_read.getSlides().length);
+		assertEquals(3, ss_read.getSlides().size());
 
 		// And check it's as expected
-		Slide _s1 = ss_read.getSlides()[0];
-		Slide _s2 = ss_read.getSlides()[1];
-		Slide _s3 = ss_read.getSlides()[2];
+		HSLFSlide _s1 = ss_read.getSlides().get(0);
+		HSLFSlide _s2 = ss_read.getSlides().get(1);
+		HSLFSlide _s3 = ss_read.getSlides().get(2);
 
         // 1 --> 3
-        assertEquals(s1._getSheetNumber(), _s3._getSheetNumber());
-		assertEquals(s1._getSheetRefId(), _s3._getSheetRefId());
+        assertEquals(s1._getSheetNumber(), _s1._getSheetNumber());
+		assertEquals(s1._getSheetRefId(), _s1._getSheetRefId());
 		assertEquals(1, s1.getSlideNumber());
 
         // 2nd slide is not updated
@@ -289,8 +308,8 @@ public final class TestReOrderingSlides
 		assertEquals(2, s2.getSlideNumber());
 
         // 3 --> 1
-        assertEquals(s3._getSheetNumber(), _s1._getSheetNumber());
-        assertEquals(s3._getSheetRefId(), _s1._getSheetRefId());
+        assertEquals(s3._getSheetNumber(), _s3._getSheetNumber());
+        assertEquals(s3._getSheetRefId(), _s3._getSheetRefId());
 		assertEquals(3, s3.getSlideNumber());
 	}
 }

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRecordSetup.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRecordSetup.java?rev=1692593&r1=1692592&r2=1692593&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRecordSetup.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRecordSetup.java Fri Jul 24 21:47:55 2015
@@ -17,13 +17,12 @@
 
 package org.apache.poi.hslf.usermodel;
 
+import static org.junit.Assert.assertEquals;
 
-import junit.framework.TestCase;
-import org.apache.poi.hslf.*;
-import org.apache.poi.hslf.record.ParentAwareRecord;
-import org.apache.poi.hslf.record.Record;
-import org.apache.poi.hslf.record.RecordContainer;
 import org.apache.poi.POIDataSamples;
+import org.apache.poi.hslf.record.*;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * Tests that the record setup done by SlideShow
@@ -32,17 +31,20 @@ import org.apache.poi.POIDataSamples;
  *
  * @author Nick Burch (nick at torchbox dot com)
  */
-public final class TestRecordSetup extends TestCase {
+public final class TestRecordSetup {
 	// SlideShow primed on the test data
-	private SlideShow ss;
-	private HSLFSlideShow hss;
+	@SuppressWarnings("unused")
+    private HSLFSlideShow ss;
+	private HSLFSlideShowImpl hss;
 
-	public TestRecordSetup() throws Exception {
+	@Before
+	public void init() throws Exception {
         POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
-		hss = new HSLFSlideShow(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
-		ss = new SlideShow(hss);
+		hss = new HSLFSlideShowImpl(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
+		ss = new HSLFSlideShow(hss);
 	}
 
+	@Test
 	public void testHandleParentAwareRecords() {
 		Record[] records = hss.getRecords();
 		for(int i=0; i<records.length; i++) {

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRichTextRun.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRichTextRun.java?rev=1692593&r1=1692592&r2=1692593&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRichTextRun.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRichTextRun.java Fri Jul 24 21:47:55 2015
@@ -17,89 +17,93 @@
 
 package org.apache.poi.hslf.usermodel;
 
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.FileInputStream;
+import static org.junit.Assert.*;
+import static org.apache.poi.POITestCase.assertContains;
+
+import java.io.*;
+import java.util.List;
 
 import org.apache.poi.POIDataSamples;
-import org.apache.poi.POITestCase;
-import org.apache.poi.hslf.HSLFSlideShow;
-import org.apache.poi.hslf.model.Slide;
-import org.apache.poi.hslf.model.TextBox;
-import org.apache.poi.hslf.model.TextRun;
-import org.apache.poi.hslf.record.Record;
-import org.apache.poi.hslf.record.SlideListWithText;
+import org.apache.poi.hslf.record.*;
+import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
+import org.apache.poi.util.IOUtils;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * Test that the friendly getters and setters on RichTextRun
  *  behave as expected.
  * (model.TestTextRun tests the other functionality)
  */
-public final class TestRichTextRun extends POITestCase {
-   private static POIDataSamples _slTests = POIDataSamples.getSlideShowInstance();
+public final class TestRichTextRun {
+    private static POIDataSamples _slTests = POIDataSamples.getSlideShowInstance();
 
-   // SlideShow primed on the test data
-   private SlideShow ss;
-   private SlideShow ssRichA;
-   private SlideShow ssRichB;
-   private SlideShow ssRichC;
-   private SlideShow ssChinese;
-   private HSLFSlideShow hss;
-   private HSLFSlideShow hssRichA;
-   private HSLFSlideShow hssRichB;
-   private HSLFSlideShow hssRichC;
-   private HSLFSlideShow hssChinese;
-   private static String filenameC;
-
-   protected void setUp() throws Exception {
-      // Basic (non rich) test file
-      hss = new HSLFSlideShow(_slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
-      ss = new SlideShow(hss);
-
-		// Rich test file A
-		hssRichA = new HSLFSlideShow(_slTests.openResourceAsStream("Single_Coloured_Page.ppt"));
-		ssRichA = new SlideShow(hssRichA);
-
-		// Rich test file B
-		hssRichB = new HSLFSlideShow(_slTests.openResourceAsStream("Single_Coloured_Page_With_Fonts_and_Alignments.ppt"));
-		ssRichB = new SlideShow(hssRichB);
-
-		// Rich test file C - has paragraph styles that run out before
-		//   the character ones do
-		filenameC = "ParagraphStylesShorterThanCharStyles.ppt";
-        hssRichC = new HSLFSlideShow(_slTests.openResourceAsStream(filenameC));
-		ssRichC = new SlideShow(hssRichC);
-		
-		// Rich test file with Chinese + English text in it
-      hssChinese = new HSLFSlideShow(_slTests.openResourceAsStream("54880_chinese.ppt"));
-      ssChinese = new SlideShow(hssChinese);
-	}
+    // SlideShow primed on the test data
+    private HSLFSlideShow ss;
+    private HSLFSlideShow ssRichA;
+    private HSLFSlideShow ssRichB;
+    private HSLFSlideShow ssRichC;
+    private HSLFSlideShow ssChinese;
+    private HSLFSlideShowImpl hss;
+    private HSLFSlideShowImpl hssRichA;
+    private HSLFSlideShowImpl hssRichB;
+    private HSLFSlideShowImpl hssRichC;
+    private HSLFSlideShowImpl hssChinese;
+    private static String filenameC;
+
+    @Before
+    public void setUp() throws Exception {
+        // Basic (non rich) test file
+        hss = new HSLFSlideShowImpl(_slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
+        ss = new HSLFSlideShow(hss);
+
+        // Rich test file A
+        hssRichA = new HSLFSlideShowImpl(_slTests.openResourceAsStream("Single_Coloured_Page.ppt"));
+        ssRichA = new HSLFSlideShow(hssRichA);
+        
+        // Rich test file B
+        hssRichB = new HSLFSlideShowImpl(_slTests.openResourceAsStream("Single_Coloured_Page_With_Fonts_and_Alignments.ppt"));
+        ssRichB = new HSLFSlideShow(hssRichB);
+        
+        // Rich test file C - has paragraph styles that run out before
+        //   the character ones do
+        filenameC = "ParagraphStylesShorterThanCharStyles.ppt";
+        hssRichC = new HSLFSlideShowImpl(_slTests.openResourceAsStream(filenameC));
+        ssRichC = new HSLFSlideShow(hssRichC);
+        
+        // Rich test file with Chinese + English text in it
+        hssChinese = new HSLFSlideShowImpl(_slTests.openResourceAsStream("54880_chinese.ppt"));
+        ssChinese = new HSLFSlideShow(hssChinese);
+    }
 
 	/**
 	 * Test the stuff about getting/setting bold
 	 *  on a non rich text run
 	 */
+    @Test
 	public void testBoldNonRich() {
-		Slide slideOne = ss.getSlides()[0];
-		TextRun[] textRuns = slideOne.getTextRuns();
-		RichTextRun rtr = textRuns[0].getRichTextRuns()[0];
+		HSLFSlide slideOne = ss.getSlides().get(0);
+		List<List<HSLFTextParagraph>> textParass = slideOne.getTextParagraphs();
+		List<HSLFTextParagraph> textParas = textParass.get(0);
+		HSLFTextRun rtr = textParas.get(0).getTextRuns().get(0);
 
-		assertNull(rtr._getRawCharacterStyle());
-		assertNull(rtr._getRawParagraphStyle());
+		assertNotNull(rtr.getCharacterStyle());
+		assertNotNull(textParas.get(0).getParagraphStyle());
 		assertFalse(rtr.isBold());
 
 		// Now set it to not bold
 		rtr.setBold(false);
-		//setting bold=false doesn't change the internal state
-		assertNull(rtr._getRawCharacterStyle());
-		assertNull(rtr._getRawParagraphStyle());
+		// in Pre 3.12: setting bold=false doesn't change the internal state
+		// now: also allow explicitly disable styles and there aren't any non rich text runs anymore
+		assertNotNull(rtr.getCharacterStyle());
+		assertNotNull(textParas.get(0).getParagraphStyle());
 
 		assertFalse(rtr.isBold());
 
 		// And now make it bold
 		rtr.setBold(true);
-		assertNotNull(rtr._getRawCharacterStyle());
-		assertNotNull(rtr._getRawParagraphStyle());
+		assertNotNull(rtr.getCharacterStyle());
+        assertNotNull(textParas.get(0).getParagraphStyle());
 		assertTrue(rtr.isBold());
 	}
 
@@ -107,140 +111,141 @@ public final class TestRichTextRun exten
 	 * Test the stuff about getting/setting bold
 	 *  on a rich text run
 	 */
+    @Test
 	public void testBoldRich() {
-		Slide slideOneR = ssRichA.getSlides()[0];
-		TextRun[] textRunsR = slideOneR.getTextRuns();
-		RichTextRun[] rtrs = textRunsR[1].getRichTextRuns();
-		assertEquals(3, rtrs.length);
-
-		assertTrue(rtrs[0].isBold());
-		assertFalse(rtrs[1].isBold());
-		assertFalse(rtrs[2].isBold());
-
-		rtrs[0].setBold(true);
-		rtrs[1].setBold(true);
+		HSLFSlide slideOneR = ssRichA.getSlides().get(0);
+		List<List<HSLFTextParagraph>> textParass = slideOneR.getTextParagraphs();
+		List<HSLFTextParagraph> textParas = textParass.get(1);
+		assertEquals(3, textParas.size());
+
+		assertTrue(textParas.get(0).getTextRuns().get(0).isBold());
+		assertFalse(textParas.get(1).getTextRuns().get(0).isBold());
+		assertFalse(textParas.get(2).getTextRuns().get(0).isBold());
+
+		textParas.get(0).getTextRuns().get(0).setBold(true);
+		textParas.get(1).getTextRuns().get(0).setBold(true);
 
-		assertTrue(rtrs[0].isBold());
-		assertTrue(rtrs[1].isBold());
+		assertTrue(textParas.get(0).getTextRuns().get(0).isBold());
+		assertTrue(textParas.get(1).getTextRuns().get(0).isBold());
 
-		rtrs[0].setBold(false);
-		rtrs[1].setBold(false);
+		textParas.get(0).getTextRuns().get(0).setBold(false);
+		textParas.get(1).getTextRuns().get(0).setBold(false);
 
-		assertFalse(rtrs[0].isBold());
-		assertFalse(rtrs[1].isBold());
+		assertFalse(textParas.get(0).getTextRuns().get(0).isBold());
+		assertFalse(textParas.get(1).getTextRuns().get(0).isBold());
 	}
 
 	/**
 	 * Tests getting and setting the font size on rich and non
 	 *  rich text runs
 	 */
+    @Test
 	public void testFontSize() {
 
-		Slide slideOne = ss.getSlides()[0];
-		TextRun[] textRuns = slideOne.getTextRuns();
-		RichTextRun rtr = textRuns[0].getRichTextRuns()[0];
-
-		Slide slideOneR = ssRichB.getSlides()[0];
-		TextRun[] textRunsR = slideOneR.getTextRuns();
-		RichTextRun rtrRa = textRunsR[0].getRichTextRuns()[0];
-		RichTextRun rtrRb = textRunsR[1].getRichTextRuns()[0];
-		RichTextRun rtrRc = textRunsR[1].getRichTextRuns()[3];
+		HSLFSlide slideOne = ss.getSlides().get(0);
+		List<List<HSLFTextParagraph>> textParass = slideOne.getTextParagraphs();
+		HSLFTextRun rtr = textParass.get(0).get(0).getTextRuns().get(0);
+
+		HSLFSlide slideOneR = ssRichB.getSlides().get(0);
+		List<List<HSLFTextParagraph>> textParassR = slideOneR.getTextParagraphs();
+		HSLFTextRun rtrRa = textParassR.get(0).get(0).getTextRuns().get(0);
+		HSLFTextRun rtrRb = textParassR.get(1).get(0).getTextRuns().get(0);
+		HSLFTextRun rtrRc = textParassR.get(1).get(3).getTextRuns().get(0);
 
 		String defaultFont = "Arial";
 
 		// Start off with rich one
 		// First run has defaults
-		assertEquals(44, rtrRa.getFontSize());
-		assertEquals(defaultFont, rtrRa.getFontName());
+		assertEquals(44, rtrRa.getFontSize(), 0);
+		assertEquals(defaultFont, rtrRa.getFontFamily());
 
 		// Second is size 20, default font
-		assertEquals(20, rtrRb.getFontSize());
-		assertEquals(defaultFont, rtrRb.getFontName());
+		assertEquals(20, rtrRb.getFontSize(), 0);
+		assertEquals(defaultFont, rtrRb.getFontFamily());
 		// Third is size 24, alt font
-		assertEquals(24, rtrRc.getFontSize());
-		assertEquals("Times New Roman", rtrRc.getFontName());
+		assertEquals(24, rtrRc.getFontSize(), 0);
+		assertEquals("Times New Roman", rtrRc.getFontFamily());
 
 		// Change 2nd to different size and font
 		assertEquals(2, ssRichB.getFontCollection().getChildRecords().length); // Default + TNR
-		rtrRb.setFontSize(18);
-		rtrRb.setFontName("Courier");
+		rtrRb.setFontSize(18d);
+		rtrRb.setFontFamily("Courier");
 		assertEquals(3, ssRichB.getFontCollection().getChildRecords().length); // Default + TNR + Courier
-		assertEquals(18, rtrRb.getFontSize());
-		assertEquals("Courier", rtrRb.getFontName());
+		assertEquals(18, rtrRb.getFontSize(), 0);
+		assertEquals("Courier", rtrRb.getFontFamily());
 
 
 		// Now do non rich one
-		assertEquals(44, rtr.getFontSize());
-		assertEquals(defaultFont, rtr.getFontName());
+		assertEquals(44, rtr.getFontSize(), 0);
+		assertEquals(defaultFont, rtr.getFontFamily());
 		assertEquals(1, ss.getFontCollection().getChildRecords().length); // Default
-		assertNull(rtr._getRawCharacterStyle());
-		assertNull(rtr._getRawParagraphStyle());
+		assertNotNull(rtr.getCharacterStyle());
+		assertNotNull(rtr.getTextParagraph().getParagraphStyle());
 
 		// Change Font size
-		rtr.setFontSize(99);
-		assertEquals(99, rtr.getFontSize());
-		assertEquals(defaultFont, rtr.getFontName());
-		assertNotNull(rtr._getRawCharacterStyle());
-		assertNotNull(rtr._getRawParagraphStyle());
+		rtr.setFontSize(99d);
+		assertEquals(99, rtr.getFontSize(), 0);
+		assertEquals(defaultFont, rtr.getFontFamily());
+		assertNotNull(rtr.getCharacterStyle());
+		assertNotNull(rtr.getTextParagraph().getParagraphStyle());
 		assertEquals(1, ss.getFontCollection().getChildRecords().length); // Default
 
 		// Change Font size and name
-		rtr.setFontSize(25);
-		rtr.setFontName("Times New Roman");
-		assertEquals(25, rtr.getFontSize());
-		assertEquals("Times New Roman", rtr.getFontName());
-		assertNotNull(rtr._getRawCharacterStyle());
-		assertNotNull(rtr._getRawParagraphStyle());
+		rtr.setFontSize(25d);
+		rtr.setFontFamily("Times New Roman");
+		assertEquals(25, rtr.getFontSize(), 0);
+		assertEquals("Times New Roman", rtr.getFontFamily());
+		assertNotNull(rtr.getCharacterStyle());
+		assertNotNull(rtr.getTextParagraph().getParagraphStyle());
 		assertEquals(2, ss.getFontCollection().getChildRecords().length);
 	}
 
+    @Test
 	public void testChangeWriteRead() throws Exception {
-		HSLFSlideShow[] h = new HSLFSlideShow[] { hss, hssRichA, hssRichB };
-		Slide[] s = new Slide[] { ss.getSlides()[0], ssRichA.getSlides()[0], ssRichB.getSlides()[0] };
-
-		for(int i=0; i<h.length; i++) {
+		for(HSLFSlideShow h : new HSLFSlideShow[] { ss, ssRichA, ssRichB }) {
 			// Change
-			Slide slideOne = s[i];
-			TextRun[] textRuns = slideOne.getTextRuns();
-			RichTextRun rtr = textRuns[0].getRichTextRuns()[0];
-
+			HSLFSlide slideOne = h.getSlides().get(0);
+			List<List<HSLFTextParagraph>> textParass = slideOne.getTextParagraphs();
+			HSLFTextRun rtr = textParass.get(0).get(0).getTextRuns().get(0);
+			
 			rtr.setBold(true);
-			rtr.setFontSize(18);
-			rtr.setFontName("Courier");
+			rtr.setFontSize(18d);
+			rtr.setFontFamily("Courier");
+            HSLFTextParagraph.storeText(textParass.get(0));
 
 			// Check it took those
-			assertEquals(true, rtr.isBold());
-			assertEquals(18, rtr.getFontSize());
-			assertEquals("Courier", rtr.getFontName());
+			assertTrue(rtr.isBold());
+			assertEquals(18., rtr.getFontSize(), 0);
+			assertEquals("Courier", rtr.getFontFamily());
 
 			// Write out and back in
 			ByteArrayOutputStream baos = new ByteArrayOutputStream();
-			h[i].write(baos);
+			h.write(baos);
 			ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
 
-			HSLFSlideShow readHSLF = new HSLFSlideShow(bais);
-			SlideShow readS = new SlideShow(readHSLF);
+			HSLFSlideShowImpl readHSLF = new HSLFSlideShowImpl(bais);
+			HSLFSlideShow readS = new HSLFSlideShow(readHSLF);
 
 			// Tweak existing one again, to ensure really worked
 			rtr.setBold(false);
-			rtr.setFontSize(17);
-			rtr.setFontName("CourierZZ");
+			rtr.setFontSize(17d);
+			rtr.setFontFamily("CourierZZ");
 
 			// Check it took those changes
-			assertEquals(false, rtr.isBold());
-			assertEquals(17, rtr.getFontSize());
-			assertEquals("CourierZZ", rtr.getFontName());
+			assertFalse(rtr.isBold());
+			assertEquals(17., rtr.getFontSize(), 0);
+			assertEquals("CourierZZ", rtr.getFontFamily());
 
 
 			// Now, look at the one we changed, wrote out, and read back in
 			// Ensure it does contain our original modifications
-			Slide slideOneRR = readS.getSlides()[0];
-			TextRun[] textRunsRR = slideOneRR.getTextRuns();
-			RichTextRun rtrRRa = textRunsRR[0].getRichTextRuns()[0];
-
-			assertEquals(true, rtrRRa.isBold());
-			assertEquals(18, rtrRRa.getFontSize());
-			assertEquals("Courier", rtrRRa.getFontName());
+			HSLFSlide slideOneRR = readS.getSlides().get(0);
+			List<List<HSLFTextParagraph>> textParassRR = slideOneRR.getTextParagraphs();
+			HSLFTextRun rtrRRa = textParassRR.get(0).get(0).getTextRuns().get(0);
+
+			assertTrue(rtrRRa.isBold());
+			assertEquals(18., rtrRRa.getFontSize(), 0);
+			assertEquals("Courier", rtrRRa.getFontFamily());
 		}
 	}
 
@@ -248,16 +253,17 @@ public final class TestRichTextRun exten
 	 * Test that we can do the right things when the paragraph styles
 	 *  run out before the character styles do
 	 */
+    @Test
 	public void testParagraphStylesShorterTheCharStyles() {
 		// Check we have the right number of sheets
-		Slide[] slides = ssRichC.getSlides();
-		assertEquals(14, slides.length);
+		List<HSLFSlide> slides = ssRichC.getSlides();
+		assertEquals(14, slides.size());
 
 		// Check the number of text runs on interesting sheets
-		Slide slideThreeC = ssRichC.getSlides()[2];
-		Slide slideSevenC = ssRichC.getSlides()[6];
-		assertEquals(3, slideThreeC.getTextRuns().length);
-		assertEquals(5, slideSevenC.getTextRuns().length);
+		HSLFSlide slideThreeC = ssRichC.getSlides().get(2);
+		HSLFSlide slideSevenC = ssRichC.getSlides().get(6);
+		assertEquals(4, slideThreeC.getTextParagraphs().size());
+		assertEquals(5, slideSevenC.getTextParagraphs().size());
 
 		// On slide three, we should have:
 		// TR:
@@ -269,32 +275,20 @@ public final class TestRichTextRun exten
 		//   Illustrative Example
 		//   .
 
-		TextRun[] s3tr = slideThreeC.getTextRuns();
-		RichTextRun[] s3rtr0 = s3tr[0].getRichTextRuns();
-		RichTextRun[] s3rtr1 = s3tr[1].getRichTextRuns();
-		RichTextRun[] s3rtr2 = s3tr[2].getRichTextRuns();
-
-		assertEquals(2, s3rtr0.length);
-		assertEquals(1, s3rtr1.length);
-		assertEquals(2, s3rtr2.length);
-
-		assertEquals("You are an important supplier of various items that I need", s3rtr0[0].getText());
-		assertEquals("", s3rtr0[1].getText());
-		assertEquals("Source: Internal focus groups", s3rtr1[0].getText());
-		assertEquals("Illustrative Example", s3rtr2[0].getText());
-		assertEquals("", s3rtr2[1].getText());
-
-		assertTrue(s3rtr0[0]._isParagraphStyleShared());
-		assertTrue(s3rtr0[1]._isParagraphStyleShared());
-		assertFalse(s3rtr1[0]._isParagraphStyleShared());
-		assertTrue(s3rtr2[0]._isParagraphStyleShared());
-		assertTrue(s3rtr2[1]._isParagraphStyleShared());
-
-		assertFalse(s3rtr0[0]._isCharacterStyleShared());
-		assertFalse(s3rtr0[1]._isCharacterStyleShared());
-		assertFalse(s3rtr1[0]._isCharacterStyleShared());
-		assertFalse(s3rtr2[0]._isCharacterStyleShared());
-		assertFalse(s3rtr2[1]._isCharacterStyleShared());
+        List<List<HSLFTextParagraph>> s3tr = slideThreeC.getTextParagraphs();
+		List<HSLFTextRun> s3rtr0 = s3tr.get(0).get(0).getTextRuns();
+		List<HSLFTextRun> s3rtr1 = s3tr.get(2).get(0).getTextRuns();
+		List<HSLFTextRun> s3rtr2 = s3tr.get(3).get(0).getTextRuns();
+
+		assertEquals(2, s3rtr0.size());
+		assertEquals(1, s3rtr1.size());
+		assertEquals(2, s3rtr2.size());
+
+		assertEquals("You are an important supplier of various items that I need", s3rtr0.get(0).getRawText());
+		assertEquals("", s3rtr0.get(1).getRawText());
+		assertEquals("Source: Internal focus groups", s3rtr1.get(0).getRawText());
+		assertEquals("Illustrative Example", s3rtr2.get(0).getRawText());
+		assertEquals("", s3rtr2.get(1).getRawText());
 
 		// On slide seven, we have:
 		// TR:
@@ -303,26 +297,14 @@ public final class TestRichTextRun exten
 		//  <ps>(text a)</ps><ps>(text a)(text b)</ps>
 		// TR:
 		//  (text)
-		TextRun[] s7tr = slideSevenC.getTextRuns();
-		RichTextRun[] s7rtr0 = s7tr[0].getRichTextRuns();
-		RichTextRun[] s7rtr1 = s7tr[1].getRichTextRuns();
-		RichTextRun[] s7rtr2 = s7tr[2].getRichTextRuns();
-
-		assertEquals(1, s7rtr0.length);
-		assertEquals(3, s7rtr1.length);
-		assertEquals(1, s7rtr2.length);
-
-		assertFalse(s7rtr0[0]._isParagraphStyleShared());
-		assertFalse(s7rtr1[0]._isParagraphStyleShared());
-		assertTrue(s7rtr1[1]._isParagraphStyleShared());
-		assertTrue(s7rtr1[2]._isParagraphStyleShared());
-		assertFalse(s7rtr2[0]._isParagraphStyleShared());
-
-		assertFalse(s7rtr0[0]._isCharacterStyleShared());
-		assertTrue(s7rtr1[0]._isCharacterStyleShared());
-		assertTrue(s7rtr1[1]._isCharacterStyleShared());
-		assertFalse(s7rtr1[2]._isCharacterStyleShared());
-		assertFalse(s7rtr2[0]._isCharacterStyleShared());
+		List<List<HSLFTextParagraph>> s7tr = slideSevenC.getTextParagraphs();
+		List<HSLFTextParagraph> s7rtr0 = s7tr.get(0);
+		List<HSLFTextParagraph> s7rtr1 = s7tr.get(1);
+		List<HSLFTextParagraph> s7rtr2 = s7tr.get(2);
+
+		assertEquals(1, s7rtr0.size());
+		assertEquals(8, s7rtr1.size());
+		assertEquals(1, s7rtr2.size());
 	}
 
 	/**
@@ -330,39 +312,44 @@ public final class TestRichTextRun exten
 	 *  run out before the character styles do, when we tweak something
 	 *  and write back out.
 	 */
-	public void testParagraphStylesShorterTheCharStylesWrite() throws Exception {
+    @Test
+	@SuppressWarnings("unused")
+    public void testParagraphStylesShorterTheCharStylesWrite() throws Exception {
 		assertMatchesSLTWC(ssRichC);
 		assertMatchesFileC(ssRichC);
 
-		Slide slideSevenC = ssRichC.getSlides()[6];
-		TextRun[] s7tr = slideSevenC.getTextRuns();
-		RichTextRun[] s7rtr0 = s7tr[0].getRichTextRuns();
-		RichTextRun[] s7rtr1 = s7tr[1].getRichTextRuns();
-		RichTextRun[] s7rtr2 = s7tr[2].getRichTextRuns();
+		HSLFSlide slideSevenC = ssRichC.getSlides().get(6);
+		List<List<HSLFTextParagraph>> s7tr = slideSevenC.getTextParagraphs();
+		List<HSLFTextRun> s7rtr0 = s7tr.get(0).get(0).getTextRuns();
+		List<HSLFTextRun> s7rtr1 = s7tr.get(1).get(0).getTextRuns();
+		List<HSLFTextRun> s7rtr2 = s7tr.get(2).get(0).getTextRuns();
 
 		String oldText;
 
 		// Reset the text on the last run
 		// Need to ensure it's a run that really has styles!
-		oldText = s7rtr2[0].getRawText();
-		s7rtr2[0].setText( oldText );
-		assertEquals(oldText, s7rtr2[0].getText());
-		assertEquals(oldText, s7tr[2].getText());
-		assertEquals(oldText.length() + 1, s7rtr2[0]._getRawCharacterStyle().getCharactersCovered());
-		assertEquals(oldText.length() + 1, s7rtr2[0]._getRawParagraphStyle().getCharactersCovered());
+		oldText = s7rtr2.get(0).getRawText();
+		s7rtr2.get(0).setText( oldText );
+		HSLFTextParagraph.storeText(s7tr.get(2));
+		assertEquals(oldText, s7rtr2.get(0).getRawText());
+		assertEquals(oldText, HSLFTextParagraph.getRawText(s7tr.get(2)));
+		assertEquals(oldText.length() + 1, s7rtr2.get(0).getCharacterStyle().getCharactersCovered());
+		assertEquals(oldText.length() + 1, s7rtr2.get(0).getTextParagraph().getParagraphStyle().getCharactersCovered());
 		assertMatchesSLTWC(ssRichC);
 		assertMatchesFileC(ssRichC);
 
 		// Reset the text on a shared paragraph
-		oldText = s7rtr1[2].getRawText();
-		s7rtr1[2].setText( oldText );
-		assertEquals(oldText, s7rtr1[2].getText());
-		assertEquals(oldText.length() + 1, s7rtr1[2]._getRawCharacterStyle().getCharactersCovered());
+		oldText = s7rtr1.get(0).getRawText();
+		s7rtr1.get(0).setText( oldText );
+        HSLFTextParagraph.storeText(s7tr.get(1));
+		assertEquals(oldText, s7rtr1.get(0).getRawText());
+		assertEquals(oldText.length(), s7rtr1.get(0).getCharacterStyle().getCharactersCovered());
 		assertMatchesSLTWC(ssRichC);
 		assertMatchesFileC(ssRichC);
 
 		// Reset the text on a shared paragraph+character
-		s7rtr1[1].setText( s7rtr1[1].getRawText() );
+		s7rtr1.get(0).setText( s7rtr1.get(0).getRawText() );
+		HSLFTextParagraph.storeText(s7tr.get(1));
 		assertMatchesSLTWC(ssRichC);
 		assertMatchesFileC(ssRichC);
 	}
@@ -374,9 +361,9 @@ public final class TestRichTextRun exten
 	 *  contents.
 	 * @param s
 	 */
-	private void assertMatchesSLTWC(SlideShow s) throws Exception {
+	private void assertMatchesSLTWC(HSLFSlideShow s) throws Exception {
 		// Grab a new copy of slideshow C
-		SlideShow refC = new SlideShow(_slTests.openResourceAsStream(filenameC));
+		HSLFSlideShow refC = new HSLFSlideShow(_slTests.openResourceAsStream(filenameC));
 
 		// Write out the 2nd SLWT in the active document
 		SlideListWithText refSLWT = refC.getDocumentRecord().getSlideListWithTexts()[1];
@@ -394,53 +381,43 @@ public final class TestRichTextRun exten
 
 			byte[] r_rb = writeRecord(ref_r);
 			byte[] s_rb = writeRecord(s_r);
-			assertEquals(r_rb.length, s_rb.length);
-			for(int j=0; j<r_rb.length; j++) {
-				assertEquals(r_rb[j],s_rb[j]);
-			}
+			assertArrayEquals(r_rb, s_rb);
 		}
 
 		// Check the bytes are the same
-		assertEquals(raw_slwt.length, s_slwt.length);
-		for(int i=0; i<raw_slwt.length; i++) {
-			assertEquals(raw_slwt[i], s_slwt[i]);
-		}
+		assertArrayEquals(raw_slwt, s_slwt);
 	}
 
 	/**
 	 * Checks that the supplied slideshow still matches the bytes
 	 *  of slideshow c
 	 */
-	private static void assertMatchesFileC(SlideShow s) throws Exception {
-		if (true) { // TODO - test is disabled, pending fix of bug #39800
-			// System.err.println("Skipping test, as would be marked as failed due to bug #39800"); //
-			return;
-		}
-if(false) {
+	private static void assertMatchesFileC(HSLFSlideShow s) throws Exception {
 		// Grab the bytes of the file
-		FileInputStream fin = new FileInputStream(filenameC);
-		ByteArrayOutputStream fb = new ByteArrayOutputStream();
-		byte[] b = new byte[4096];
-		int read = 0;
-		while(read != -1) {
-			read = fin.read(b);
-			if(read > 0) {
-				fb.write(b, 0, read);
-			}
-		}
-		byte[] raw_file = fb.toByteArray();
+	    NPOIFSFileSystem fs = new NPOIFSFileSystem(_slTests.getFile(filenameC));
+	    ByteArrayOutputStream baos = new ByteArrayOutputStream();
+	    InputStream is = fs.createDocumentInputStream("PowerPoint Document");
+	    IOUtils.copy(is, baos);
+	    is.close();
+	    fs.close();
+	    byte[] raw_file = baos.toByteArray();
 
 		// Now write out the slideshow
-		ByteArrayOutputStream baos = new ByteArrayOutputStream();
+		baos.reset();
 		s.write(baos);
+		fs = new NPOIFSFileSystem(new ByteArrayInputStream(baos.toByteArray()));
+		baos.reset();
+		is = fs.createDocumentInputStream("PowerPoint Document");
+        IOUtils.copy(is, baos);
+        is.close();
+        fs.close();		
 		byte[] raw_ss = baos.toByteArray();
-
+		
+		// different paragraph mask, because of sanitizing
+		raw_ss[169030] = 0x0a;
+		
 		// Ensure they're the same
-		assertEquals(raw_file.length, raw_ss.length);
-		for(int i=0; i<raw_file.length; i++) {
-			assertEquals(raw_file[i], raw_ss[i]);
-		}
-}
+		assertArrayEquals(raw_file, raw_ss);
 	}
 
 	private byte[] writeRecord(Record r) throws Exception {
@@ -449,15 +426,13 @@ if(false) {
 		return baos.toByteArray();
 	}
 
+    @Test
 	public void testIndentationLevel() throws Exception {
-		SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("ParagraphStylesShorterThanCharStyles.ppt"));
-		Slide[] sl = ppt.getSlides();
-		for (int i = 0; i < sl.length; i++) {
-			TextRun[] txt = sl[i].getTextRuns();
-			for (int j = 0; j < txt.length; j++) {
-				RichTextRun[] rt = txt[j].getRichTextRuns();
-				for (int k = 0; k < rt.length; k++) {
-					int indent = rt[k].getIndentLevel();
+		HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream("ParagraphStylesShorterThanCharStyles.ppt"));
+		for (HSLFSlide sl : ppt.getSlides()) {
+			for (List<HSLFTextParagraph> txt : sl.getTextParagraphs()) {
+				for (HSLFTextParagraph p : txt) {
+					int indent = p.getIndentLevel();
 					assertTrue(indent >= 0 && indent <= 4 );
 				}
 
@@ -465,79 +440,85 @@ if(false) {
 		}
 	}
 
+    @Test
 	public void testReadParagraphStyles() throws Exception {
-		SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("bullets.ppt"));
+		HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream("bullets.ppt"));
 		assertTrue("No Exceptions while reading file", true);
 
-		RichTextRun rt;
-		TextRun[] txt;
-		Slide[] slide = ppt.getSlides();
-		assertEquals(2, slide.length);
-
-		txt = slide[0].getTextRuns();
-		assertEquals(2, txt.length);
-
-		assertEquals("Title text", txt[0].getRawText());
-		assertEquals(1, txt[0].getRichTextRuns().length);
-		rt = txt[0].getRichTextRuns()[0];
+		HSLFTextParagraph rt;
+		List<List<HSLFTextParagraph>> txt;
+		List<HSLFSlide> slide = ppt.getSlides();
+		assertEquals(2, slide.size());
+
+		txt = slide.get(0).getTextParagraphs();
+		assertEquals(2, txt.size());
+
+		assertEquals("Title text", HSLFTextParagraph.getRawText(txt.get(0)));
+		assertEquals(1, txt.get(0).size());
+		rt = txt.get(0).get(0);
 		assertFalse(rt.isBullet());
 
-		assertEquals(
-				"This is a text placeholder that \r" +
-				"follows the design pattern\r" +
-				"Defined in the slide master\r" +
-				"and has bullets by default", txt[1].getRawText());
-		assertEquals(1, txt[1].getRichTextRuns().length);
-		rt = txt[1].getRichTextRuns()[0];
-		assertEquals('\u2022', rt.getBulletChar());
+		String expected =
+	        "This is a text placeholder that \r" +
+            "follows the design pattern\r" +
+            "Defined in the slide master\r" +
+            "and has bullets by default";
+		assertEquals(expected, HSLFTextParagraph.getRawText(txt.get(1)));
+		assertEquals(4, txt.get(1).size());
+		rt = txt.get(1).get(0);
+		assertEquals('\u2022', (char)rt.getBulletChar());
 		assertTrue(rt.isBullet());
 
 
-		txt = slide[1].getTextRuns();
-		assertEquals(2, txt.length);
+		txt = slide.get(1).getTextParagraphs();
+		assertEquals(2, txt.size());
 
-		assertEquals(
-				"I\u2019m a text box\r" +
-				"With bullets\r" +
-				"That follow the design pattern\r" +
-				"From the slide master", txt[0].getRawText());
-		assertEquals(1, txt[0].getRichTextRuns().length);
-		rt = txt[0].getRichTextRuns()[0];
+		expected =
+	        "I\u2019m a text box\r" +
+            "With bullets\r" +
+            "That follow the design pattern\r" +
+            "From the slide master";
+		assertEquals(expected, HSLFTextParagraph.getRawText(txt.get(0)));
+		assertEquals(4, txt.get(0).size());
+		rt = txt.get(0).get(0);
 		assertTrue(rt.isBullet());
-		assertEquals('\u2022', rt.getBulletChar());
+		assertEquals('\u2022', (char)rt.getBulletChar());
 
-		assertEquals(
-				"I\u2019m a text box with user-defined\r" +
-				"bullet character", txt[1].getRawText());
-		assertEquals(1, txt[1].getRichTextRuns().length);
-		rt = txt[1].getRichTextRuns()[0];
+		expected =
+            "I\u2019m a text box with user-defined\r" +
+            "bullet character";
+        assertEquals(expected, HSLFTextParagraph.getRawText(txt.get(1)));
+		assertEquals(2, txt.get(1).size());
+		rt = txt.get(1).get(0);
 		assertTrue(rt.isBullet());
-		assertEquals('\u263A', rt.getBulletChar());
+		assertEquals('\u263A', (char)rt.getBulletChar());
 	}
 
+    @Test
 	public void testSetParagraphStyles() throws Exception {
-		SlideShow ppt = new SlideShow();
+		HSLFSlideShow ppt = new HSLFSlideShow();
 
-		Slide slide = ppt.createSlide();
+		HSLFSlide slide = ppt.createSlide();
 
-		TextBox shape = new TextBox();
-		RichTextRun rt = shape.getTextRun().getRichTextRuns()[0];
+		HSLFTextBox shape = new HSLFTextBox();
 		shape.setText(
 				"Hello, World!\r" +
 				"This should be\r" +
 				"Multiline text");
-		rt.setFontSize(42);
+        HSLFTextParagraph rt = shape.getTextParagraphs().get(0);
+        HSLFTextRun tr = rt.getTextRuns().get(0);
+		tr.setFontSize(42d);
 		rt.setBullet(true);
-		rt.setTextOffset(50);
-		rt.setBulletOffset(0);
+		rt.setLeftMargin(50d);
+		rt.setIndent(0d);
 		rt.setBulletChar('\u263A');
 		slide.addShape(shape);
 
-		assertEquals(42, rt.getFontSize());
+		assertEquals(42.0, tr.getFontSize(), 0);
 		assertEquals(true, rt.isBullet());
-		assertEquals(50, rt.getTextOffset());
-		assertEquals(0, rt.getBulletOffset());
-		assertEquals('\u263A', rt.getBulletChar());
+		assertEquals(50.0, rt.getLeftMargin(), 0);
+		assertEquals(0, rt.getIndent(), 0);
+		assertEquals('\u263A', (char)rt.getBulletChar());
 
 		shape.setAnchor(new java.awt.Rectangle(50, 50, 500, 300));
 		slide.addShape(shape);
@@ -547,116 +528,130 @@ if(false) {
 		ppt.write(out);
 		out.close();
 
-		ppt = new SlideShow(new ByteArrayInputStream(out.toByteArray()));
-		slide = ppt.getSlides()[0];
-		shape = (TextBox)slide.getShapes()[0];
-		rt = shape.getTextRun().getRichTextRuns()[0];
-		assertEquals(42, rt.getFontSize());
+		ppt = new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray()));
+		slide = ppt.getSlides().get(0);
+		shape = (HSLFTextBox)slide.getShapes().get(0);
+		rt = shape.getTextParagraphs().get(0);
+		tr = rt.getTextRuns().get(0);
+		assertEquals(42.0, tr.getFontSize(), 0);
 		assertEquals(true, rt.isBullet());
-		assertEquals(50, rt.getTextOffset());
-		assertEquals(0, rt.getBulletOffset());
-		assertEquals('\u263A', rt.getBulletChar());
+		assertEquals(50.0, rt.getLeftMargin(), 0);
+		assertEquals(0, rt.getIndent(), 0);
+		assertEquals('\u263A', (char)rt.getBulletChar());
 	}
 
+    @Test
 	public void testAddText() throws Exception {
-		SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("bullets.ppt"));
+		HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream("bullets.ppt"));
 		assertTrue("No Exceptions while reading file", true);
 
-		RichTextRun rt;
-		TextRun[] txt;
-		Slide[] slides = ppt.getSlides();
-
-		assertEquals(2, slides.length);
-		txt = slides[0].getTextRuns();
-		assertEquals(2, txt.length);
-
-		assertEquals("Title text", txt[0].getRawText());
-		assertEquals(1, txt[0].getRichTextRuns().length);
-		rt = txt[0].getRichTextRuns()[0];
+		HSLFTextParagraph rt;
+		HSLFTextRun tr;
+		List<List<HSLFTextParagraph>> txt;
+		List<HSLFSlide> slides = ppt.getSlides();
+
+		assertEquals(2, slides.size());
+		txt = slides.get(0).getTextParagraphs();
+		assertEquals(2, txt.size());
+
+		assertEquals("Title text", HSLFTextParagraph.getRawText(txt.get(0)));
+		assertEquals(1, txt.get(0).size());
+		rt = txt.get(0).get(0);
 		assertFalse(rt.isBullet());
 
 		// Add some new text
-		txt[0].appendText("Foo! I'm new!");
-		assertEquals(2, txt[0].getRichTextRuns().length);
+		HSLFTextParagraph.appendText(txt.get(0), "Foo! I'm new!", true);
+		assertEquals(2, txt.get(0).size());
 
-		rt = txt[0].getRichTextRuns()[0];
-		assertFalse(rt.isBold());
-		assertEquals("Title text", rt.getText());
-		rt = txt[0].getRichTextRuns()[1];
-		assertFalse(rt.isBold());
-		assertEquals("Foo! I'm new!", rt.getText());
-		rt.setBold(true);
-
-		// And some more
-		txt[0].appendText("Me too!");
-		assertEquals(3, txt[0].getRichTextRuns().length);
-		rt = txt[0].getRichTextRuns()[0];
-		assertFalse(rt.isBold());
-		assertEquals("Title text", rt.getText());
-		rt = txt[0].getRichTextRuns()[1];
-		assertTrue(rt.isBold());
-		assertEquals("Foo! I'm new!", rt.getText());
-		rt = txt[0].getRichTextRuns()[2];
-		assertFalse(rt.isBold());
-		assertEquals("Me too!", rt.getText());
+		rt = txt.get(0).get(0);
+		tr = rt.getTextRuns().get(0);
+		assertFalse(tr.isBold());
+		assertEquals("Title text\r", tr.getRawText());
+		rt = txt.get(0).get(1);
+		tr = rt.getTextRuns().get(0);
+		assertFalse(tr.isBold());
+		assertEquals("Foo! I'm new!", tr.getRawText());
+		tr.setBold(true);
+		HSLFTextParagraph.storeText(txt.get(0));
+
+		// And some more, attributes will be copied from previous run
+		HSLFTextParagraph.appendText(txt.get(0), "Me too!", true);
+		HSLFTextParagraph.storeText(txt.get(0));
+		assertEquals(3, txt.get(0).size());
+		rt = txt.get(0).get(0);
+		tr = rt.getTextRuns().get(0);
+		assertFalse(tr.isBold());
+		assertEquals("Title text\r", tr.getRawText());
+		rt = txt.get(0).get(1);
+		tr = rt.getTextRuns().get(0);
+		assertTrue(tr.isBold());
+		assertEquals("Foo! I'm new!\r", tr.getRawText());
+		rt = txt.get(0).get(2);
+		tr = rt.getTextRuns().get(0);
+		assertTrue(tr.isBold());
+		assertEquals("Me too!", tr.getRawText());
 
 		// Save and re-open
 		ByteArrayOutputStream out = new ByteArrayOutputStream();
 		ppt.write(out);
 		out.close();
 
-		ppt = new SlideShow(new ByteArrayInputStream(out.toByteArray()));
+		ppt = new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray()));
 		slides = ppt.getSlides();
 
-		assertEquals(2, slides.length);
+		assertEquals(2, slides.size());
 
-		txt = slides[0].getTextRuns();
-		assertEquals(2, txt.length);
-		assertEquals(3, txt[0].getRichTextRuns().length);
-		rt = txt[0].getRichTextRuns()[0];
-		assertFalse(rt.isBold());
-		assertEquals("Title text", rt.getText());
-		rt = txt[0].getRichTextRuns()[1];
-		assertTrue(rt.isBold());
-		assertEquals("Foo! I'm new!", rt.getText());
-		rt = txt[0].getRichTextRuns()[2];
-		assertFalse(rt.isBold());
-		assertEquals("Me too!", rt.getText());
+		txt = slides.get(0).getTextParagraphs();
+		assertEquals(2, txt.size());
+		assertEquals(3, txt.get(0).size());
+		rt = txt.get(0).get(0);
+		tr = rt.getTextRuns().get(0);
+		assertFalse(tr.isBold());
+		assertEquals("Title text\r", tr.getRawText());
+		rt = txt.get(0).get(1);
+		tr = rt.getTextRuns().get(0);
+		assertTrue(tr.isBold());
+		assertEquals("Foo! I'm new!\r", tr.getRawText());
+		rt = txt.get(0).get(2);
+		tr = rt.getTextRuns().get(0);
+		assertTrue(tr.isBold());
+		assertEquals("Me too!", tr.getRawText());
 
 //		FileOutputStream fout = new FileOutputStream("/tmp/foo.ppt");
 //		ppt.write(fout);
 	}
 	
+    @Test
 	public void testChineseParagraphs() throws Exception {
-      RichTextRun[] rts;
-      RichTextRun rt;
-      TextRun[] txt;
-      Slide[] slides = ssChinese.getSlides();
+      List<HSLFTextRun> rts;
+      HSLFTextRun rt;
+      List<List<HSLFTextParagraph>> txt;
+      List<HSLFSlide> slides = ssChinese.getSlides();
 
       // One slide
-      assertEquals(1, slides.length);
+      assertEquals(1, slides.size());
       
       // One block of text within that
-      txt = slides[0].getTextRuns();
-      assertEquals(1, txt.length);
+      txt = slides.get(0).getTextParagraphs();
+      assertEquals(1, txt.size());
       
       // One rich block of text in that - text is all the same style
       // TODO Is this completely correct?
-      rts = txt[0].getRichTextRuns();
-      assertEquals(1, rts.length);
-      rt = rts[0];
+      rts = txt.get(0).get(0).getTextRuns();
+      assertEquals(1, rts.size());
+      rt = rts.get(0);
       
       // Check we can get the english text out of that
-      String text = rt.getText();
+      String text = rt.getRawText();
       assertContains(text, "Single byte");
       // And the chinese
-      assertContains(text, "\uff8a\uff9d\uff76\uff78");
+      assertContains(txt.get(0).get(3).getTextRuns().get(0).getRawText(), "\uff8a\uff9d\uff76\uff78");
       
       // It isn't bold or italic
       assertFalse(rt.isBold());
       assertFalse(rt.isItalic());
       
       // Font is Calibri
-      assertEquals("Calibri", rt.getFontName());
+      assertEquals("Calibri", rt.getFontFamily());
 	}
 }

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSheetText.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSheetText.java?rev=1692593&r1=1692592&r2=1692593&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSheetText.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSheetText.java Fri Jul 24 21:47:55 2015
@@ -17,44 +17,50 @@
 
 package org.apache.poi.hslf.usermodel;
 
+import static org.junit.Assert.assertEquals;
+
+import java.util.List;
 
-import junit.framework.TestCase;
-import org.apache.poi.hslf.*;
-import org.apache.poi.hslf.model.*;
 import org.apache.poi.POIDataSamples;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * Tests that SlideShow returns Sheets which have the right text in them
  *
  * @author Nick Burch (nick at torchbox dot com)
  */
-public final class TestSheetText extends TestCase {
+public final class TestSheetText {
 	// SlideShow primed on the test data
-	private SlideShow ss;
+	private HSLFSlideShow ss;
 
-	public TestSheetText() throws Exception {
+	@Before
+	public void init() throws Exception {
         POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
-		HSLFSlideShow hss = new HSLFSlideShow(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
-		ss = new SlideShow(hss);
+		HSLFSlideShowImpl hss = new HSLFSlideShowImpl(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
+		ss = new HSLFSlideShow(hss);
 	}
 
+	@Test
 	public void testSheetOne() {
-		Sheet slideOne = ss.getSlides()[0];
+		HSLFSheet slideOne = ss.getSlides().get(0);
 
-		String[] expectText = new String[] {"This is a test title","This is a test subtitle\nThis is on page 1"};
-		assertEquals(expectText.length, slideOne.getTextRuns().length);
-		for(int i=0; i<expectText.length; i++) {
-			assertEquals(expectText[i], slideOne.getTextRuns()[i].getText());
+		String[] expectText = new String[] {"This is a test title","This is a test subtitle\rThis is on page 1"};
+		assertEquals(expectText.length, slideOne.getTextParagraphs().size());
+		int i = 0;
+		for(List<HSLFTextParagraph> textParas : slideOne.getTextParagraphs()) {
+			assertEquals(expectText[i++], HSLFTextParagraph.getRawText(textParas));
 		}
 	}
 
 	public void testSheetTwo() {
-		Sheet slideTwo = ss.getSlides()[1];
-		String[] expectText = new String[] {"This is the title on page 2","This is page two\nIt has several blocks of text\nNone of them have formatting"};
-		assertEquals(expectText.length, slideTwo.getTextRuns().length);
-		for(int i=0; i<expectText.length; i++) {
-			assertEquals(expectText[i], slideTwo.getTextRuns()[i].getText());
-		}
+		HSLFSheet slideTwo = ss.getSlides().get(1);
+		String[] expectText = new String[] {"This is the title on page 2","This is page two\rIt has several blocks of text\rNone of them have formatting"};
+		assertEquals(expectText.length, slideTwo.getTextParagraphs().size());
+        int i = 0;
+        for(List<HSLFTextParagraph> textParas : slideTwo.getTextParagraphs()) {
+            assertEquals(expectText[i++], HSLFTextParagraph.getRawText(textParas));
+        }
 	}
 
 	/**
@@ -64,15 +70,15 @@ public final class TestSheetText extends
 	 */
 	public void testWithShortTextPropData() throws Exception {
         POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
-		HSLFSlideShow hss = new HSLFSlideShow(slTests.openResourceAsStream("iisd_report.ppt"));
-		SlideShow sss = new SlideShow(hss);
+		HSLFSlideShowImpl hss = new HSLFSlideShowImpl(slTests.openResourceAsStream("iisd_report.ppt"));
+		HSLFSlideShow sss = new HSLFSlideShow(hss);
 
 		// Should come out with 10 slides, no notes
-		assertEquals(10, sss.getSlides().length);
-		assertEquals(0, sss.getNotes().length);
+		assertEquals(10, sss.getSlides().size());
+		assertEquals(0, sss.getNotes().size());
 
 		// Check text on first slide
-		Slide s = sss.getSlides()[0];
+		HSLFSlide s = sss.getSlides().get(0);
 		String exp =
 			"Realizing the Development Dividend:\n" +
 			"Community Capacity Building and CDM.\n" +
@@ -82,7 +88,7 @@ public final class TestSheetText extends
 			"COP 11 \u2013 MOP 1\n" + // special long hyphen
 			"December 5, 2005\n";
 
-		assertEquals(1, s.getTextRuns().length);
-		assertEquals(exp, s.getTextRuns()[0].getText());
+		assertEquals(1, s.getTextParagraphs().size());
+		assertEquals(exp, HSLFTextParagraph.getRawText(s.getTextParagraphs().get(0)));
 	}
 }

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSlideOrdering.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSlideOrdering.java?rev=1692593&r1=1692592&r2=1692593&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSlideOrdering.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSlideOrdering.java Fri Jul 24 21:47:55 2015
@@ -17,62 +17,62 @@
 
 package org.apache.poi.hslf.usermodel;
 
-import junit.framework.TestCase;
-import org.apache.poi.hslf.*;
-import org.apache.poi.hslf.model.*;
+import static org.junit.Assert.assertEquals;
+
+import java.util.List;
+
 import org.apache.poi.POIDataSamples;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * Tests that SlideShow returns Sheets in the right order
  *
  * @author Nick Burch (nick at torchbox dot com)
  */
-public final class TestSlideOrdering extends TestCase {
+public final class TestSlideOrdering {
     private static POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
 
 	// Simple slideshow, record order matches slide order
-	private SlideShow ssA;
+	private HSLFSlideShow ssA;
 	// Complex slideshow, record order doesn't match slide order
-	private SlideShow ssB;
+	private HSLFSlideShow ssB;
 
-	public TestSlideOrdering() throws Exception {
-		HSLFSlideShow hssA = new HSLFSlideShow(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
-		ssA = new SlideShow(hssA);
+	@Before
+	public void init() throws Exception {
+		HSLFSlideShowImpl hssA = new HSLFSlideShowImpl(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
+		ssA = new HSLFSlideShow(hssA);
 
-		HSLFSlideShow hssB = new HSLFSlideShow(slTests.openResourceAsStream("incorrect_slide_order.ppt"));
-		ssB = new SlideShow(hssB);
+		HSLFSlideShowImpl hssB = new HSLFSlideShowImpl(slTests.openResourceAsStream("incorrect_slide_order.ppt"));
+		ssB = new HSLFSlideShow(hssB);
 	}
 
 	/**
 	 * Test the simple case - record order matches slide order
 	 */
+	@Test
 	public void testSimpleCase() {
-		assertEquals(2, ssA.getSlides().length);
+		assertEquals(2, ssA.getSlides().size());
 
-		Slide s1 = ssA.getSlides()[0];
-		Slide s2 = ssA.getSlides()[1];
+		HSLFSlide s1 = ssA.getSlides().get(0);
+		HSLFSlide s2 = ssA.getSlides().get(1);
 
 		String[] firstTRs = new String[] { "This is a test title", "This is the title on page 2" };
 
-		assertEquals(firstTRs[0], s1.getTextRuns()[0].getText());
-		assertEquals(firstTRs[1], s2.getTextRuns()[0].getText());
+		assertEquals(firstTRs[0], HSLFTextParagraph.getRawText(s1.getTextParagraphs().get(0)));
+		assertEquals(firstTRs[1], HSLFTextParagraph.getRawText(s2.getTextParagraphs().get(0)));
 	}
 
 	/**
 	 * Test the complex case - record order differs from slide order
 	 */
+    @Test
 	public void testComplexCase() {
-		assertEquals(3, ssB.getSlides().length);
-
-		Slide s1 = ssB.getSlides()[0];
-		Slide s2 = ssB.getSlides()[1];
-		Slide s3 = ssB.getSlides()[2];
-
-		String[] firstTRs = new String[] { "Slide 1", "Slide 2", "Slide 3" };
-
-		assertEquals(firstTRs[0], s1.getTextRuns()[0].getText());
-		assertEquals(firstTRs[1], s2.getTextRuns()[0].getText());
-		assertEquals(firstTRs[2], s3.getTextRuns()[0].getText());
+		assertEquals(3, ssB.getSlides().size());
+		int i=1;
+		for (HSLFSlide s : ssB.getSlides()) {
+		    assertEquals("Slide "+(i++), HSLFTextParagraph.getRawText(s.getTextParagraphs().get(0)));
+		}
 	}
 
 	/**
@@ -86,16 +86,17 @@ public final class TestSlideOrdering ext
 	protected void assertSlideOrdering(String filename, String[] titles) throws Exception {
         POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
 
-        SlideShow ppt = new SlideShow(slTests.openResourceAsStream(filename));
-		Slide[] slide = ppt.getSlides();
+        HSLFSlideShow ppt = new HSLFSlideShow(slTests.openResourceAsStream(filename));
+		List<HSLFSlide> slide = ppt.getSlides();
 
-		assertEquals(titles.length, slide.length);
-		for (int i = 0; i < slide.length; i++) {
-			String title = slide[i].getTitle();
+		assertEquals(titles.length, slide.size());
+		for (int i = 0; i < slide.size(); i++) {
+			String title = slide.get(i).getTitle();
 			assertEquals("Wrong slide title in " + filename, titles[i], title);
 		}
 	}
 
+    @Test
 	public void testTitles() throws Exception {
 		assertSlideOrdering("basic_test_ppt_file.ppt", new String[] {
 				"This is a test title", "This is the title on page 2" });

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSoundData.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSoundData.java?rev=1692593&r1=1692592&r2=1692593&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSoundData.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSoundData.java Fri Jul 24 21:47:55 2015
@@ -37,9 +37,9 @@ public final class TestSoundData extends
         //read the reference sound file
         byte[] ref_data = slTests.readFile("ringin.wav");
 
-        SlideShow ppt = new SlideShow(slTests.openResourceAsStream("sound.ppt"));
+        HSLFSlideShow ppt = new HSLFSlideShow(slTests.openResourceAsStream("sound.ppt"));
 
-        SoundData[] sound = ppt.getSoundData();
+        HSLFSoundData[] sound = ppt.getSoundData();
         assertEquals("Expected 1 sound", 1, sound.length);
 
         assertArrayEquals(ref_data, sound[0].getData());

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestTable.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestTable.java?rev=1692593&r1=1692592&r2=1692593&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestTable.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestTable.java Fri Jul 24 21:47:55 2015
@@ -19,13 +19,12 @@
 
 package org.apache.poi.hslf.usermodel;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.*;
+
+import java.util.List;
 
-import org.apache.poi.hslf.model.Shape;
-import org.apache.poi.hslf.model.Slide;
-import org.apache.poi.hslf.model.Table;
-import org.apache.poi.hslf.model.TextRun;
 import org.apache.poi.POIDataSamples;
+import org.junit.Test;
 
 
 /**
@@ -33,40 +32,39 @@ import org.apache.poi.POIDataSamples;
  * 
  * @author Alex Nikiforov [mailto:anikif@gmail.com]
  */
-public final class TestTable extends TestCase {
+public class TestTable {
     private static POIDataSamples _slTests = POIDataSamples.getSlideShowInstance();
 
-	protected void setUp() throws Exception {
-	}
-
-	public void testTable() throws Exception {
-		SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("54111.ppt"));
+    @Test
+    public void testTable() throws Exception {
+		HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream("54111.ppt"));
 		assertTrue("No Exceptions while reading file", true);
 
-		final Slide[] slides = ppt.getSlides();
-		assertEquals(1, slides.length);
-		checkSlide(slides[0]);
+		List<HSLFSlide> slides = ppt.getSlides();
+		assertEquals(1, slides.size());
+		checkSlide(slides.get(0));
 	}
-	private void checkSlide(final Slide s) {
-		TextRun[] textRuns = s.getTextRuns();
-		assertEquals(2, textRuns.length);
+	
+	private void checkSlide(final HSLFSlide s) {
+		List<List<HSLFTextParagraph>> textRuns = s.getTextParagraphs();
+		assertEquals(2, textRuns.size());
 
-		RichTextRun textRun = textRuns[0].getRichTextRuns()[0];
+		HSLFTextRun textRun = textRuns.get(0).get(0).getTextRuns().get(0);
 		assertEquals("Table sample", textRun.getRawText().trim());
-		assertEquals(1, textRuns[0].getRichTextRuns().length);
-		assertFalse(textRun.isBullet());
+		assertEquals(1, textRuns.get(0).get(0).getTextRuns().size());
+		assertFalse(textRun.getTextParagraph().isBullet());
 
-		assertEquals("Dummy text", textRuns[1].getRawText());
+		assertEquals("Dummy text", HSLFTextParagraph.getRawText(textRuns.get(1)));
 		
-		final Shape[] shapes = s.getShapes();
+		List<HSLFShape> shapes = s.getShapes();
 		assertNotNull(shapes);
-		assertEquals(3, shapes.length);
-		assertTrue(shapes[2] instanceof Table);
-		final Table table = (Table) shapes[2];
+		assertEquals(3, shapes.size());
+		assertTrue(shapes.get(2) instanceof HSLFTable);
+		final HSLFTable table = (HSLFTable) shapes.get(2);
 		assertEquals(4, table.getNumberOfColumns());
 		assertEquals(6, table.getNumberOfRows());
 		for (int x = 0; x < 4; x ++) {
-			assertEquals("TH Cell " + (x + 1), table.getCell(0, x).getTextRun().getRawText());
+			assertEquals("TH Cell " + (x + 1), HSLFTextParagraph.getRawText(table.getCell(0, x).getTextParagraphs()));
 			for (int y = 1; y < 6; y++) {
 				assertEquals("Row " + y + ", Cell " + (x + 1), table.getCell(y, x).getText());
 			}



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