poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kiwiwi...@apache.org
Subject svn commit: r1742816 - in /poi: site/src/documentation/content/xdocs/status.xml trunk/src/ooxml/java/org/apache/poi/POIXMLDocumentPart.java trunk/src/ooxml/testcases/org/apache/poi/xslf/TestXSLFBugs.java
Date Sun, 08 May 2016 13:28:11 GMT
Author: kiwiwings
Date: Sun May  8 13:28:11 2016
New Revision: 1742816

URL: http://svn.apache.org/viewvc?rev=1742816&view=rev
Log:
#59434 - Cannot add a picture on a slide that already have an image with an hyperlink on it

Modified:
    poi/site/src/documentation/content/xdocs/status.xml
    poi/trunk/src/ooxml/java/org/apache/poi/POIXMLDocumentPart.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/TestXSLFBugs.java

Modified: poi/site/src/documentation/content/xdocs/status.xml
URL: http://svn.apache.org/viewvc/poi/site/src/documentation/content/xdocs/status.xml?rev=1742816&r1=1742815&r2=1742816&view=diff
==============================================================================
--- poi/site/src/documentation/content/xdocs/status.xml (original)
+++ poi/site/src/documentation/content/xdocs/status.xml Sun May  8 13:28:11 2016
@@ -40,6 +40,7 @@
     </devs>
 
     <release version="3.15-beta2" date="2016-07-??">
+        <action dev="PD" type="fix" fixes-bug="59434">Cannot add a picture on a slide
that already have an image with an hyperlink on it</action>
         <action dev="PD" type="fix" fixes-bug="59383">SS Common performance regression:
DataFormatter no longer caches formats</action>
         <action dev="PD" type="fix" fixes-bug="59327">HSLF/XSLF: Setting text direction
on a table cell has no effect</action>
         <action dev="PD" type="add" fixes-bug="58648">Regression: Fix handling of whitespaces
in formulas after it was slightly broken by the changes to support the intersection operator</action>

Modified: poi/trunk/src/ooxml/java/org/apache/poi/POIXMLDocumentPart.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/POIXMLDocumentPart.java?rev=1742816&r1=1742815&r2=1742816&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/POIXMLDocumentPart.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/POIXMLDocumentPart.java Sun May  8 13:28:11 2016
@@ -359,6 +359,9 @@ public class POIXMLDocumentPart {
         String ppn = part.getPackagePart().getPartName().getName();
         try {
             for (PackageRelationship pr : packagePart.getRelationships()) {
+                if (pr.getTargetMode() == TargetMode.EXTERNAL) {
+                    continue;
+                }
                 PackagePart pp = packagePart.getRelatedPart(pr);
                 if (ppn.equals(pp.getPartName().getName())) {
                     return pr;

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/TestXSLFBugs.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/TestXSLFBugs.java?rev=1742816&r1=1742815&r2=1742816&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/TestXSLFBugs.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/TestXSLFBugs.java Sun May  8 13:28:11
2016
@@ -37,13 +37,15 @@ import java.util.Collection;
 
 import javax.imageio.ImageIO;
 
+import org.apache.poi.POIDataSamples;
 import org.apache.poi.POIXMLDocumentPart;
 import org.apache.poi.POIXMLDocumentPart.RelationPart;
-import org.apache.poi.sl.usermodel.PaintStyle;
+import org.apache.poi.sl.usermodel.PictureData;
 import org.apache.poi.sl.usermodel.PictureData.PictureType;
 import org.apache.poi.xslf.usermodel.DrawingParagraph;
 import org.apache.poi.xslf.usermodel.DrawingTextBody;
 import org.apache.poi.xslf.usermodel.XMLSlideShow;
+import org.apache.poi.xslf.usermodel.XSLFHyperlink;
 import org.apache.poi.xslf.usermodel.XSLFPictureData;
 import org.apache.poi.xslf.usermodel.XSLFPictureShape;
 import org.apache.poi.xslf.usermodel.XSLFRelation;
@@ -56,7 +58,8 @@ import org.junit.Test;
 
 
 public class TestXSLFBugs {
-
+    private static final POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
+    
     @Test
     public void bug51187() throws Exception {
        XMLSlideShow ss1 = XSLFTestDataSamples.openSampleDocument("51187.pptx");
@@ -416,15 +419,17 @@ public class TestXSLFBugs {
     }
 
     @Test
-    public void bug55791a() {
+    public void bug55791a() throws IOException {
         XMLSlideShow ppt = XSLFTestDataSamples.openSampleDocument("45541_Footer.pptx");
         removeAndCreateSlide(ppt);
+        ppt.close();
     }
 
     @Test
-    public void bug55791b() {
+    public void bug55791b() throws IOException {
         XMLSlideShow ppt = XSLFTestDataSamples.openSampleDocument("SampleShow.pptx");
         removeAndCreateSlide(ppt);
+        ppt.close();
     }
 
     private void removeAndCreateSlide(XMLSlideShow ppt) {
@@ -434,10 +439,37 @@ public class TestXSLFBugs {
     }
 
     @Test
-    public void blibFillAlternateContent() throws IOException  {
+    public void blibFillAlternateContent() throws IOException {
         XMLSlideShow ppt = XSLFTestDataSamples.openSampleDocument("2411-Performance_Up.pptx");
         XSLFPictureShape ps = (XSLFPictureShape)ppt.getSlides().get(4).getShapes().get(0);
         assertNotNull(ps.getPictureData());
         ppt.close();
     }
+
+    @Test
+    public void bug59434() throws IOException {
+        String url1 = "http://poi.apache.org/changes.html";
+        String url2 = "http://poi.apache.org/faq.html";
+        XMLSlideShow ppt1 = new XMLSlideShow();
+        PictureData pd1 = ppt1.addPicture(slTests.readFile("tomcat.png"), PictureType.PNG);
+        PictureData pd2 = ppt1.addPicture(slTests.readFile("santa.wmf"), PictureType.WMF);
+        XSLFSlide slide = ppt1.createSlide();
+        XSLFPictureShape ps1 = slide.createPicture(pd1);
+        ps1.setAnchor(new Rectangle2D.Double(20, 20, 100, 100));
+        XSLFHyperlink hl1 = ps1.createHyperlink();
+        hl1.linkToUrl(url1);
+        XSLFPictureShape ps2 = slide.createPicture(pd2);
+        ps2.setAnchor(new Rectangle2D.Double(120, 120, 100, 100));
+        XSLFHyperlink hl2 = ps2.createHyperlink();
+        hl2.linkToUrl(url2);
+        XMLSlideShow ppt2 = XSLFTestDataSamples.writeOutAndReadBack(ppt1);
+        ppt1.close();
+        slide = ppt2.getSlides().get(0);
+        ps1 = (XSLFPictureShape)slide.getShapes().get(0);
+        ps2 = (XSLFPictureShape)slide.getShapes().get(1);
+        assertEquals(url1, ps1.getHyperlink().getAddress());
+        assertEquals(url2, ps2.getHyperlink().getAddress());
+    
+        ppt2.close();
+    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message