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/03/20 00:44:25 UTC
svn commit: r1667902 [8/8] - in /poi/branches/common_sl/src:
examples/src/org/apache/poi/hslf/examples/
examples/src/org/apache/poi/hssf/usermodel/examples/
examples/src/org/apache/poi/xslf/usermodel/
examples/src/org/apache/poi/xssf/usermodel/examples...
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=1667902&r1=1667901&r2=1667902&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 Mar 19 23:44:23 2015
@@ -19,6 +19,7 @@ package org.apache.poi.hslf.usermodel;
import junit.framework.TestCase;
+
import org.apache.poi.hslf.*;
import org.apache.poi.hslf.model.*;
import org.apache.poi.POIDataSamples;
@@ -30,16 +31,16 @@ import org.apache.poi.POIDataSamples;
*/
public final class TestSheetText extends TestCase {
// SlideShow primed on the test data
- private SlideShow ss;
+ private HSLFSlideShow ss;
public TestSheetText() 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);
}
public void testSheetOne() {
- Sheet slideOne = ss.getSlides()[0];
+ HSLFSheet slideOne = ss.getSlides()[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);
@@ -49,7 +50,7 @@ public final class TestSheetText extends
}
public void testSheetTwo() {
- Sheet slideTwo = ss.getSlides()[1];
+ 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.getTextRuns().length);
for(int i=0; i<expectText.length; i++) {
@@ -64,15 +65,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);
// Check text on first slide
- Slide s = sss.getSlides()[0];
+ HSLFSlide s = sss.getSlides()[0];
String exp =
"Realizing the Development Dividend:\n" +
"Community Capacity Building and CDM.\n" +
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=1667902&r1=1667901&r2=1667902&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 Mar 19 23:44:23 2015
@@ -18,6 +18,7 @@
package org.apache.poi.hslf.usermodel;
import junit.framework.TestCase;
+
import org.apache.poi.hslf.*;
import org.apache.poi.hslf.model.*;
import org.apache.poi.POIDataSamples;
@@ -31,16 +32,16 @@ public final class TestSlideOrdering ext
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);
+ 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);
}
/**
@@ -49,8 +50,8 @@ public final class TestSlideOrdering ext
public void testSimpleCase() {
assertEquals(2, ssA.getSlides().length);
- Slide s1 = ssA.getSlides()[0];
- Slide s2 = ssA.getSlides()[1];
+ HSLFSlide s1 = ssA.getSlides()[0];
+ HSLFSlide s2 = ssA.getSlides()[1];
String[] firstTRs = new String[] { "This is a test title", "This is the title on page 2" };
@@ -64,9 +65,9 @@ public final class TestSlideOrdering ext
public void testComplexCase() {
assertEquals(3, ssB.getSlides().length);
- Slide s1 = ssB.getSlides()[0];
- Slide s2 = ssB.getSlides()[1];
- Slide s3 = ssB.getSlides()[2];
+ 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" };
@@ -86,8 +87,8 @@ 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));
+ HSLFSlide[] slide = ppt.getSlides();
assertEquals(titles.length, slide.length);
for (int i = 0; i < slide.length; i++) {
Modified: poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSoundData.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSoundData.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSoundData.java (original)
+++ poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSoundData.java Thu Mar 19 23:44:23 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/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestTable.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestTable.java?rev=1667902&r1=1667901&r2=1667902&view=diff
==============================================================================
--- poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestTable.java (original)
+++ poi/branches/common_sl/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestTable.java Thu Mar 19 23:44:23 2015
@@ -22,9 +22,9 @@ package org.apache.poi.hslf.usermodel;
import junit.framework.TestCase;
import org.apache.poi.hslf.model.HSLFShape;
-import org.apache.poi.hslf.model.Slide;
+import org.apache.poi.hslf.model.HSLFSlide;
import org.apache.poi.hslf.model.Table;
-import org.apache.poi.hslf.model.TextRun;
+import org.apache.poi.hslf.model.HSLFTextParagraph;
import org.apache.poi.POIDataSamples;
@@ -40,18 +40,18 @@ public final class TestTable extends Tes
}
public void testTable() throws Exception {
- SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("54111.ppt"));
+ HSLFSlideShow ppt = new HSLFSlideShow(_slTests.openResourceAsStream("54111.ppt"));
assertTrue("No Exceptions while reading file", true);
- final Slide[] slides = ppt.getSlides();
+ final HSLFSlide[] slides = ppt.getSlides();
assertEquals(1, slides.length);
checkSlide(slides[0]);
}
- private void checkSlide(final Slide s) {
- TextRun[] textRuns = s.getTextRuns();
+ private void checkSlide(final HSLFSlide s) {
+ HSLFTextParagraph[] textRuns = s.getTextRuns();
assertEquals(2, textRuns.length);
- RichTextRun textRun = textRuns[0].getRichTextRuns()[0];
+ HSLFTextRun textRun = textRuns[0].getRichTextRuns()[0];
assertEquals("Table sample", textRun.getRawText().trim());
assertEquals(1, textRuns[0].getRichTextRuns().length);
assertFalse(textRun.isBullet());
@@ -66,7 +66,7 @@ public final class TestTable extends Tes
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), table.getCell(0, x).getTextParagraph().getRawText());
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