Skip to content

Commit

Permalink
FOP-3229: Allow external-graphic role as artifact
Browse files Browse the repository at this point in the history
  • Loading branch information
simonsteiner1984 committed Jan 14, 2025
1 parent 7f201b3 commit 3739ddd
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -604,12 +604,14 @@ public void run() {

@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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,28 @@ public void testRemoveTableHeader() throws Exception {
+ "</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() {
Expand Down

0 comments on commit 3739ddd

Please sign in to comment.