diff options
author | Andreas Beeker <kiwiwings@apache.org> | 2016-11-29 22:41:26 +0000 |
---|---|---|
committer | Andreas Beeker <kiwiwings@apache.org> | 2016-11-29 22:41:26 +0000 |
commit | 09b3c01f054367cd14237cac8dd2cdfe6eb594a4 (patch) | |
tree | 4108c9771f5d53b36f98155a24d9a54040c2f9ed /src | |
parent | de3b03f028bd891a8448156ad6179aa670ce66f6 (diff) | |
download | poi-09b3c01f054367cd14237cac8dd2cdfe6eb594a4.tar.gz poi-09b3c01f054367cd14237cac8dd2cdfe6eb594a4.zip |
#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
Diffstat (limited to 'src')
-rw-r--r-- | src/ooxml/java/org/apache/poi/util/OOXMLLite.java | 13 | ||||
-rw-r--r-- | src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextShape.java | 13 |
2 files changed, 22 insertions, 4 deletions
diff --git a/src/ooxml/java/org/apache/poi/util/OOXMLLite.java b/src/ooxml/java/org/apache/poi/util/OOXMLLite.java index c42ba5e038..0b2c5d92a4 100644 --- a/src/ooxml/java/org/apache/poi/util/OOXMLLite.java +++ b/src/ooxml/java/org/apache/poi/util/OOXMLLite.java @@ -227,10 +227,15 @@ public final class OOXMLLite { cls = cls.replace(".class", ""); - Class<?> testclass = Class.forName(cls); - if (TestCase.class.isAssignableFrom(testclass) - || checkForTestAnnotation(testclass)) { - out.add(testclass); + 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; } } } diff --git a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextShape.java b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextShape.java index 8ae19f2659..771fd9d915 100644 --- a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextShape.java +++ b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextShape.java @@ -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);
|