poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kiwiwi...@apache.org
Subject svn commit: r1682356 [2/2] - in /poi/branches/common_sl/src: examples/src/org/apache/poi/hslf/examples/ java/org/apache/poi/util/ scratchpad/src/org/apache/poi/hslf/model/ scratchpad/src/org/apache/poi/hslf/record/ scratchpad/src/org/apache/poi/hslf/us...
Date Thu, 28 May 2015 23:32:27 GMT
Modified: poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestNumberedList3.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestNumberedList3.java?rev=1682356&r1=1682355&r2=1682356&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestNumberedList3.java (original)
+++ poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestNumberedList3.java Thu May 28 23:32:26 2015
@@ -19,17 +19,15 @@
 
 package org.apache.poi.hslf.usermodel;
 
-import java.util.List;
+import static org.junit.Assert.*;
 
-import junit.framework.TestCase;
+import java.util.List;
 
+import org.apache.poi.POIDataSamples;
 import org.apache.poi.hslf.model.textproperties.TextPFException9;
 import org.apache.poi.hslf.model.textproperties.TextPropCollection;
-import org.apache.poi.hslf.record.EscherTextboxWrapper;
-import org.apache.poi.hslf.record.StyleTextProp9Atom;
-import org.apache.poi.hslf.record.StyleTextPropAtom;
-import org.apache.poi.hslf.record.TextAutoNumberSchemeEnum;
-import org.apache.poi.POIDataSamples;
+import org.apache.poi.hslf.record.*;
+import org.junit.Test;
 
 
 /**
@@ -40,19 +38,17 @@ import org.apache.poi.POIDataSamples;
  * 
  * @author Alex Nikiforov [mailto:anikif@gmail.com]
  */
-public final class TestNumberedList3 extends TestCase {
+public final class TestNumberedList3 {
     private static POIDataSamples _slTests = POIDataSamples.getSlideShowInstance();
 
-	protected void setUp() throws Exception {
-	}
-
-	public void testNumberedList() throws Exception {
+    @Test
+    public void testNumberedList() throws Exception {
 		HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream("numbers3.ppt"));
 		assertTrue("No Exceptions while reading file", true);
 
-		final HSLFSlide[] slides = ppt.getSlides();
-		assertEquals(1, slides.length);
-		final HSLFSlide slide = slides[0];
+		final List<HSLFSlide> slides = ppt.getSlides();
+		assertEquals(1, slides.size());
+		final HSLFSlide slide = slides.get(0);
 		checkSlide(slide);
 	}
 	private void checkSlide(final HSLFSlide s) {
@@ -66,35 +62,32 @@ public final class TestNumberedList3 ext
 		assertEquals(Short.valueOf((short)1), autoNumbersOfTextBox0[0].getAutoNumberStartNumber());//Default value = 1 will be used 
 		assertTrue(TextAutoNumberSchemeEnum.ANM_ArabicPeriod == autoNumbersOfTextBox0[0].getAutoNumberScheme());
 		
-		final HSLFTextParagraph[] textRuns = s.getTextParagraphs();
-		assertEquals(3, textRuns.length);
-		assertEquals("Bulleted list\rMore bullets\rNo bullets here", textRuns[0].getRawText());
-		assertEquals("Numbered list between two bulleted lists\rSecond numbered list item", textRuns[1].getRawText());
-		assertEquals("Second bulleted list \u2013 should appear after numbered list\rMore bullets", textRuns[2].getRawText());
-		assertEquals(2, textRuns[0].getTextRuns().length);
-		assertEquals(1, textRuns[1].getTextRuns().length);
-		assertEquals(1, textRuns[2].getTextRuns().length);
-		assertNull(textRuns[0].getStyleTextProp9Atom());
-		assertNotNull(textRuns[1].getStyleTextProp9Atom());
-		assertNull(textRuns[2].getStyleTextProp9Atom());
-		final TextPFException9[] autoNumbers = textRuns[1].getStyleTextProp9Atom().getAutoNumberTypes();
+		final List<List<HSLFTextParagraph>> textParass = s.getTextParagraphs();
+		assertEquals(3, textParass.size());
+		assertEquals("Bulleted list\rMore bullets\rNo bullets here", HSLFTextParagraph.getRawText(textParass.get(0)));
+		assertEquals("Numbered list between two bulleted lists\rSecond numbered list item", HSLFTextParagraph.getRawText(textParass.get(1)));
+		assertEquals("Second bulleted list \u2013 should appear after numbered list\rMore bullets", HSLFTextParagraph.getRawText(textParass.get(2)));
+		assertEquals(3, textParass.get(0).size());
+		assertEquals(2, textParass.get(1).size());
+		assertEquals(2, textParass.get(2).size());
+		assertNull(textParass.get(0).get(0).getStyleTextProp9Atom());
+		assertNotNull(textParass.get(1).get(0).getStyleTextProp9Atom());
+		assertNull(textParass.get(2).get(0).getStyleTextProp9Atom());
+		final TextPFException9[] autoNumbers = textParass.get(1).get(0).getStyleTextProp9Atom().getAutoNumberTypes();
 		assertEquals(1, autoNumbers.length);
 		assertEquals(Short.valueOf((short)1), autoNumbers[0].getfBulletHasAutoNumber());
 		assertEquals(Short.valueOf((short)1), autoNumbers[0].getAutoNumberStartNumber());//Default value = 1 will be used 
 		assertTrue(TextAutoNumberSchemeEnum.ANM_ArabicPeriod == autoNumbersOfTextBox0[0].getAutoNumberScheme());
 		
-		final List<TextPropCollection> textProps = textRuns[1].getStyleTextPropAtom().getCharacterStyles();
+		final List<TextPropCollection> textProps = textParass.get(1).get(0).getStyleTextPropAtom().getCharacterStyles();
 		assertEquals(1, textProps.size());
 		final TextPropCollection textProp = textProps.get(0);
 		assertEquals(67, textProp.getCharactersCovered());
 		
-		
-		HSLFTextRun textRun = textRuns[0].getTextRuns()[0];
-		assertTrue(textRun.isBullet());
-
+		assertTrue(textParass.get(0).get(0).isBullet());
 		
 		final EscherTextboxWrapper[] styleAtoms = s.getTextboxWrappers();
-		assertEquals(textRuns.length, styleAtoms.length);
+		assertEquals(textParass.size(), styleAtoms.length);
 		checkSingleRunWrapper(43, styleAtoms[0]);
 		checkSingleRunWrapper(67, styleAtoms[1]);
 	}
@@ -102,7 +95,6 @@ public final class TestNumberedList3 ext
 		final StyleTextPropAtom styleTextPropAtom = wrapper.getStyleTextPropAtom();
 		final List<TextPropCollection> textProps = styleTextPropAtom.getCharacterStyles();
 		assertEquals(1, textProps.size());
-		final TextPropCollection[] props = (TextPropCollection[]) textProps.toArray(new TextPropCollection[textProps.size()]);
-		assertEquals(exceptedLength, props[0].getCharactersCovered());
+		assertEquals(exceptedLength, textProps.get(0).getCharactersCovered());
 	}
 }

Copied: poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestPicture.java (from r1678838, poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestPicture.java)
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestPicture.java?p2=poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestPicture.java&p1=poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestPicture.java&r1=1678838&r2=1682356&rev=1682356&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestPicture.java (original)
+++ poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestPicture.java Thu May 28 23:32:26 2015
@@ -15,7 +15,7 @@
    limitations under the License.
 ==================================================================== */
 
-package org.apache.poi.hslf.model;
+package org.apache.poi.hslf.usermodel;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;

Modified: poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestReOrderingSlides.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestReOrderingSlides.java?rev=1682356&r1=1682355&r2=1682356&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestReOrderingSlides.java (original)
+++ poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestReOrderingSlides.java Thu May 28 23:32:26 2015
@@ -18,21 +18,21 @@
 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 HSLFSlideShowImpl hss_one;
 	private HSLFSlideShow ss_one;
@@ -48,6 +48,7 @@ public final class TestReOrderingSlides
 	/**
 	 * Create/open the slideshows
 	 */
+	@Before
 	public void setUp() throws Exception {
         POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
 
@@ -64,10 +65,11 @@ public final class TestReOrderingSlides
 	/**
 	 * 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);
-		HSLFSlide 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());
@@ -86,10 +88,10 @@ public final class TestReOrderingSlides
 		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());
@@ -99,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);
-		HSLFSlide s1 = ss_two.getSlides()[0];
-		HSLFSlide 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());
@@ -126,11 +129,11 @@ public final class TestReOrderingSlides
 		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());
@@ -142,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);
-		HSLFSlide s1 = ss_two.getSlides()[0];
-		HSLFSlide 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());
@@ -169,11 +173,11 @@ public final class TestReOrderingSlides
 		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());
@@ -186,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);
-		HSLFSlide s1 = ss_three.getSlides()[0];
-		HSLFSlide s2 = ss_three.getSlides()[1];
-		HSLFSlide 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());
@@ -218,12 +223,12 @@ public final class TestReOrderingSlides
 		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());
@@ -239,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);
-		HSLFSlide s1 = ss_three.getSlides()[0];
-		HSLFSlide s2 = ss_three.getSlides()[1];
-		HSLFSlide 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());
@@ -263,6 +269,18 @@ 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);
@@ -272,16 +290,16 @@ public final class TestReOrderingSlides
 		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
-		HSLFSlide _s1 = ss_read.getSlides()[0];
-		HSLFSlide _s2 = ss_read.getSlides()[1];
-		HSLFSlide _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
@@ -290,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/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRecordSetup.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRecordSetup.java?rev=1682356&r1=1682355&r2=1682356&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRecordSetup.java (original)
+++ poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRecordSetup.java Thu May 28 23:32:26 2015
@@ -17,14 +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
@@ -33,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 HSLFSlideShow ss;
+	@SuppressWarnings("unused")
+    private HSLFSlideShow ss;
 	private HSLFSlideShowImpl hss;
 
-	public TestRecordSetup() throws Exception {
+	@Before
+	public void init() throws Exception {
         POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
 		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/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRichTextRun.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRichTextRun.java?rev=1682356&r1=1682355&r2=1682356&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRichTextRun.java (original)
+++ poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRichTextRun.java Thu May 28 23:32:26 2015
@@ -17,86 +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.model.*;
-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 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;
-
-   protected 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";
+    // 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);
-	}
+        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() {
-		HSLFSlide slideOne = ss.getSlides()[0];
-		HSLFTextParagraph[] textRuns = slideOne.getTextParagraphs();
-		HSLFTextRun rtr = textRuns[0].getTextRuns()[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());
 	}
 
@@ -104,115 +111,116 @@ public final class TestRichTextRun exten
 	 * Test the stuff about getting/setting bold
 	 *  on a rich text run
 	 */
+    @Test
 	public void testBoldRich() {
-		HSLFSlide slideOneR = ssRichA.getSlides()[0];
-		HSLFTextParagraph[] textRunsR = slideOneR.getTextParagraphs();
-		HSLFTextRun[] rtrs = textRunsR[1].getTextRuns();
-		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() {
 
-		HSLFSlide slideOne = ss.getSlides()[0];
-		HSLFTextParagraph[] textRuns = slideOne.getTextParagraphs();
-		HSLFTextRun rtr = textRuns[0].getTextRuns()[0];
-
-		HSLFSlide slideOneR = ssRichB.getSlides()[0];
-		HSLFTextParagraph[] textRunsR = slideOneR.getTextParagraphs();
-		HSLFTextRun rtrRa = textRunsR[0].getTextRuns()[0];
-		HSLFTextRun rtrRb = textRunsR[1].getTextRuns()[0];
-		HSLFTextRun rtrRc = textRunsR[1].getTextRuns()[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.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());
+		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.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 {
-		HSLFSlideShowImpl[] h = new HSLFSlideShowImpl[] { hss, hssRichA, hssRichB };
-		HSLFSlide[] s = new HSLFSlide[] { 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
-			HSLFSlide slideOne = s[i];
-			HSLFTextParagraph[] textRuns = slideOne.getTextParagraphs();
-			HSLFTextRun rtr = textRuns[0].getTextRuns()[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.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());
 
 			HSLFSlideShowImpl readHSLF = new HSLFSlideShowImpl(bais);
@@ -221,23 +229,23 @@ public final class TestRichTextRun exten
 			// Tweak existing one again, to ensure really worked
 			rtr.setBold(false);
 			rtr.setFontSize(17);
-			rtr.setFontName("CourierZZ");
+			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
-			HSLFSlide slideOneRR = readS.getSlides()[0];
-			HSLFTextParagraph[] textRunsRR = slideOneRR.getTextParagraphs();
-			HSLFTextRun rtrRRa = textRunsRR[0].getTextRuns()[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());
 		}
 	}
 
@@ -245,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
-		HSLFSlide[] 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
-		HSLFSlide slideThreeC = ssRichC.getSlides()[2];
-		HSLFSlide slideSevenC = ssRichC.getSlides()[6];
-		assertEquals(3, slideThreeC.getTextParagraphs().length);
-		assertEquals(5, slideSevenC.getTextParagraphs().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:
@@ -266,32 +275,20 @@ public final class TestRichTextRun exten
 		//   Illustrative Example
 		//   .
 
-		HSLFTextParagraph[] s3tr = slideThreeC.getTextParagraphs();
-		HSLFTextRun[] s3rtr0 = s3tr[0].getTextRuns();
-		HSLFTextRun[] s3rtr1 = s3tr[1].getTextRuns();
-		HSLFTextRun[] s3rtr2 = s3tr[2].getTextRuns();
-
-		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].getRawText());
-		assertEquals("", s3rtr0[1].getRawText());
-		assertEquals("Source: Internal focus groups", s3rtr1[0].getRawText());
-		assertEquals("Illustrative Example", s3rtr2[0].getRawText());
-		assertEquals("", s3rtr2[1].getRawText());
-
-		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:
@@ -300,26 +297,14 @@ public final class TestRichTextRun exten
 		//  <ps>(text a)</ps><ps>(text a)(text b)</ps>
 		// TR:
 		//  (text)
-		HSLFTextParagraph[] s7tr = slideSevenC.getTextParagraphs();
-		HSLFTextRun[] s7rtr0 = s7tr[0].getTextRuns();
-		HSLFTextRun[] s7rtr1 = s7tr[1].getTextRuns();
-		HSLFTextRun[] s7rtr2 = s7tr[2].getTextRuns();
-
-		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());
 	}
 
 	/**
@@ -327,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);
 
-		HSLFSlide slideSevenC = ssRichC.getSlides()[6];
-		HSLFTextParagraph[] s7tr = slideSevenC.getTextParagraphs();
-		HSLFTextRun[] s7rtr0 = s7tr[0].getTextRuns();
-		HSLFTextRun[] s7rtr1 = s7tr[1].getTextRuns();
-		HSLFTextRun[] s7rtr2 = s7tr[2].getTextRuns();
+		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].getRawText());
-		assertEquals(oldText, s7tr[2].getRawText());
-		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].getRawText());
-		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);
 	}
@@ -391,17 +381,11 @@ 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);
 	}
 
 	/**
@@ -409,35 +393,35 @@ public final class TestRichTextRun exten
 	 *  of slideshow c
 	 */
 	private static void assertMatchesFileC(HSLFSlideShow 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) {
 		// 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();
+		
+		FileOutputStream fos = new FileOutputStream("PowerPoint Document.new.stream");
+		fos.write(raw_ss);
+		fos.close();
 
+		// 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 {
@@ -446,15 +430,13 @@ if(false) {
 		return baos.toByteArray();
 	}
 
+    @Test
 	public void testIndentationLevel() throws Exception {
 		HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream("ParagraphStylesShorterThanCharStyles.ppt"));
-		HSLFSlide[] sl = ppt.getSlides();
-		for (int i = 0; i < sl.length; i++) {
-			HSLFTextParagraph[] txt = sl[i].getTextParagraphs();
-			for (int j = 0; j < txt.length; j++) {
-				HSLFTextRun[] rt = txt[j].getTextRuns();
-				for (int k = 0; k < rt.length; k++) {
-					int indent = rt[k].getIndentLevel();
+		for (HSLFSlide sl : ppt.getSlides()) {
+			for (List<HSLFTextParagraph> txt : sl.getTextParagraphs()) {
+				for (HSLFTextParagraph p : txt) {
+					int indent = p.getIndentLevel();
 					assertTrue(indent >= 0 && indent <= 4 );
 				}
 
@@ -462,78 +444,84 @@ if(false) {
 		}
 	}
 
+    @Test
 	public void testReadParagraphStyles() throws Exception {
 		HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream("bullets.ppt"));
 		assertTrue("No Exceptions while reading file", true);
 
-		HSLFTextRun rt;
-		HSLFTextParagraph[] txt;
-		HSLFSlide[] slide = ppt.getSlides();
-		assertEquals(2, slide.length);
-
-		txt = slide[0].getTextParagraphs();
-		assertEquals(2, txt.length);
-
-		assertEquals("Title text", txt[0].getRawText());
-		assertEquals(1, txt[0].getTextRuns().length);
-		rt = txt[0].getTextRuns()[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].getTextRuns().length);
-		rt = txt[1].getTextRuns()[0];
+		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', rt.getBulletChar());
 		assertTrue(rt.isBullet());
 
 
-		txt = slide[1].getTextParagraphs();
-		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].getTextRuns().length);
-		rt = txt[0].getTextRuns()[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(
-				"I\u2019m a text box with user-defined\r" +
-				"bullet character", txt[1].getRawText());
-		assertEquals(1, txt[1].getTextRuns().length);
-		rt = txt[1].getTextRuns()[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());
 	}
 
+    @Test
 	public void testSetParagraphStyles() throws Exception {
 		HSLFSlideShow ppt = new HSLFSlideShow();
 
 		HSLFSlide slide = ppt.createSlide();
 
 		HSLFTextBox shape = new HSLFTextBox();
-		HSLFTextRun rt = shape.getTextParagraphs().getTextRuns()[0];
 		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(42);
 		rt.setBullet(true);
-		rt.setTextOffset(50);
-		rt.setBulletOffset(0);
+		rt.setLeftMargin(50);
+		rt.setIndent(0);
 		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(50.0, rt.getLeftMargin(), 0);
+		assertEquals(0, rt.getIndent(), 0);
 		assertEquals('\u263A', rt.getBulletChar());
 
 		shape.setAnchor(new java.awt.Rectangle(50, 50, 500, 300));
@@ -545,57 +533,67 @@ if(false) {
 		out.close();
 
 		ppt = new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray()));
-		slide = ppt.getSlides()[0];
-		shape = (HSLFTextBox)slide.getShapes()[0];
-		rt = shape.getTextParagraphs().getTextRuns()[0];
-		assertEquals(42, rt.getFontSize());
+		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(50.0, rt.getLeftMargin(), 0);
+		assertEquals(0, rt.getIndent(), 0);
 		assertEquals('\u263A', rt.getBulletChar());
 	}
 
+    @Test
 	public void testAddText() throws Exception {
 		HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream("bullets.ppt"));
 		assertTrue("No Exceptions while reading file", true);
 
-		HSLFTextRun rt;
-		HSLFTextParagraph[] txt;
-		HSLFSlide[] slides = ppt.getSlides();
-
-		assertEquals(2, slides.length);
-		txt = slides[0].getTextParagraphs();
-		assertEquals(2, txt.length);
-
-		assertEquals("Title text", txt[0].getRawText());
-		assertEquals(1, txt[0].getTextRuns().length);
-		rt = txt[0].getTextRuns()[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].getTextRuns().length);
+		HSLFTextParagraph.appendText(txt.get(0), "Foo! I'm new!", true);
+		assertEquals(2, txt.get(0).size());
 
-		rt = txt[0].getTextRuns()[0];
-		assertFalse(rt.isBold());
-		assertEquals("Title text", rt.getRawText());
-		rt = txt[0].getTextRuns()[1];
-		assertFalse(rt.isBold());
-		assertEquals("Foo! I'm new!", rt.getRawText());
-		rt.setBold(true);
-
-		// And some more
-		txt[0].appendText("Me too!");
-		assertEquals(3, txt[0].getTextRuns().length);
-		rt = txt[0].getTextRuns()[0];
-		assertFalse(rt.isBold());
-		assertEquals("Title text", rt.getRawText());
-		rt = txt[0].getTextRuns()[1];
-		assertTrue(rt.isBold());
-		assertEquals("Foo! I'm new!", rt.getRawText());
-		rt = txt[0].getTextRuns()[2];
-		assertFalse(rt.isBold());
-		assertEquals("Me too!", rt.getRawText());
+		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();
@@ -605,55 +603,59 @@ if(false) {
 		ppt = new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray()));
 		slides = ppt.getSlides();
 
-		assertEquals(2, slides.length);
+		assertEquals(2, slides.size());
 
-		txt = slides[0].getTextParagraphs();
-		assertEquals(2, txt.length);
-		assertEquals(3, txt[0].getTextRuns().length);
-		rt = txt[0].getTextRuns()[0];
-		assertFalse(rt.isBold());
-		assertEquals("Title text", rt.getRawText());
-		rt = txt[0].getTextRuns()[1];
-		assertTrue(rt.isBold());
-		assertEquals("Foo! I'm new!", rt.getRawText());
-		rt = txt[0].getTextRuns()[2];
-		assertFalse(rt.isBold());
-		assertEquals("Me too!", rt.getRawText());
+		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 {
-      HSLFTextRun[] rts;
+      List<HSLFTextRun> rts;
       HSLFTextRun rt;
-      HSLFTextParagraph[] txt;
-      HSLFSlide[] slides = ssChinese.getSlides();
+      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].getTextParagraphs();
-      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].getTextRuns();
-      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.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/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSheetText.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSheetText.java?rev=1682356&r1=1682355&r2=1682356&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSheetText.java (original)
+++ poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSheetText.java Thu May 28 23:32:26 2015
@@ -17,45 +17,50 @@
 
 package org.apache.poi.hslf.usermodel;
 
+import static org.junit.Assert.assertEquals;
 
-import junit.framework.TestCase;
+import java.util.List;
 
-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 HSLFSlideShow ss;
 
-	public TestSheetText() throws Exception {
+	@Before
+	public void init() throws Exception {
         POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
 		HSLFSlideShowImpl hss = new HSLFSlideShowImpl(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
 		ss = new HSLFSlideShow(hss);
 	}
 
+	@Test
 	public void testSheetOne() {
-		HSLFSheet 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.getTextParagraphs().length);
-		for(int i=0; i<expectText.length; i++) {
-			assertEquals(expectText[i], slideOne.getTextParagraphs()[i].getRawText());
+		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() {
-		HSLFSheet 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.getTextParagraphs().length);
-		for(int i=0; i<expectText.length; i++) {
-			assertEquals(expectText[i], slideTwo.getTextParagraphs()[i].getRawText());
-		}
+		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));
+        }
 	}
 
 	/**
@@ -69,11 +74,11 @@ public final class TestSheetText extends
 		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
-		HSLFSlide s = sss.getSlides()[0];
+		HSLFSlide s = sss.getSlides().get(0);
 		String exp =
 			"Realizing the Development Dividend:\n" +
 			"Community Capacity Building and CDM.\n" +
@@ -83,7 +88,7 @@ public final class TestSheetText extends
 			"COP 11 \u2013 MOP 1\n" + // special long hyphen
 			"December 5, 2005\n";
 
-		assertEquals(1, s.getTextParagraphs().length);
-		assertEquals(exp, s.getTextParagraphs()[0].getRawText());
+		assertEquals(1, s.getTextParagraphs().size());
+		assertEquals(exp, HSLFTextParagraph.getRawText(s.getTextParagraphs().get(0)));
 	}
 }

Modified: poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSlideOrdering.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSlideOrdering.java?rev=1682356&r1=1682355&r2=1682356&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSlideOrdering.java (original)
+++ poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSlideOrdering.java Thu May 28 23:32:26 2015
@@ -17,18 +17,20 @@
 
 package org.apache.poi.hslf.usermodel;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+
+import java.util.List;
 
-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 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
@@ -36,7 +38,8 @@ public final class TestSlideOrdering ext
 	// Complex slideshow, record order doesn't match slide order
 	private HSLFSlideShow ssB;
 
-	public TestSlideOrdering() throws Exception {
+	@Before
+	public void init() throws Exception {
 		HSLFSlideShowImpl hssA = new HSLFSlideShowImpl(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
 		ssA = new HSLFSlideShow(hssA);
 
@@ -47,33 +50,29 @@ public final class TestSlideOrdering ext
 	/**
 	 * Test the simple case - record order matches slide order
 	 */
+	@Test
 	public void testSimpleCase() {
-		assertEquals(2, ssA.getSlides().length);
+		assertEquals(2, ssA.getSlides().size());
 
-		HSLFSlide s1 = ssA.getSlides()[0];
-		HSLFSlide 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.getTextParagraphs()[0].getRawText());
-		assertEquals(firstTRs[1], s2.getTextParagraphs()[0].getRawText());
+		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);
-
-		HSLFSlide s1 = ssB.getSlides()[0];
-		HSLFSlide s2 = ssB.getSlides()[1];
-		HSLFSlide s3 = ssB.getSlides()[2];
-
-		String[] firstTRs = new String[] { "Slide 1", "Slide 2", "Slide 3" };
-
-		assertEquals(firstTRs[0], s1.getTextParagraphs()[0].getRawText());
-		assertEquals(firstTRs[1], s2.getTextParagraphs()[0].getRawText());
-		assertEquals(firstTRs[2], s3.getTextParagraphs()[0].getRawText());
+		assertEquals(3, ssB.getSlides().size());
+		int i=1;
+		for (HSLFSlide s : ssB.getSlides()) {
+		    assertEquals("Slide "+(i++), HSLFTextParagraph.getRawText(s.getTextParagraphs().get(0)));
+		}
 	}
 
 	/**
@@ -88,15 +87,16 @@ public final class TestSlideOrdering ext
         POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
 
         HSLFSlideShow ppt = new HSLFSlideShow(slTests.openResourceAsStream(filename));
-		HSLFSlide[] slide = ppt.getSlides();
+		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/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestTextRun.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestTextRun.java?rev=1682356&r1=1682355&r2=1682356&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestTextRun.java (original)
+++ poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestTextRun.java Thu May 28 23:32:26 2015
@@ -19,15 +19,11 @@ package org.apache.poi.hslf.usermodel;
 
 import static org.junit.Assert.*;
 
-import java.awt.Color;
-import java.io.*;
+import java.io.IOException;
 import java.util.List;
 
 import org.apache.poi.POIDataSamples;
-import org.apache.poi.hslf.model.Table;
-import org.apache.poi.hslf.model.textproperties.TextPropCollection;
 import org.apache.poi.hslf.record.*;
-import org.apache.poi.hslf.usermodel.*;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -59,28 +55,28 @@ public final class TestTextRun {
 	@Test
 	public void testGetText() {
 		HSLFSlide slideOne = ss.getSlides().get(0);
-		List<HSLFTextParagraph> textParas = slideOne.getTextParagraphs();
+		List<List<HSLFTextParagraph>> textParas = slideOne.getTextParagraphs();
 
 		assertEquals(2, textParas.size());
 
 		// Get text works with \n
-		assertEquals("This is a test title", textParas.get(0).getTextRuns().get(0).getRawText());
-		assertEquals("This is a test subtitle\nThis is on page 1", textParas.get(1).getTextRuns().get(0).getRawText());
+		assertEquals("This is a test title", HSLFTextParagraph.getText(textParas.get(0)));
+		assertEquals("This is a test subtitle\nThis is on page 1", HSLFTextParagraph.getText(textParas.get(1)));
 
 		// Raw text has \r instead
-		assertEquals("This is a test title", textParas.get(0).getTextRuns().get(0).getRawText());
-		assertEquals("This is a test subtitle\rThis is on page 1", textParas.get(1).getTextRuns().get(0).getRawText());
+		assertEquals("This is a test title", HSLFTextParagraph.getRawText(textParas.get(0)));
+		assertEquals("This is a test subtitle\rThis is on page 1", HSLFTextParagraph.getRawText(textParas.get(1)));
 
 
 		// Now check on a rich text run
 		HSLFSlide slideOneR = ssRich.getSlides().get(0);
-		List<HSLFTextParagraph> textRunsR = slideOneR.getTextParagraphs();
+		textParas = slideOneR.getTextParagraphs();
 
-		assertEquals(2, textRunsR.size());
-		assertEquals("This is a title, it\u2019s in black", textRunsR.get(0).getTextRuns().get(0).getRawText());
-		assertEquals("This is the subtitle, in bold\nThis bit is blue and italic\nThis bit is red (normal)", textRunsR.get(1).getTextRuns().get(0).getRawText());
-		assertEquals("This is a title, it\u2019s in black", textRunsR.get(0).getTextRuns().get(0).getRawText());
-		assertEquals("This is the subtitle, in bold\rThis bit is blue and italic\rThis bit is red (normal)", textRunsR.get(1).getTextRuns().get(0).getRawText());
+		assertEquals(2, textParas.size());
+		assertEquals("This is a title, it\u2019s in black", HSLFTextParagraph.getText(textParas.get(0)));
+		assertEquals("This is the subtitle, in bold\nThis bit is blue and italic\nThis bit is red (normal)", HSLFTextParagraph.getText(textParas.get(1)));
+		assertEquals("This is a title, it\u2019s in black", HSLFTextParagraph.getRawText(textParas.get(0)));
+		assertEquals("This is the subtitle, in bold\rThis bit is blue and italic\rThis bit is red (normal)", HSLFTextParagraph.getRawText(textParas.get(1)));
 	}
 
 	/**
@@ -89,8 +85,8 @@ public final class TestTextRun {
 	@Test
 	public void testSetText() {
 		HSLFSlide slideOne = ss.getSlides().get(0);
-		List<HSLFTextParagraph> textRuns = slideOne.getTextParagraphs();
-		HSLFTextParagraph run = textRuns.get(0);
+		List<List<HSLFTextParagraph>> textRuns = slideOne.getTextParagraphs();
+		HSLFTextParagraph run = textRuns.get(0).get(0);
 		HSLFTextRun tr =  run.getTextRuns().get(0);
 
 		// Check current text
@@ -110,10 +106,11 @@ public final class TestTextRun {
 	 * Test to ensure that changing non rich text between bytes and
 	 *  chars works correctly
 	 */
-	@Test
+	@SuppressWarnings("unused")
+    @Test
 	public void testAdvancedSetText() {
 		HSLFSlide slideOne = ss.getSlides().get(0);
-		List<HSLFTextParagraph> paras = slideOne.getTextParagraphs();
+		List<HSLFTextParagraph> paras = slideOne.getTextParagraphs().get(0);
 		HSLFTextParagraph para = paras.get(0);
 		
         TextHeaderAtom tha = null;
@@ -192,21 +189,21 @@ public final class TestTextRun {
 	@Test
 	public void testGetRichTextNonRich() {
 		HSLFSlide slideOne = ss.getSlides().get(0);
-		List<HSLFTextParagraph> textRuns = slideOne.getTextParagraphs();
+		List<List<HSLFTextParagraph>> textParass = slideOne.getTextParagraphs();
 
-		assertEquals(2, textRuns.size());
+		assertEquals(2, textParass.size());
 
-		HSLFTextParagraph trA = textRuns.get(0);
-		HSLFTextParagraph trB = textRuns.get(1);
+		List<HSLFTextParagraph> trA = textParass.get(0);
+		List<HSLFTextParagraph> trB = textParass.get(1);
 
-		assertEquals(1, trA.getTextRuns().size());
-		assertEquals(1, trB.getTextRuns().size());
+		assertEquals(1, trA.size());
+		assertEquals(1, trB.size());
 
-		HSLFTextRun rtrA = trA.getTextRuns().get(0);
-		HSLFTextRun rtrB = trB.getTextRuns().get(0);
+		HSLFTextRun rtrA = trA.get(0).getTextRuns().get(0);
+		HSLFTextRun rtrB = trB.get(0).getTextRuns().get(0);
 
-		assertEquals(HSLFTextParagraph.getRawText(textRuns.subList(0, 0)), rtrA.getRawText());
-		assertEquals(HSLFTextParagraph.getRawText(textRuns.subList(1, 1)), rtrB.getRawText());
+		assertEquals(HSLFTextParagraph.getRawText(trA), rtrA.getRawText());
+		assertEquals(HSLFTextParagraph.getRawText(trB), rtrB.getRawText());
 
 //		assertNull(rtrA._getRawCharacterStyle());
 //		assertNull(rtrA._getRawParagraphStyle());
@@ -220,45 +217,36 @@ public final class TestTextRun {
 	@Test
 	public void testGetRichText() {
 		HSLFSlide slideOne = ssRich.getSlides().get(0);
-		List<HSLFTextParagraph> textRuns = slideOne.getTextParagraphs();
+		List<List<HSLFTextParagraph>> textParass = slideOne.getTextParagraphs();
 
-		assertEquals(2, textRuns.size());
+		assertEquals(2, textParass.size());
 
-		HSLFTextParagraph trA = textRuns.get(0);
-		HSLFTextParagraph trB = textRuns.get(1);
+		List<HSLFTextParagraph> trA = textParass.get(0);
+		List<HSLFTextParagraph> trB = textParass.get(1);
 
-		assertEquals(1, trA.getTextRuns().size());
-		assertEquals(3, trB.getTextRuns().size());
+		assertEquals(1, trA.size());
+		assertEquals(3, trB.size());
 
-		HSLFTextRun rtrA = trA.getTextRuns().get(0);
-		HSLFTextRun rtrB = trB.getTextRuns().get(0);
-		HSLFTextRun rtrC = trB.getTextRuns().get(1);
-		HSLFTextRun rtrD = trB.getTextRuns().get(2);
+		HSLFTextRun rtrA = trA.get(0).getTextRuns().get(0);
+		HSLFTextRun rtrB = trB.get(0).getTextRuns().get(0);
+		HSLFTextRun rtrC = trB.get(1).getTextRuns().get(0);
+		HSLFTextRun rtrD = trB.get(2).getTextRuns().get(0);
 
-		assertEquals(HSLFTextParagraph.getRawText(textRuns.subList(0, 0)), rtrA.getRawText());
+		assertEquals(HSLFTextParagraph.getRawText(trA), rtrA.getRawText());
 
-		String trBstr = HSLFTextParagraph.getRawText(textRuns.subList(1, 1));
+		String trBstr = HSLFTextParagraph.getRawText(trB);
 		assertEquals(trBstr.substring(0, 30), rtrB.getRawText());
 		assertEquals(trBstr.substring(30,58), rtrC.getRawText());
 		assertEquals(trBstr.substring(58,82), rtrD.getRawText());
 
-//		assertNull(rtrA._getRawCharacterStyle());
-//		assertNull(rtrA._getRawParagraphStyle());
-//		assertNotNull(rtrB._getRawCharacterStyle());
-//		assertNotNull(rtrB._getRawParagraphStyle());
-//		assertNotNull(rtrC._getRawCharacterStyle());
-//		assertNotNull(rtrC._getRawParagraphStyle());
-//		assertNotNull(rtrD._getRawCharacterStyle());
-//		assertNotNull(rtrD._getRawParagraphStyle());
-
 		// Same paragraph styles
-//		assertEquals(rtrB._getRawParagraphStyle(), rtrC._getRawParagraphStyle());
-//		assertEquals(rtrB._getRawParagraphStyle(), rtrD._getRawParagraphStyle());
+		assertEquals(trB.get(0).getParagraphStyle(), trB.get(1).getParagraphStyle());
+		assertEquals(trB.get(0).getParagraphStyle(), trB.get(2).getParagraphStyle());
 
 		// Different char styles
-//		assertFalse( rtrB._getRawCharacterStyle().equals( rtrC._getRawCharacterStyle() ));
-//		assertFalse( rtrB._getRawCharacterStyle().equals( rtrD._getRawCharacterStyle() ));
-//		assertFalse( rtrC._getRawCharacterStyle().equals( rtrD._getRawCharacterStyle() ));
+		assertNotEquals(rtrB.getCharacterStyle(), rtrC.getCharacterStyle());
+        assertNotEquals(rtrB.getCharacterStyle(), rtrD.getCharacterStyle());
+        assertNotEquals(rtrC.getCharacterStyle(), rtrD.getCharacterStyle());
 	}
 
 	/**
@@ -268,22 +256,18 @@ public final class TestTextRun {
 	@Test
 	public void testSetTextWhereNotRich() {
 		HSLFSlide slideOne = ss.getSlides().get(0);
-		List<HSLFTextParagraph> textRuns = slideOne.getTextParagraphs();
-		HSLFTextParagraph trB = textRuns.get(1);
-//		assertEquals(1, trB.getTextRuns().length);
+		List<List<HSLFTextParagraph>> textParass = slideOne.getTextParagraphs();
+		List<HSLFTextParagraph> trB = textParass.get(0);
+		assertEquals(1, trB.size());
 
-		HSLFTextRun rtrB = trB.getTextRuns().get(0);
-//		assertEquals(trB.getRawText(), rtrB.getRawText());
-//		assertNull(rtrB._getRawCharacterStyle());
-//		assertNull(rtrB._getRawParagraphStyle());
+		HSLFTextRun rtrB = trB.get(0).getTextRuns().get(0);
+		assertEquals(HSLFTextParagraph.getText(trB), rtrB.getRawText());
 
 		// Change text via normal
-//		trB.setText("Test Foo Test");
-		rtrB = trB.getTextRuns().get(0);
-//		assertEquals("Test Foo Test", trB.getRawText());
-//		assertEquals("Test Foo Test", rtrB.getRawText());
-//		assertNull(rtrB._getRawCharacterStyle());
-//		assertNull(rtrB._getRawParagraphStyle());
+		HSLFTextParagraph.setText(trB, "Test Foo Test");
+		rtrB = trB.get(0).getTextRuns().get(0);
+		assertEquals("Test Foo Test", HSLFTextParagraph.getRawText(trB));
+		assertEquals("Test Foo Test", rtrB.getRawText());
 	}
 
 	/**
@@ -293,13 +277,13 @@ public final class TestTextRun {
 	@Test
 	public void testSetTextWhereRich() {
 		HSLFSlide slideOne = ssRich.getSlides().get(0);
-		List<HSLFTextParagraph> textRuns = slideOne.getTextParagraphs();
-		HSLFTextParagraph trB = textRuns.get(1);
-		assertEquals(3, trB.getTextRuns().size());
-
-		HSLFTextRun rtrB = trB.getTextRuns().get(0);
-		HSLFTextRun rtrC = trB.getTextRuns().get(1);
-		HSLFTextRun rtrD = trB.getTextRuns().get(2);
+		List<List<HSLFTextParagraph>> textParass = slideOne.getTextParagraphs();
+		List<HSLFTextParagraph> trB = textParass.get(1);
+		assertEquals(3, trB.size());
+
+		HSLFTextRun rtrB = trB.get(0).getTextRuns().get(0);
+		HSLFTextRun rtrC = trB.get(1).getTextRuns().get(0);
+		HSLFTextRun rtrD = trB.get(2).getTextRuns().get(0);
 //		TextPropCollection tpBP = rtrB._getRawParagraphStyle();
 //		TextPropCollection tpBC = rtrB._getRawCharacterStyle();
 //		TextPropCollection tpCP = rtrC._getRawParagraphStyle();
@@ -342,8 +326,8 @@ public final class TestTextRun {
 	@Test
 	public void testChangeTextInRichTextRunNonRich() {
 		HSLFSlide slideOne = ss.getSlides().get(0);
-		List<HSLFTextParagraph> textRuns = slideOne.getTextParagraphs();
-		HSLFTextParagraph trB = textRuns.get(1);
+		List<List<HSLFTextParagraph>> textRuns = slideOne.getTextParagraphs();
+		List<HSLFTextParagraph> trB = textRuns.get(1);
 //		assertEquals(1, trB.getTextRuns().length);
 //
 //		HSLFTextRun rtrB = trB.getTextRuns().get(0);
@@ -368,15 +352,15 @@ public final class TestTextRun {
 	@Test
 	public void testChangeTextInRichTextRun() {
 		HSLFSlide slideOne = ssRich.getSlides().get(0);
-		List<HSLFTextParagraph> textRuns = slideOne.getTextParagraphs();
-		HSLFTextParagraph trB = textRuns.get(1);
-		assertEquals(3, trB.getTextRuns().size());
+		List<List<HSLFTextParagraph>> textParass = slideOne.getTextParagraphs();
+		List<HSLFTextParagraph> trB = textParass.get(1);
+		assertEquals(3, trB.size());
 
 		// We start with 3 text runs, each with their own set of styles,
 		//  but all sharing the same paragraph styles
-		HSLFTextRun rtrB = trB.getTextRuns().get(0);
-		HSLFTextRun rtrC = trB.getTextRuns().get(1);
-		HSLFTextRun rtrD = trB.getTextRuns().get(2);
+		HSLFTextRun rtrB = trB.get(0).getTextRuns().get(0);
+		HSLFTextRun rtrC = trB.get(1).getTextRuns().get(0);
+		HSLFTextRun rtrD = trB.get(2).getTextRuns().get(0);
 //		TextPropCollection tpBP = rtrB._getRawParagraphStyle();
 //		TextPropCollection tpBC = rtrB._getRawCharacterStyle();
 //		TextPropCollection tpCP = rtrC._getRawParagraphStyle();
@@ -400,8 +384,8 @@ public final class TestTextRun {
 //		assertFalse(tpCC.equals(tpDC));
 
 		// Check text in the rich runs
-		assertEquals("This is the subtitle, in bold\n", rtrB.getRawText());
-		assertEquals("This bit is blue and italic\n", rtrC.getRawText());
+		assertEquals("This is the subtitle, in bold\r", rtrB.getRawText());
+		assertEquals("This bit is blue and italic\r", rtrC.getRawText());
 		assertEquals("This bit is red (normal)", rtrD.getRawText());
 
 		String newBText = "New Subtitle, will still be bold\n";
@@ -452,23 +436,24 @@ public final class TestTextRun {
 
 		HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream("bug-41015.ppt"));
 		HSLFSlide sl = ppt.getSlides().get(0);
-		List<HSLFTextParagraph> txt = sl.getTextParagraphs();
-		assertEquals(2, txt.size());
-
-		rt = txt.get(0).getTextRuns();
+        List<List<HSLFTextParagraph>> textParass = sl.getTextParagraphs();
+		assertEquals(2, textParass.size());
+		
+		List<HSLFTextParagraph> textParas = textParass.get(0);
+		rt = textParass.get(0).get(0).getTextRuns();
 		assertEquals(1, rt.size());
-		assertEquals(0, txt.get(0).getIndentLevel());
+		assertEquals(0, textParass.get(0).get(0).getIndentLevel());
 		assertEquals("sdfsdfsdf", rt.get(0).getRawText());
 
-		rt = txt.get(1).getTextRuns();
-		assertEquals(2, rt.size());
-		assertEquals(0, txt.get(0).getIndentLevel());
-		assertEquals("Sdfsdfsdf\n" +
-				"Dfgdfg\n" +
-				"Dfgdfgdfg\n", rt.get(0).getRawText());
-		assertEquals(1, txt.get(1).getIndentLevel());
-		assertEquals("Sdfsdfs\n" +
-				"Sdfsdf\n", rt.get(1).getRawText());
+		textParas = textParass.get(1);
+		String texts[] = {"Sdfsdfsdf\r","Dfgdfg\r","Dfgdfgdfg\r","Sdfsdfs\r","Sdfsdf\r"};
+		int indents[] = {0,0,0,1,1};
+		int i=0;
+		for (HSLFTextParagraph p : textParas) {
+		    assertEquals(texts[i], p.getTextRuns().get(0).getRawText());
+		    assertEquals(indents[i], p.getIndentLevel());
+		    i++;
+		}
 	}
 
 	/**
@@ -479,7 +464,7 @@ public final class TestTextRun {
 		HSLFSlideShow ppt = new HSLFSlideShow();
 		HSLFSlide slide = ppt.createSlide();
 
-		assertNull(slide.getTextParagraphs());
+		assertEquals(0, slide.getTextParagraphs().size());
 
 		HSLFTextBox shape1 = new HSLFTextBox();
 //		HSLFTextParagraph run1 = shape1.getTextParagraphs();
@@ -565,17 +550,14 @@ public final class TestTextRun {
 	public void test52244() throws IOException {
         HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream("52244.ppt"));
         HSLFSlide slide = ppt.getSlides().get(0);
-        List<HSLFTextParagraph> runs = slide.getTextParagraphs();
-
-        assertEquals("Arial", runs.get(0).getTextRuns().get(0).getFontFamily());
-        assertEquals(36, runs.get(0).getTextRuns().get(0).getFontSize(), 0);
-
-        assertEquals("Arial", runs.get(1).getTextRuns().get(0).getFontFamily());
-        assertEquals(24, runs.get(1).getTextRuns().get(0).getFontSize(), 0);
-
-        assertEquals("Arial", runs.get(2).getTextRuns().get(0).getFontFamily());
-        assertEquals(32, runs.get(2).getTextRuns().get(0).getFontSize(), 0);
 
+        int sizes[] = { 36, 24, 12, 32, 12, 12 };
+        
+        int i=0;
+        for (List<HSLFTextParagraph> textParas : slide.getTextParagraphs()) {
+            assertEquals("Arial", textParas.get(0).getTextRuns().get(0).getFontFamily());
+            assertEquals(sizes[i++], (int)textParas.get(0).getTextRuns().get(0).getFontSize());
+        }
     }
 
 }

Copied: poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestTextShape.java (from r1678838, poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextShape.java)
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestTextShape.java?p2=poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestTextShape.java&p1=poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextShape.java&r1=1678838&r2=1682356&rev=1682356&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextShape.java (original)
+++ poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestTextShape.java Thu May 28 23:32:26 2015
@@ -15,26 +15,15 @@
    limitations under the License.
 ==================================================================== */
 
-package org.apache.poi.hslf.model;
+package org.apache.poi.hslf.usermodel;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-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 java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import static org.junit.Assert.*;
+
+import java.io.*;
+import java.util.*;
 
 import org.apache.poi.POIDataSamples;
 import org.apache.poi.hslf.record.TextHeaderAtom;
-import org.apache.poi.hslf.usermodel.*;
 import org.apache.poi.sl.usermodel.ShapeType;
 import org.junit.Test;
 
@@ -49,28 +38,21 @@ public final class TestTextShape {
     @Test
     public void createAutoShape(){
         HSLFTextShape shape = new HSLFAutoShape(ShapeType.TRAPEZOID);
-        assertNull(shape.getTextParagraphs());
-        assertNull(shape.getText());
         assertNull(shape.getEscherTextboxWrapper());
-
-        HSLFTextParagraph run = shape.createTextRun();
-        assertNotNull(run);
         assertNotNull(shape.getTextParagraphs());
         assertNotNull(shape.getEscherTextboxWrapper());
         assertEquals("", shape.getText());
-        assertSame(run, shape.createTextRun());
-        assertEquals(-1, run.getIndex());
+        assertEquals(-1, shape.getTextParagraphs().get(0).getIndex());
     }
 
     @Test
     public void createTextBox(){
         HSLFTextShape shape = new HSLFTextBox();
-        HSLFTextParagraph run = shape.getTextParagraphs();
-        assertNotNull(run);
+        List<HSLFTextParagraph> paras = shape.getTextParagraphs();
+        assertNotNull(paras);
         assertNotNull(shape.getText());
         assertNotNull(shape.getEscherTextboxWrapper());
 
-        assertSame(run, shape.createTextRun());
         assertNotNull(shape.getTextParagraphs());
         assertNotNull(shape.getEscherTextboxWrapper());
         assertEquals("", shape.getText());
@@ -88,46 +70,45 @@ public final class TestTextShape {
         HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream("text_shapes.ppt"));
 
         List<String> lst1 = new ArrayList<String>();
-        HSLFSlide slide = ppt.getSlides()[0];
-        HSLFShape[] shape = slide.getShapes();
-        for (int i = 0; i < shape.length; i++) {
-            assertTrue("Expected TextShape but found " + shape[i].getClass().getName(), shape[i] instanceof HSLFTextShape);
-            HSLFTextShape tx = (HSLFTextShape)shape[i];
-            HSLFTextParagraph run = tx.getTextParagraphs();
-            assertNotNull(run);
-            int runType = run.getRunType();
+        HSLFSlide slide = ppt.getSlides().get(0);
+        for (HSLFShape shape : slide.getShapes()) {
+            assertTrue("Expected TextShape but found " + shape.getClass().getName(), shape instanceof HSLFTextShape);
+            HSLFTextShape tx = (HSLFTextShape)shape;
+            List<HSLFTextParagraph> paras = tx.getTextParagraphs();
+            assertNotNull(paras);
+            int runType = paras.get(0).getRunType();
 
-            ShapeType type = shape[i].getShapeType();
+            ShapeType type = shape.getShapeType();
+            String rawText = HSLFTextParagraph.getRawText(paras);
             switch (type){
                 case TEXT_BOX:
-                    assertEquals("Text in a TextBox", run.getRawText());
+                    assertEquals("Text in a TextBox", rawText);
                     break;
                 case RECT:
                     if(runType == TextHeaderAtom.OTHER_TYPE)
-                        assertEquals("Rectangle", run.getRawText());
+                        assertEquals("Rectangle", rawText);
                     else if(runType == TextHeaderAtom.TITLE_TYPE)
-                        assertEquals("Title Placeholder", run.getRawText());
+                        assertEquals("Title Placeholder", rawText);
                     break;
                 case OCTAGON:
-                    assertEquals("Octagon", run.getRawText());
+                    assertEquals("Octagon", rawText);
                     break;
                 case ELLIPSE:
-                    assertEquals("Ellipse", run.getRawText());
+                    assertEquals("Ellipse", rawText);
                     break;
                 case ROUND_RECT:
-                    assertEquals("RoundRectangle", run.getRawText());
+                    assertEquals("RoundRectangle", rawText);
                     break;
                 default:
-                    fail("Unexpected shape: " + shape[i].getShapeName());
+                    fail("Unexpected shape: " + shape.getShapeName());
 
             }
-            lst1.add(run.getRawText());
+            lst1.add(rawText);
         }
 
         List<String> lst2 = new ArrayList<String>();
-        HSLFTextParagraph[] run = slide.getTextParagraphs();
-        for (int i = 0; i < run.length; i++) {
-            lst2.add(run[i].getRawText());
+        for (List<HSLFTextParagraph> paras : slide.getTextParagraphs()) {
+            lst2.add(HSLFTextParagraph.getRawText(paras));
         }
 
         assertTrue(lst1.containsAll(lst2));
@@ -139,15 +120,13 @@ public final class TestTextShape {
         HSLFSlide slide =  ppt.createSlide();
 
         HSLFTextShape shape1 = new HSLFTextBox();
-        HSLFTextParagraph run1 = shape1.createTextRun();
-        run1.setText("Hello, World!");
+        shape1.setText("Hello, World!");
         slide.addShape(shape1);
 
         shape1.moveTo(100, 100);
 
         HSLFTextShape shape2 = new HSLFAutoShape(ShapeType.RIGHT_ARROW);
-        HSLFTextParagraph run2 = shape2.createTextRun();
-        run2.setText("Testing TextShape");
+        shape2.setText("Testing TextShape");
         slide.addShape(shape2);
         shape2.moveTo(300, 300);
 
@@ -156,31 +135,30 @@ public final class TestTextShape {
         out.close();
 
         ppt = new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray()));
-        slide = ppt.getSlides()[0];
-        HSLFShape[] shape = slide.getShapes();
+        slide = ppt.getSlides().get(0);
+        List<HSLFShape> shape = slide.getShapes();
 
-        assertTrue(shape[0] instanceof HSLFTextShape);
-        shape1 = (HSLFTextShape)shape[0];
+        assertTrue(shape.get(0) instanceof HSLFTextShape);
+        shape1 = (HSLFTextShape)shape.get(0);
         assertEquals(ShapeType.TEXT_BOX, shape1.getShapeType());
-        assertEquals("Hello, World!", shape1.getTextParagraphs().getRawText());
+        assertEquals("Hello, World!", shape1.getText());
 
-        assertTrue(shape[1] instanceof HSLFTextShape);
-        shape1 = (HSLFTextShape)shape[1];
+        assertTrue(shape.get(1) instanceof HSLFTextShape);
+        shape1 = (HSLFTextShape)shape.get(1);
         assertEquals(ShapeType.RIGHT_ARROW, shape1.getShapeType());
-        assertEquals("Testing TextShape", shape1.getTextParagraphs().getRawText());
+        assertEquals("Testing TextShape", shape1.getText());
     }
 
     @Test
     public void margins() throws IOException {
         HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream("text-margins.ppt"));
 
-        HSLFSlide slide = ppt.getSlides()[0];
+        HSLFSlide slide = ppt.getSlides().get(0);
 
         Map<String,HSLFTextShape> map = new HashMap<String,HSLFTextShape>();
-        HSLFShape[] shape = slide.getShapes();
-        for (int i = 0; i < shape.length; i++) {
-            if(shape[i] instanceof HSLFTextShape){
-                HSLFTextShape tx = (HSLFTextShape)shape[i];
+        for (HSLFShape shape : slide.getShapes()) {
+            if(shape instanceof HSLFTextShape){
+                HSLFTextShape tx = (HSLFTextShape)shape;
                 map.put(tx.getText(), tx);
             }
         }
@@ -216,20 +194,20 @@ public final class TestTextShape {
     public void bug52599() throws IOException {
         HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream("52599.ppt"));
 
-        HSLFSlide slide = ppt.getSlides()[0];
-        HSLFShape[] sh = slide.getShapes();
-        assertEquals(3, sh.length);
-
-        HSLFTextShape sh0 = (HSLFTextShape)sh[0];
-        assertEquals(null, sh0.getText());
-        assertEquals(null, sh0.getTextParagraphs());
-
-        HSLFTextShape sh1 = (HSLFTextShape)sh[1];
-        assertEquals(null, sh1.getText());
-        assertEquals(null, sh1.getTextParagraphs());
+        HSLFSlide slide = ppt.getSlides().get(0);
+        List<HSLFShape> sh = slide.getShapes();
+        assertEquals(3, sh.size());
+
+        HSLFTextShape sh0 = (HSLFTextShape)sh.get(0);
+        assertNotNull(sh0.getTextParagraphs());
+        assertEquals("", sh0.getText());
+
+        HSLFTextShape sh1 = (HSLFTextShape)sh.get(1);
+        assertNotNull(sh1.getTextParagraphs());
+        assertEquals("", sh1.getText());
 
-        HSLFTextShape sh2 = (HSLFTextShape)sh[2];
+        HSLFTextShape sh2 = (HSLFTextShape)sh.get(2);
         assertEquals("this box should be shown just once", sh2.getText());
-        assertEquals(-1, sh2.getTextParagraphs().getIndex());
+        assertEquals(-1, sh2.getTextParagraphs().get(0).getIndex());
     }
 }



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


Mime
View raw message