From: Simon Steiner Date: Mon, 16 May 2022 11:30:52 +0000 (+0000) Subject: FOP-3071: Write mediummap before pagegroup X-Git-Tag: fop-2_8~2^2~42 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0b15f2e0999a587727ac23a707512046dfb1fec8;p=xmlgraphics-fop.git FOP-3071: Write mediummap before pagegroup git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1900949 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/fop-core/src/main/java/org/apache/fop/afp/modca/InvokeMediumMap.java b/fop-core/src/main/java/org/apache/fop/afp/modca/InvokeMediumMap.java index 59d9253cf..483bf0a02 100644 --- a/fop-core/src/main/java/org/apache/fop/afp/modca/InvokeMediumMap.java +++ b/fop-core/src/main/java/org/apache/fop/afp/modca/InvokeMediumMap.java @@ -22,6 +22,7 @@ package org.apache.fop.afp.modca; import java.io.IOException; import java.io.OutputStream; +import org.apache.fop.afp.Completable; import org.apache.fop.afp.util.BinaryUtils; /** @@ -30,7 +31,7 @@ import org.apache.fop.afp.util.BinaryUtils; * the document's current environment. The Medium Map's effect on current environment * parameter values lasts until a new Medium Map is invoked. */ -public class InvokeMediumMap extends AbstractNamedAFPObject { +public class InvokeMediumMap extends AbstractNamedAFPObject implements Completable { /** * Constructor for the Invoke Medium Map @@ -54,4 +55,11 @@ public class InvokeMediumMap extends AbstractNamedAFPObject { os.write(data); } + + public void setComplete(boolean complete) { + } + + public boolean isComplete() { + return true; + } } diff --git a/fop-core/src/test/java/org/apache/fop/afp/DataStreamTestCase.java b/fop-core/src/test/java/org/apache/fop/afp/DataStreamTestCase.java index 4c6eae921..702126989 100644 --- a/fop-core/src/test/java/org/apache/fop/afp/DataStreamTestCase.java +++ b/fop-core/src/test/java/org/apache/fop/afp/DataStreamTestCase.java @@ -108,4 +108,20 @@ public class DataStreamTestCase { Assert.assertEquals((byte)data.read(), InvokeMediumMap.Type.MAP); Assert.assertEquals((byte)data.read(), InvokeMediumMap.Category.MEDIUM_MAP); } + + @Test + public void testMediumMapBeforePageGroupOnDocument() throws Exception { + ds = new DataStream(new Factory(), paintState, outStream); + ds.startDocument(); + ds.createInvokeMediumMap("test"); + ds.startPageGroup(); + ds.startPage(1, 1, 0, 1, 1); + ds.endPage(); + ds.endPageGroup(); + ds.endDocument(); + ByteArrayInputStream data = new ByteArrayInputStream(outStream.toByteArray()); + data.skip(21); + Assert.assertEquals((byte)data.read(), InvokeMediumMap.Type.MAP); + Assert.assertEquals((byte)data.read(), InvokeMediumMap.Category.MEDIUM_MAP); + } }