From: Nick Burch Date: Mon, 26 Sep 2011 13:48:59 +0000 (+0000) Subject: Tweak the HSLF and XSLF tests for master slide text to cover more (some of which... X-Git-Tag: REL_3_8_BETA5~125 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=91b198d9f6eed6610e01a1cb6fc71872f9df70c0;p=poi.git 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 --- diff --git a/src/ooxml/testcases/org/apache/poi/xslf/extractor/TestXSLFPowerPointExtractor.java b/src/ooxml/testcases/org/apache/poi/xslf/extractor/TestXSLFPowerPointExtractor.java index cfaf344be9..e26b6bf0f9 100644 --- a/src/ooxml/testcases/org/apache/poi/xslf/extractor/TestXSLFPowerPointExtractor.java +++ b/src/ooxml/testcases/org/apache/poi/xslf/extractor/TestXSLFPowerPointExtractor.java @@ -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 { diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java b/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java index 50933f4ca8..c457c9c8c4 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java @@ -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); } diff --git a/test-data/slideshow/WithMaster.ppt b/test-data/slideshow/WithMaster.ppt index 161d0a43fd..84a6d04515 100644 Binary files a/test-data/slideshow/WithMaster.ppt and b/test-data/slideshow/WithMaster.ppt differ diff --git a/test-data/slideshow/WithMaster.pptx b/test-data/slideshow/WithMaster.pptx index 70da94c5fe..a746e103ff 100644 Binary files a/test-data/slideshow/WithMaster.pptx and b/test-data/slideshow/WithMaster.pptx differ