Fixes/Updates to tests to go with big change in how slides/notes are tied to their text

git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@389287 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2006-03-27 21:36:00 +00:00
parent 5d1dd22d12
commit 2dde4d5774
5 changed files with 49 additions and 20 deletions

View File

@ -58,6 +58,6 @@ public class TestSlideChangeNotes extends TestCase {
slideOne.setNotes(notesOne);
assertEquals(notesOne.getSheetNumber(), sa.getNotesID());
assertEquals(notesOne._getSheetNumber(), sa.getNotesID());
}
}

View File

@ -42,7 +42,8 @@ public class TestSlides extends TestCase {
Slide s1 = ppt.createSlide();
assertTrue(ppt.getSlides().length == 1);
assertEquals(3, s1.getSheetNumber());
assertEquals(3, s1._getSheetRefId());
assertEquals(256, s1._getSheetNumber());
assertEquals(1, s1.getSlideNumber());
//serialize and read again
@ -64,12 +65,14 @@ public class TestSlides extends TestCase {
Slide s1 = ppt.createSlide();
assertTrue(ppt.getSlides().length == 1);
assertEquals(3, s1.getSheetNumber());
assertEquals(3, s1._getSheetRefId());
assertEquals(256, s1._getSheetNumber());
assertEquals(1, s1.getSlideNumber());
Slide s2 = ppt.createSlide();
assertTrue(ppt.getSlides().length == 2);
assertEquals(4, s2.getSheetNumber());
assertEquals(4, s2._getSheetRefId());
assertEquals(257, s2._getSheetNumber());
assertEquals(2, s2.getSlideNumber());
//serialize and read again
@ -91,17 +94,20 @@ public class TestSlides extends TestCase {
Slide s1 = ppt.createSlide();
assertTrue(ppt.getSlides().length == 1);
assertEquals(3, s1.getSheetNumber());
assertEquals(3, s1._getSheetRefId());
assertEquals(256, s1._getSheetNumber());
assertEquals(1, s1.getSlideNumber());
Slide s2 = ppt.createSlide();
assertTrue(ppt.getSlides().length == 2);
assertEquals(4, s2.getSheetNumber());
assertEquals(4, s2._getSheetRefId());
assertEquals(257, s2._getSheetNumber());
assertEquals(2, s2.getSlideNumber());
Slide s3 = ppt.createSlide();
assertTrue(ppt.getSlides().length == 3);
assertEquals(5, s3.getSheetNumber());
assertEquals(5, s3._getSheetRefId());
assertEquals(258, s3._getSheetNumber());
assertEquals(3, s3.getSlideNumber());
//serialize and read again

View File

@ -49,25 +49,31 @@ public class TestCounts extends TestCase {
assertEquals(1, slides[0].getSlideNumber());
assertEquals(2, slides[1].getSlideNumber());
// The internal IDs are 4 and 6
assertEquals(4, slides[0].getSheetNumber());
assertEquals(6, slides[1].getSheetNumber());
// The ref IDs are 4 and 6
assertEquals(4, slides[0]._getSheetRefId());
assertEquals(6, slides[1]._getSheetRefId());
// These are slides 1+2 -> 256+257
assertEquals(256, slides[0]._getSheetNumber());
assertEquals(257, slides[1]._getSheetNumber());
}
public void testNotesCount() throws Exception {
Notes[] notes = ss.getNotes();
// Two sheets -> two notes, plus the notes on the slide master
assertEquals(3, notes.length);
// Two sheets -> two notes
// Note: there are also notes on the slide master
//assertEquals(3, notes.length); // When we do slide masters
assertEquals(2, notes.length);
// First is for master
assertEquals(-2147483648, notes[0].getSlideInternalNumber());
//assertEquals(-2147483648, notes[0]._getSheetNumber()); // When we do slide masters
// Next two are for the two slides
assertEquals(256, notes[1].getSlideInternalNumber());
assertEquals(257, notes[2].getSlideInternalNumber());
assertEquals(256, notes[0]._getSheetNumber());
assertEquals(257, notes[1]._getSheetNumber());
// They go between the slides
assertEquals(5, notes[1].getSheetNumber());
assertEquals(7, notes[2].getSheetNumber());
// They happen to go between the two slides in Ref terms
assertEquals(5, notes[0]._getSheetRefId());
assertEquals(7, notes[1]._getSheetRefId());
}
}

View File

@ -41,7 +41,7 @@ public class TestNotesText extends TestCase {
}
public void testNotesOne() throws Exception {
Notes notes = ss.getNotes()[1];
Notes notes = ss.getNotes()[0];
String[] expectText = new String[] {"These are the notes for page 1"};
assertEquals(expectText.length, notes.getTextRuns().length);
@ -51,7 +51,7 @@ public class TestNotesText extends TestCase {
}
public void testNotesTwo() throws Exception {
Notes notes = ss.getNotes()[2];
Notes notes = ss.getNotes()[1];
String[] expectText = new String[] {"These are the notes on page two, again lacking formatting"};
assertEquals(expectText.length, notes.getTextRuns().length);
for(int i=0; i<expectText.length; i++) {

View File

@ -20,9 +20,11 @@ public class TestRichTextRun extends TestCase {
private SlideShow ss;
private SlideShow ssRichA;
private SlideShow ssRichB;
private SlideShow ssRichC;
private HSLFSlideShow hss;
private HSLFSlideShow hssRichA;
private HSLFSlideShow hssRichB;
private HSLFSlideShow hssRichC;
protected void setUp() throws Exception {
String dirname = System.getProperty("HSLF.testdata.path");
@ -41,6 +43,12 @@ public class TestRichTextRun extends TestCase {
filename = dirname + "/Single_Coloured_Page_With_Fonts_and_Alignments.ppt";
hssRichB = new HSLFSlideShow(filename);
ssRichB = new SlideShow(hssRichB);
// Rich test file C - has paragraph styles that run out before
// the character ones do
filename = dirname + "/ParagraphStylesShorterThanCharStyles.ppt";
hssRichC = new HSLFSlideShow(filename);
ssRichC = new SlideShow(hssRichC);
}
/**
@ -194,4 +202,13 @@ public class TestRichTextRun extends TestCase {
assertEquals("Courier", rtrRRa.getFontName());
}
}
/**
* Test that we can do the right things when the paragraph styles
* run out before the character styles do
* NOTE: Disabled, as we can't currently do this!
*/
public void BROKENtestParagraphStylesShorterTheCharStyles() {
// TODO
}
}