Browse Source

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
tags/REL_3_8_BETA5
Nick Burch 12 years ago
parent
commit
91b198d9f6

+ 15
- 1
src/ooxml/testcases/org/apache/poi/xslf/extractor/TestXSLFPowerPointExtractor.java View File

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 {

+ 8
- 5
src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java View File

} }
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, masterText);
//assertContains(text, masterTitleText); // TODO Is this available in PPT?
//assertContains(text, masterRandomText); // TODO Extract
assertContains(text, masterFooterText);
} }


public void testMasterText() throws Exception { public void testMasterText() throws Exception {
// 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);
} }



BIN
test-data/slideshow/WithMaster.ppt View File


BIN
test-data/slideshow/WithMaster.pptx View File


Loading…
Cancel
Save