Skip to content

Commit 3739ddd

Browse files
FOP-3229: Allow external-graphic role as artifact
1 parent 7f201b3 commit 3739ddd

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

fop-core/src/main/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverter.java

+2
Original file line numberDiff line numberDiff line change
@@ -604,12 +604,14 @@ public void run() {
604604

605605
@Override
606606
public void image(final ExternalGraphic eg) {
607+
handleStartArtifact(eg);
607608
content(new Event(this) {
608609
public void run() {
609610
eventHandler.image(eg);
610611
}
611612
}, true);
612613
super.image(eg);
614+
handleEndArtifact(eg);
613615
}
614616

615617
@Override

fop-core/src/test/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverterTestCase.java

+22
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,28 @@ public void testRemoveTableHeader() throws Exception {
210210
+ "</structure-tree-sequence>");
211211
}
212212

213+
@Test
214+
public void testExternalGraphicArtifact() throws Exception {
215+
String fo = "<fo:root xmlns:fo=\"http://www.w3.org/1999/XSL/Format\">\n"
216+
+ " <fo:layout-master-set>\n"
217+
+ " <fo:simple-page-master master-name=\"simple\" page-height=\"27.9cm\" page-width=\"21.6cm\">\n"
218+
+ " <fo:region-body />\n"
219+
+ " </fo:simple-page-master>\n"
220+
+ " </fo:layout-master-set>\n"
221+
+ " <fo:page-sequence master-reference=\"simple\">\n"
222+
+ " <fo:flow flow-name=\"xsl-region-body\">\n"
223+
+ "<fo:block><fo:external-graphic src=\"test/resources/fop/image/logo.jpg\" role=\"artifact\"/>"
224+
+ "</fo:block></fo:flow>\n"
225+
+ " </fo:page-sequence>\n"
226+
+ "</fo:root>\n";
227+
compare(fo, "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?><structure-tree-sequence>"
228+
+ "<structure-tree xmlns=\"http://xmlgraphics.apache.org/fop/intermediate\" "
229+
+ "xmlns:foi=\"http://xmlgraphics.apache.org/fop/internal\" "
230+
+ "xmlns:fox=\"http://xmlgraphics.apache.org/fop/extensions\">"
231+
+ "<fo:flow xmlns:fo=\"http://www.w3.org/1999/XSL/Format\" flow-name=\"xsl-region-body\">"
232+
+ "<fo:block/></fo:flow></structure-tree></structure-tree-sequence>");
233+
}
234+
213235
private void compare(final String fo, String tree) throws Exception {
214236
foLoader = new FOLoader("") {
215237
public InputStream getFoInputStream() {

0 commit comments

Comments
 (0)