#60427 - Creating pictures in PowerPoint slides requires scratchpad-jar for adding WMF images

more cases

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1771974 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andreas Beeker 2016-11-29 22:41:26 +00:00
parent cc40df42ad
commit d9ef0efcdd
3 changed files with 122 additions and 93 deletions

View File

@ -381,7 +381,7 @@ under the License.
<pathelement location="${ooxml.lite.output.dir}"/> <!-- instead of ooxml-xsds.jar use the filtered classes-->
<path refid="main.classpath"/>
<pathelement location="${main.output.dir}"/>
<pathelement location="${scratchpad.output.dir}"/>
<pathelement location="${scratchpad.output.dir}" unless:true="${scratchpad.ignore}"/>
<!--path refid="ooxml.classpath"/-->
<pathelement location="${ooxml.output.dir}"/>
<pathelement location="${ooxml.output.test.dir}"/>
@ -393,7 +393,7 @@ under the License.
<path id="examples.classpath">
<path refid="main.classpath"/>
<pathelement location="${main.output.dir}"/>
<pathelement location="${scratchpad.output.dir}"/>
<pathelement location="${scratchpad.output.dir}" unless:true="${scratchpad.ignore}"/>
</path>
<path id="excelant.classpath">
@ -435,6 +435,11 @@ under the License.
</fileset>
</path>
<patternset id="exclude-scratchpad-test">
<exclude name="**/TestExtractorFactory.java" if:true="${scratchpad.ignore}"/>
<exclude name="**/OutlookTextExtactor.java" if:true="${scratchpad.ignore}"/>
</patternset>
<!-- Prints POI's Ant usage help -->
<target name="help" description="Prints Apache POI's Ant usage help">
<echo>
@ -1264,6 +1269,7 @@ under the License.
<exclude name="**/TestUnfixedBugs.java"/>
<exclude name="**/TestcaseRecordInputStream.java"/>
<exclude name="**/${testexcludepattern}.java"/>
<patternset refid="exclude-scratchpad-test" if:true="${scratchpad.ignore}"/>
</fileset>
</batchtest>
</junit>
@ -1326,6 +1332,7 @@ under the License.
<exclude name="**/TestUnfixedBugs.java"/>
<exclude name="**/TestcaseRecordInputStream.java"/>
<exclude name="**/${testexcludepattern}.java"/>
<patternset refid="exclude-scratchpad-test" if:true="${scratchpad.ignore}"/>
</fileset>
</batchtest>
</junit>
@ -1371,6 +1378,7 @@ under the License.
<include name="**/${testpattern}.java"/>
<exclude name="**/AllTests.java"/>
<exclude name="**/${testexcludepattern}.java"/>
<patternset refid="exclude-scratchpad-test" if:true="${scratchpad.ignore}"/>
</fileset>
</batchtest>
</junit>
@ -1415,7 +1423,7 @@ under the License.
<exclude name="**/All*Tests.java"/>
<exclude name="**/TestSignatureInfo.java"/>
<exclude name="**/${testexcludepattern}.java"/>
<exclude name="**/TestExtractorFactory.java" if:true="${scratchpad.ignore}"/>
<patternset refid="exclude-scratchpad-test" if:true="${scratchpad.ignore}"/>
</fileset>
</batchtest>
</junit>
@ -1487,6 +1495,7 @@ under the License.
<exclude name="**/TestUnfixedBugs.java"/>
<exclude name="**/All*Tests.java"/>
<exclude name="**/${testexcludepattern}.java"/>
<patternset refid="exclude-scratchpad-test" if:true="${scratchpad.ignore}"/>
</fileset>
</batchtest>
</junit>
@ -1532,6 +1541,7 @@ under the License.
<fileset dir="${integration.src.test}">
<include name="**/${testpattern}.java"/>
<exclude name="**/${testexcludepattern}.java"/>
<patternset refid="exclude-scratchpad-test" if:true="${scratchpad.ignore}"/>
</fileset>
</batchtest>
</junit>
@ -1624,6 +1634,7 @@ under the License.
<fileset dir="${excelant.src.test}">
<include name="**/${testpattern}.java"/>
<exclude name="**/${testexcludepattern}.java"/>
<patternset refid="exclude-scratchpad-test" if:true="${scratchpad.ignore}"/>
</fileset>
</batchtest>
</junit>

View File

@ -227,11 +227,16 @@ public final class OOXMLLite {
cls = cls.replace(".class", "");
try {
Class<?> testclass = Class.forName(cls);
if (TestCase.class.isAssignableFrom(testclass)
|| checkForTestAnnotation(testclass)) {
out.add(testclass);
}
} catch (Throwable e) {
System.out.println("Class " + cls + " is not in classpath");
return;
}
}
}

View File

@ -23,6 +23,7 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeFalse;
import static org.apache.poi.xslf.usermodel.TestXSLFSimpleShape.getSpPr;
import java.awt.Color;
@ -38,6 +39,7 @@ import org.apache.poi.sl.usermodel.SlideShowFactory;
import org.apache.poi.sl.usermodel.TextParagraph.TextAlign;
import org.apache.poi.sl.usermodel.VerticalAlignment;
import org.apache.poi.xslf.XSLFTestDataSamples;
import org.junit.BeforeClass;
import org.junit.Test;
import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBodyProperties;
import org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharacterProperties;
@ -47,6 +49,16 @@ import org.openxmlformats.schemas.presentationml.x2006.main.CTPlaceholder;
import org.openxmlformats.schemas.presentationml.x2006.main.STPlaceholderType;
public class TestXSLFTextShape {
private static boolean xslfOnly = false;
@BeforeClass
public static void checkHslf() {
try {
Class.forName("org.apache.poi.hslf.usermodel.HSLFSlideShow");
} catch (Exception e) {
xslfOnly = true;
}
}
@Test
public void testLayouts() throws IOException {
@ -919,6 +931,7 @@ public class TestXSLFTextShape {
@Test
public void metroBlob() throws IOException {
assumeFalse(xslfOnly);
File f = POIDataSamples.getSlideShowInstance().getFile("bug52297.ppt");
SlideShow<?,?> ppt = SlideShowFactory.create(f);
HSLFTextShape sh = (HSLFTextShape)ppt.getSlides().get(1).getShapes().get(3);