diff options
2 files changed, 24 insertions, 0 deletions
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() { |