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 40d19a5fa3
commit 8de1ce7c6a
4 changed files with 23 additions and 6 deletions

View File

@ -181,7 +181,21 @@ public class TestXSLFPowerPointExtractor extends TestCase {
assertTrue(text.length() > 0); assertTrue(text.length() > 0);
// Check master text is there // 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 { public void testTable() throws Exception {

View File

@ -274,14 +274,17 @@ public final class TestExtractor extends TestCase {
} }
public void testSlideMasterText() throws Exception { 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")); HSLFSlideShow hslf = new HSLFSlideShow(slTests.openResourceAsStream("WithMaster.ppt"));
ppe = new PowerPointExtractor(hslf); ppe = new PowerPointExtractor(hslf);
String text = ppe.getText(); String text = ppe.getText();
assertContains(text, "Master"); //assertContains(text, masterTitleText); // TODO Is this available in PPT?
assertContains(text, masterText); //assertContains(text, masterRandomText); // TODO Extract
assertContains(text, masterFooterText);
} }
public void testMasterText() throws Exception { public void testMasterText() throws Exception {
@ -299,13 +302,13 @@ public final class TestExtractor extends TestCase {
// Now with another file only containing master text // Now with another file only containing master text
// Will always show up // 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")); HSLFSlideShow hslf = new HSLFSlideShow(slTests.openResourceAsStream("WithMaster.ppt"));
ppe = new PowerPointExtractor(hslf); ppe = new PowerPointExtractor(hslf);
text = ppe.getText(); text = ppe.getText();
assertContains(text, "Master"); assertContains(text.toLowerCase(), "master");
assertContains(text, masterText); assertContains(text, masterText);
} }

Binary file not shown.

Binary file not shown.