You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by lf...@apache.org on 2015/02/14 11:55:13 UTC

svn commit: r1659776 - in /xmlgraphics/fop/trunk: src/java/org/apache/fop/render/pdf/extensions/ test/layoutengine/standard-testcases/

Author: lfurini
Date: Sat Feb 14 10:55:13 2015
New Revision: 1659776

URL: http://svn.apache.org/r1659776
Log:
FOP-2348:
  - fixing inconsistencies in attribute names when serializing / deserializing extension data, which caused data loss
  - adding testcase to avoid unsignalled regressions

Added:
    xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/pdf-embedded-file-extension.xml
Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pdf/extensions/PDFEmbeddedFileAttachment.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pdf/extensions/PDFExtensionHandler.java

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pdf/extensions/PDFEmbeddedFileAttachment.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pdf/extensions/PDFEmbeddedFileAttachment.java?rev=1659776&r1=1659775&r2=1659776&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pdf/extensions/PDFEmbeddedFileAttachment.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pdf/extensions/PDFEmbeddedFileAttachment.java Sat Feb 14 10:55:13 2015
@@ -40,7 +40,7 @@ public class PDFEmbeddedFileAttachment e
     private static final String ATT_SRC = "src";
 
     /** a description of the file to be embedded */
-    private static final String ATT_DESC = "desc";
+    private static final String ATT_DESC = "description";
 
     /** filename attribute */
     private String filename;

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pdf/extensions/PDFExtensionHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pdf/extensions/PDFExtensionHandler.java?rev=1659776&r1=1659775&r2=1659776&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pdf/extensions/PDFExtensionHandler.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pdf/extensions/PDFExtensionHandler.java Sat Feb 14 10:55:13 2015
@@ -154,7 +154,7 @@ public class PDFExtensionHandler extends
     public void endElement(String uri, String localName, String qName) throws SAXException {
         if (PDFExtensionAttachment.CATEGORY.equals(uri)) {
             if (PDFEmbeddedFileAttachment.ELEMENT.equals(localName)) {
-                String name = lastAttributes.getValue("name");
+                String name = lastAttributes.getValue("filename");
                 String src = lastAttributes.getValue("src");
                 String desc = lastAttributes.getValue("description");
                 this.lastAttributes = null;

Added: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/pdf-embedded-file-extension.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/pdf-embedded-file-extension.xml?rev=1659776&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/pdf-embedded-file-extension.xml (added)
+++ xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/pdf-embedded-file-extension.xml Sat Feb 14 10:55:13 2015
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<!-- $Id$ -->
+<testcase>
+  <info>
+    <p>
+      This test checks the PDF embedded file extension,
+      and a link to an embedded file.
+    </p>
+  </info>
+  <fo>
+    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
+      <fo:layout-master-set>
+        <fo:simple-page-master master-name="simple">
+          <fo:region-body />
+        </fo:simple-page-master>
+      </fo:layout-master-set>
+      <fo:declarations>
+        <pdf:embedded-file filename="test.png" description="This is just a png image" src="../resources/images/arrow_down_large.png"/>
+      </fo:declarations>
+      <fo:page-sequence master-reference="simple">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block>
+            See the 
+            <fo:basic-link external-destination="url(embedded-file:test.png)">attached file</fo:basic-link>
+          </fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+    </fo:root>
+  </fo>
+  <checks xmlns:pdf="apache:fop:extensions:pdf">
+    <eval expected="test.png" xpath="//extension-attachments/pdf:embedded-file/@filename"/>
+    <eval expected="This is just a png image" xpath="//extension-attachments/pdf:embedded-file/@description"/>
+    <eval expected="../resources/images/arrow_down_large.png" xpath="//extension-attachments/pdf:embedded-file/@src"/>
+    <eval expected="newWindow=false,dest=embedded-file:test.png" xpath="//inlineparent/@external-link"/>
+  </checks>
+  <if-checks xmlns:if="http://xmlgraphics.apache.org/fop/intermediate" xmlns:nav="http://xmlgraphics.apache.org/fop/intermediate/document-navigation" xmlns:pdf="apache:fop:extensions:pdf">
+    <eval expected="test.png" xpath="//if:header/pdf:embedded-file/@filename"/>
+    <eval expected="This is just a png image" xpath="//if:header/pdf:embedded-file/@description"/>
+    <eval expected="../resources/images/arrow_down_large.png" xpath="//if:header/pdf:embedded-file/@src"/>
+    <eval expected="embedded-file:test.png" xpath="//if:page-trailer/nav:link/nav:goto-uri/@uri"/>
+  </if-checks>
+</testcase>
\ No newline at end of file



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