From 09b3c01f054367cd14237cac8dd2cdfe6eb594a4 Mon Sep 17 00:00:00 2001 From: Andreas Beeker Date: Tue, 29 Nov 2016 22:41:26 +0000 Subject: [PATCH] #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 --- build.xml | 189 +++++++++--------- .../java/org/apache/poi/util/OOXMLLite.java | 13 +- .../poi/xslf/usermodel/TestXSLFTextShape.java | 13 ++ 3 files changed, 122 insertions(+), 93 deletions(-) diff --git a/build.xml b/build.xml index ba744faf4a..07b731b7f2 100644 --- a/build.xml +++ b/build.xml @@ -89,7 +89,7 @@ under the License. - + @@ -287,7 +287,7 @@ under the License. - + @@ -298,8 +298,8 @@ under the License. - - + + @@ -381,7 +381,7 @@ under the License. - + @@ -393,7 +393,7 @@ under the License. - + @@ -435,6 +435,11 @@ under the License. + + + + + @@ -1264,6 +1269,7 @@ under the License. + @@ -1272,15 +1278,15 @@ under the License. - - - - - - - - - + + + + + + + + + @@ -1326,6 +1332,7 @@ under the License. + @@ -1371,6 +1378,7 @@ under the License. + @@ -1415,12 +1423,12 @@ under the License. - + - + @@ -1487,6 +1495,7 @@ under the License. + @@ -1515,8 +1524,8 @@ under the License. - - + + @@ -1532,6 +1541,7 @@ under the License. + @@ -1577,8 +1587,8 @@ under the License. - - + + @@ -1624,6 +1634,7 @@ under the License. + @@ -2078,7 +2089,7 @@ under the License. - + @@ -2159,10 +2170,10 @@ under the License. - + - - + + @@ -2171,10 +2182,10 @@ under the License. - @@ -2201,16 +2212,16 @@ under the License. - - + + - - - + + + @@ -2489,7 +2500,7 @@ under the License. - + - - - - - - - - - - - - - + + + + + + + + + + + + + - var bytes = Number(attributes.get("bytes")); - var mega = String((bytes/(1024.0*1024.0)).toFixed(2)); + var bytes = Number(attributes.get("bytes")); + var mega = String((bytes/(1024.0*1024.0)).toFixed(2)); project.setProperty(attributes.get("property"), mega); - + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - + + - + - - - - - + + + + + - - + + @@ -2612,12 +2623,12 @@ under the License. - + - ${rel_date} - POI ${version.id} available

The Apache POI team is pleased to announce the release of ${version.id}. Featured are a handful of new areas of functionality and numerous bug fixes.

@@ -2647,10 +2658,10 @@ under the License. (${bin-zip-size} MB, signature (.asc))
MD5 checksum: - ${bin-zip-md5} + ${bin-zip-md5}
SHA1 checksum: - ${bin-zip-sha1} + ${bin-zip-sha1} @@ -2663,20 +2674,20 @@ under the License. ${src-tar-md5}
SHA1 checksum: - ${src-tar-sha1} + ${src-tar-sha1}
  • poi-src-${version.id}-${file_date}.zip (${src-zip-size} MB, signature (.asc))
    MD5 checksum: - ${src-zip-md5} + ${src-zip-md5}
    SHA1 checksum: - ${src-zip-sha1} + ${src-zip-sha1}
  • ]]>
    -
    +
    \ No newline at end of file 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); -- 2.39.5