Tweak the HSLF and XSLF tests for master slide text to cover more (some of which is disabled for now)

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1175870 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2011-09-26 13:48:59 +00:00
parent d2dd89ea6a
commit 91b198d9f6
4 changed files with 23 additions and 6 deletions

View File

@ -181,7 +181,21 @@ public class TestXSLFPowerPointExtractor extends TestCase {
assertTrue(text.length() > 0);
// Check master text is there
assertTrue("Unable to find expected word in text\n" + text, text.contains("Master footer is here"));
assertTrue("Unable to find expected word in text\n" + text,
text.contains("Footer from the master slide"));
// Check the whole text
assertEquals(
"First page title\n" +
"First page subtitle\n" +
// "This text comes from the Master Slide\n" + // TODO
// "This is the Master Title\n" + // TODO
"\n" + // TODO Should be the above
"2nd page subtitle\n" +
// "This text comes from the Master Slide\n" + // TODO
"Footer from the master slide\n"
, text
);
}
public void testTable() throws Exception {

View File

@ -274,14 +274,17 @@ public final class TestExtractor extends TestCase {
}
public void testSlideMasterText() throws Exception {
String masterText = "Master footer is here";
String masterTitleText = "This is the Master Title";
String masterRandomText = "This text comes from the Master Slide";
String masterFooterText = "Footer from the master slide";
HSLFSlideShow hslf = new HSLFSlideShow(slTests.openResourceAsStream("WithMaster.ppt"));
ppe = new PowerPointExtractor(hslf);
String text = ppe.getText();
assertContains(text, "Master");
assertContains(text, masterText);
//assertContains(text, masterTitleText); // TODO Is this available in PPT?
//assertContains(text, masterRandomText); // TODO Extract
assertContains(text, masterFooterText);
}
public void testMasterText() throws Exception {
@ -299,13 +302,13 @@ public final class TestExtractor extends TestCase {
// Now with another file only containing master text
// Will always show up
String masterText = "Master footer is here";
String masterText = "Footer from the master slide";
HSLFSlideShow hslf = new HSLFSlideShow(slTests.openResourceAsStream("WithMaster.ppt"));
ppe = new PowerPointExtractor(hslf);
text = ppe.getText();
assertContains(text, "Master");
assertContains(text.toLowerCase(), "master");
assertContains(text, masterText);
}

Binary file not shown.

Binary file not shown.