You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlgraphics.apache.org by ss...@apache.org on 2025/01/14 12:12:04 UTC

(xmlgraphics-fop) branch main updated: FOP-3229: Allow external-graphic role as artifact

This is an automated email from the ASF dual-hosted git repository.

ssteiner pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/xmlgraphics-fop.git


The following commit(s) were added to refs/heads/main by this push:
     new 3739dddfb FOP-3229: Allow external-graphic role as artifact
3739dddfb is described below

commit 3739dddfb4f9740253ca51240146b90cec908782
Author: Simon Steiner <ss...@apache.org>
AuthorDate: Tue Jan 14 12:11:52 2025 +0000

    FOP-3229: Allow external-graphic role as artifact
---
 .../fo/FO2StructureTreeConverter.java              |  2 ++
 .../fo/FO2StructureTreeConverterTestCase.java      | 22 ++++++++++++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/fop-core/src/main/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverter.java b/fop-core/src/main/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverter.java
index 060316bce..4e2690b1c 100644
--- a/fop-core/src/main/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverter.java
+++ b/fop-core/src/main/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverter.java
@@ -604,12 +604,14 @@ public class FO2StructureTreeConverter extends DelegatingFOEventHandler {
 
     @Override
     public void image(final ExternalGraphic eg) {
+        handleStartArtifact(eg);
         content(new Event(this) {
             public void run() {
                 eventHandler.image(eg);
             }
         }, true);
         super.image(eg);
+        handleEndArtifact(eg);
     }
 
     @Override
diff --git a/fop-core/src/test/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverterTestCase.java b/fop-core/src/test/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverterTestCase.java
index c3ae3e740..bc01abd51 100644
--- a/fop-core/src/test/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverterTestCase.java
+++ b/fop-core/src/test/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverterTestCase.java
@@ -210,6 +210,28 @@ public class FO2StructureTreeConverterTestCase {
                         + "</structure-tree-sequence>");
     }
 
+    @Test
+    public void testExternalGraphicArtifact() throws Exception {
+        String fo = "<fo:root xmlns:fo=\"http://www.w3.org/1999/XSL/Format\">\n"
+                + "  <fo:layout-master-set>\n"
+                + "    <fo:simple-page-master master-name=\"simple\" page-height=\"27.9cm\" page-width=\"21.6cm\">\n"
+                + "      <fo:region-body />\n"
+                + "    </fo:simple-page-master>\n"
+                + "  </fo:layout-master-set>\n"
+                + "  <fo:page-sequence master-reference=\"simple\">\n"
+                + "    <fo:flow flow-name=\"xsl-region-body\">\n"
+                + "<fo:block><fo:external-graphic src=\"test/resources/fop/image/logo.jpg\" role=\"artifact\"/>"
+                + "</fo:block></fo:flow>\n"
+                + "  </fo:page-sequence>\n"
+                + "</fo:root>\n";
+        compare(fo, "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?><structure-tree-sequence>"
+                + "<structure-tree xmlns=\"http://xmlgraphics.apache.org/fop/intermediate\" "
+                + "xmlns:foi=\"http://xmlgraphics.apache.org/fop/internal\" "
+                + "xmlns:fox=\"http://xmlgraphics.apache.org/fop/extensions\">"
+                + "<fo:flow xmlns:fo=\"http://www.w3.org/1999/XSL/Format\" flow-name=\"xsl-region-body\">"
+                + "<fo:block/></fo:flow></structure-tree></structure-tree-sequence>");
+    }
+
     private void compare(final String fo, String tree) throws Exception {
         foLoader = new FOLoader("") {
             public InputStream getFoInputStream() {


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