aboutsummaryrefslogtreecommitdiffstats
path: root/test/java
diff options
context:
space:
mode:
authorVincent Hennebert <vhennebert@apache.org>2012-05-28 16:16:23 +0000
committerVincent Hennebert <vhennebert@apache.org>2012-05-28 16:16:23 +0000
commitb0ea791fe191cd6f7593aa3ba8ca83ceacc2c1c0 (patch)
tree2786a2fbe4e86197f6ebfa06261cbf8672b967a8 /test/java
parent340025483a07776d56b655bbee3b402ba589a5b4 (diff)
parentd48e0e1f467c58a22c4d1b19591d4fa9d22aa8c6 (diff)
downloadxmlgraphics-fop-b0ea791fe191cd6f7593aa3ba8ca83ceacc2c1c0.tar.gz
xmlgraphics-fop-b0ea791fe191cd6f7593aa3ba8ca83ceacc2c1c0.zip
Merged changes from trunk up to revision 1343133
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript@1343310 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/java')
-rw-r--r--test/java/org/apache/fop/afp/AFPGraphics2DTestCase.java57
-rw-r--r--test/java/org/apache/fop/afp/fonts/CharactersetEncoderTestCase.java15
-rw-r--r--test/java/org/apache/fop/afp/goca/GraphicsSetFractionalLineWidthTestCase.java59
-rw-r--r--test/java/org/apache/fop/afp/goca/GraphicsSetLineWidthTestCase.java57
-rw-r--r--test/java/org/apache/fop/afp/ptoca/TransparentDataControlSequenceTestCase.java73
-rw-r--r--test/java/org/apache/fop/cli/CommandLineOptionsTestCase.java72
-rw-r--r--test/java/org/apache/fop/events/EventProcessingTestCase.java12
-rw-r--r--test/java/org/apache/fop/fo/properties/PropertyListMocks.java4
-rw-r--r--test/java/org/apache/fop/render/intermediate/IFStructureTreeBuilderTestCase.java6
-rw-r--r--test/java/org/apache/fop/render/ps/PSPainterTestCase.java69
-rw-r--r--test/java/org/apache/fop/render/ps/PSRenderingUtilTestCase.java45
11 files changed, 459 insertions, 10 deletions
diff --git a/test/java/org/apache/fop/afp/AFPGraphics2DTestCase.java b/test/java/org/apache/fop/afp/AFPGraphics2DTestCase.java
new file mode 100644
index 000000000..7b261d482
--- /dev/null
+++ b/test/java/org/apache/fop/afp/AFPGraphics2DTestCase.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.afp;
+
+import java.awt.BasicStroke;
+
+import org.junit.Test;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.apache.fop.afp.modca.GraphicsObject;
+import org.apache.fop.fonts.FontInfo;
+
+public class AFPGraphics2DTestCase {
+
+ private final float lineWidth = 1.0f;
+ private final float correction = 2.5f;
+ private final BasicStroke stroke = mock(BasicStroke.class);
+ private final GraphicsObject gObject = mock(GraphicsObject.class);
+ private final AFPPaintingState paintingState = mock(AFPPaintingState.class);
+ private final AFPResourceManager resourceManager = mock(AFPResourceManager.class);
+ private final AFPResourceInfo resourceInfo = mock(AFPResourceInfo.class);
+ private final FontInfo fontInfo = mock(FontInfo.class);
+ private AFPGraphics2D graphics2D = new AFPGraphics2D(false, paintingState, resourceManager, resourceInfo,
+ fontInfo);
+
+ @Test
+ public void testApplyStroke() {
+ // note: this only tests the setLineWidth in the GraphicsObject
+ float correctedLineWidth = lineWidth * correction;
+ when(stroke.getLineWidth()).thenReturn(lineWidth);
+ when(paintingState.getLineWidthCorrection()).thenReturn(correction);
+ graphics2D.setGraphicsObject(gObject);
+ graphics2D.applyStroke(stroke);
+ verify(gObject).setLineWidth(correctedLineWidth);
+ }
+
+}
diff --git a/test/java/org/apache/fop/afp/fonts/CharactersetEncoderTestCase.java b/test/java/org/apache/fop/afp/fonts/CharactersetEncoderTestCase.java
index dd776e41c..6d0daa2be 100644
--- a/test/java/org/apache/fop/afp/fonts/CharactersetEncoderTestCase.java
+++ b/test/java/org/apache/fop/afp/fonts/CharactersetEncoderTestCase.java
@@ -19,10 +19,6 @@
package org.apache.fop.afp.fonts;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.charset.CharacterCodingException;
@@ -30,6 +26,10 @@ import java.nio.charset.CharacterCodingException;
import org.junit.Before;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
/**
* Test {@link CharactersetEncoder}
*/
@@ -39,8 +39,9 @@ public class CharactersetEncoderTestCase {
@Before
public void setUp() {
- singlebyteEncoder = CharactersetEncoder.newInstance("cp500", false);
- doublebyteEncoder = CharactersetEncoder.newInstance("cp937", true);
+ singlebyteEncoder = CharactersetEncoder.newInstance("cp500", CharacterSetType.SINGLE_BYTE);
+ doublebyteEncoder = CharactersetEncoder.newInstance("cp937",
+ CharacterSetType.DOUBLE_BYTE_LINE_DATA);
}
// This is just an arbitrary CJK string
@@ -95,7 +96,7 @@ public class CharactersetEncoderTestCase {
@Test
public void testEncode() throws CharacterCodingException, IOException {
- CharactersetEncoder.EncodedChars encChars;// = doublebyteEncoder.encode(testCJKText);
+ CharactersetEncoder.EncodedChars encChars; // = doublebyteEncoder.encode(testCJKText);
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
// JAVA 1.5 has a bug in the JVM in which these err for some reason... JAVA 1.6 no issues
/*encChars.writeTo(bOut, 0, encChars.getLength());
diff --git a/test/java/org/apache/fop/afp/goca/GraphicsSetFractionalLineWidthTestCase.java b/test/java/org/apache/fop/afp/goca/GraphicsSetFractionalLineWidthTestCase.java
new file mode 100644
index 000000000..f34275de0
--- /dev/null
+++ b/test/java/org/apache/fop/afp/goca/GraphicsSetFractionalLineWidthTestCase.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// $Id$
+
+package org.apache.fop.afp.goca;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.Arrays;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public class GraphicsSetFractionalLineWidthTestCase {
+
+ private final float multiplier = 5.25f;
+ private final GraphicsSetFractionalLineWidth gsflw = new GraphicsSetFractionalLineWidth(multiplier);
+
+ @Test
+ public void testGetDataLength() {
+ assertEquals(4, gsflw.getDataLength());
+ }
+
+ @Test
+ public void testWriteToStream() throws IOException {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ gsflw.writeToStream(baos);
+ baos.close();
+ // note: 0.25 = 64/256 and 64 = 4*16, so 0x40
+ // expected: 0x11 (order code), 0x02 (2 bytes next), 0x05 (integral multiplier), 0x40 (fractional
+ // multiplier)
+ byte[] expected = new byte[] {0x11, 0x02, 0x05, 0x40};
+ assertTrue(Arrays.equals(expected, baos.toByteArray()));
+ }
+
+ @Test
+ public void testToString() {
+ // lets make sure we keep good coverage...
+ assertEquals("GraphicsSetFractionalLineWidth{multiplier=" + multiplier + "}", gsflw.toString());
+ }
+
+}
diff --git a/test/java/org/apache/fop/afp/goca/GraphicsSetLineWidthTestCase.java b/test/java/org/apache/fop/afp/goca/GraphicsSetLineWidthTestCase.java
new file mode 100644
index 000000000..c0a18a551
--- /dev/null
+++ b/test/java/org/apache/fop/afp/goca/GraphicsSetLineWidthTestCase.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// $Id$
+
+package org.apache.fop.afp.goca;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.Arrays;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public class GraphicsSetLineWidthTestCase {
+
+ private final int multiplier = 5;
+ private final GraphicsSetLineWidth gslw = new GraphicsSetLineWidth(multiplier);
+
+ @Test
+ public void testGetDataLength() {
+ assertEquals(2, gslw.getDataLength());
+ }
+
+ @Test
+ public void testWriteToStream() throws IOException {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ gslw.writeToStream(baos);
+ baos.close();
+ // expected: 0x19 (order code), 0x05 (integral multiplier)
+ byte[] expected = new byte[] {0x19, 0x05};
+ assertTrue(Arrays.equals(expected, baos.toByteArray()));
+ }
+
+ @Test
+ public void testToString() {
+ // lets make sure we keep good coverage...
+ assertEquals("GraphicsSetLineWidth{multiplier=" + multiplier + "}", gslw.toString());
+ }
+
+}
diff --git a/test/java/org/apache/fop/afp/ptoca/TransparentDataControlSequenceTestCase.java b/test/java/org/apache/fop/afp/ptoca/TransparentDataControlSequenceTestCase.java
new file mode 100644
index 000000000..338c5e6f4
--- /dev/null
+++ b/test/java/org/apache/fop/afp/ptoca/TransparentDataControlSequenceTestCase.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.afp.ptoca;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import org.junit.Test;
+
+import org.apache.fop.afp.fonts.CharactersetEncoder.EncodedChars;
+import org.apache.fop.afp.ptoca.TransparentDataControlSequence.TransparentData;
+
+import static org.apache.fop.afp.ptoca.PtocaConstants.TRANSPARENT_DATA_MAX_SIZE;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+public class TransparentDataControlSequenceTestCase {
+
+ private EncodedChars encodedChars;
+ private final OutputStream outStream = mock(OutputStream.class);
+
+ @Test
+ public void testSingleByteCharacterSet() throws IOException {
+ testTRNs(false);
+ }
+
+ @Test
+ public void testDoubleByteCharacterSets() throws IOException {
+ testTRNs(true);
+ }
+
+ public void testTRNs(boolean isDBCS) throws IOException {
+ for (int length = 100; length < 10000; length += 1000) {
+ createTRNControlSequence(isDBCS, length);
+ int maxTRNSize = TRANSPARENT_DATA_MAX_SIZE - (isDBCS ? 1 : 0);
+ int numberOfTRNs = length / maxTRNSize;
+ for (int i = 0; i < numberOfTRNs; i++) {
+ verify(encodedChars, times(1)).writeTo(outStream, i * maxTRNSize, maxTRNSize);
+ }
+ int lastOffset = numberOfTRNs * maxTRNSize;
+ verify(encodedChars, times(1)).writeTo(outStream, numberOfTRNs * maxTRNSize,
+ length - lastOffset);
+ }
+ }
+
+ private void createTRNControlSequence(boolean isDBCS, int length) throws IOException {
+ encodedChars = mock(EncodedChars.class);
+ when(encodedChars.isDBCS()).thenReturn(isDBCS);
+ when(encodedChars.getLength()).thenReturn(length);
+ for (TransparentData trn : new TransparentDataControlSequence(encodedChars)) {
+ trn.writeTo(outStream);
+ }
+ }
+}
diff --git a/test/java/org/apache/fop/cli/CommandLineOptionsTestCase.java b/test/java/org/apache/fop/cli/CommandLineOptionsTestCase.java
new file mode 100644
index 000000000..9a80fd964
--- /dev/null
+++ b/test/java/org/apache/fop/cli/CommandLineOptionsTestCase.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: CommandLineOptions.java 1293736 2012-02-26 02:29:01Z gadams $ */
+
+package org.apache.fop.cli;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+
+import org.apache.fop.apps.FOPException;
+import org.junit.Before;
+import org.junit.Test;
+
+public class CommandLineOptionsTestCase {
+
+ private final CommandLineOptions clo = new CommandLineOptions();
+ private final String commandLine = "-fo examples/fo/basic/simple.fo -print";
+ private String[] cmd;
+ private boolean parsed;
+
+ @Before
+ public void setUp() throws Exception {
+ cmd = commandLine.split(" ");
+ parsed = clo.parse(cmd);
+ }
+
+ @Test
+ public void testParse() {
+ assertTrue(parsed);
+ }
+
+ @Test
+ public void testGetOutputFormat() throws FOPException {
+ assertEquals(clo.getOutputFormat(), "application/X-fop-print");
+ }
+
+ @Test
+ public void testVandVersionSwitchs() throws FOPException, IOException {
+ // test -v
+ String cl1 = "-v";
+ String[] cmd1 = cl1.split(" ");
+ CommandLineOptions clo1 = new CommandLineOptions();
+ assertTrue(!clo1.parse(cmd1));
+ // test -version
+ String cl2 = "-version";
+ String[] cmd2 = cl2.split(" ");
+ CommandLineOptions clo2 = new CommandLineOptions();
+ assertTrue(!clo2.parse(cmd2));
+ // test -v + more switches
+ String cl3 = "-v " + commandLine;
+ String[] cmd3 = cl3.split(" ");
+ CommandLineOptions clo3 = new CommandLineOptions();
+ assertTrue(clo3.parse(cmd3));
+ }
+}
diff --git a/test/java/org/apache/fop/events/EventProcessingTestCase.java b/test/java/org/apache/fop/events/EventProcessingTestCase.java
index 8219fa71e..1d38d4ccb 100644
--- a/test/java/org/apache/fop/events/EventProcessingTestCase.java
+++ b/test/java/org/apache/fop/events/EventProcessingTestCase.java
@@ -124,4 +124,16 @@ public class EventProcessingTestCase {
doTest("inline-level.fo",
InlineLevelEventProducer.class.getName() + ".lineOverflows");
}
+
+ @Test
+ public void testViewportIPDOverflow() throws FOPException, TransformerException, IOException,
+ SAXException {
+ doTest("viewport-overflow.fo", BlockLevelEventProducer.class.getName() + ".viewportIPDOverflow");
+ }
+
+ @Test
+ public void testViewportBPDOverflow() throws FOPException, TransformerException, IOException,
+ SAXException {
+ doTest("viewport-overflow.fo", BlockLevelEventProducer.class.getName() + ".viewportBPDOverflow");
+ }
}
diff --git a/test/java/org/apache/fop/fo/properties/PropertyListMocks.java b/test/java/org/apache/fop/fo/properties/PropertyListMocks.java
index 380f6e5a8..f364c9034 100644
--- a/test/java/org/apache/fop/fo/properties/PropertyListMocks.java
+++ b/test/java/org/apache/fop/fo/properties/PropertyListMocks.java
@@ -69,6 +69,10 @@ public final class PropertyListMocks {
final Property borderCollapseProperty = mock(Property.class);
when(borderCollapseProperty.getEnum()).thenReturn(Constants.EN_SEPARATE);
when(mockPList.get(Constants.PR_BORDER_COLLAPSE)).thenReturn(borderCollapseProperty);
+
+ final Property writingModeProperty = mock(Property.class);
+ when(writingModeProperty.getEnum()).thenReturn(Constants.EN_LR_TB);
+ when(mockPList.get(Constants.PR_WRITING_MODE)).thenReturn(writingModeProperty);
} catch (PropertyException e) {
throw new RuntimeException(e);
}
diff --git a/test/java/org/apache/fop/render/intermediate/IFStructureTreeBuilderTestCase.java b/test/java/org/apache/fop/render/intermediate/IFStructureTreeBuilderTestCase.java
index 65c6b25a6..6819fed79 100644
--- a/test/java/org/apache/fop/render/intermediate/IFStructureTreeBuilderTestCase.java
+++ b/test/java/org/apache/fop/render/intermediate/IFStructureTreeBuilderTestCase.java
@@ -61,7 +61,7 @@ public class IFStructureTreeBuilderTestCase {
// Expected
}
- sut.startPageSequence(null);
+ sut.startPageSequence(null, null);
sut.endPageSequence();
sut.replayEventsForPageSequence(handler, 0);
@@ -89,7 +89,7 @@ public class IFStructureTreeBuilderTestCase {
final String nodeName = "block";
final ContentHandler handler = mock(ContentHandler.class);
- sut.startPageSequence(null);
+ sut.startPageSequence(null, null);
sut.startNode(nodeName, createSimpleAttributes(attributes));
sut.endPageSequence();
@@ -105,7 +105,7 @@ public class IFStructureTreeBuilderTestCase {
final String nodeName = "block";
final ContentHandler handler = mock(ContentHandler.class);
- sut.startPageSequence(null);
+ sut.startPageSequence(null, null);
sut.endNode(nodeName);
sut.endPageSequence();
diff --git a/test/java/org/apache/fop/render/ps/PSPainterTestCase.java b/test/java/org/apache/fop/render/ps/PSPainterTestCase.java
new file mode 100644
index 000000000..4e50f09c9
--- /dev/null
+++ b/test/java/org/apache/fop/render/ps/PSPainterTestCase.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.fop.render.ps;
+
+import java.io.IOException;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.verification.VerificationMode;
+
+import org.apache.xmlgraphics.ps.PSGenerator;
+
+import org.apache.fop.render.intermediate.IFState;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+public class PSPainterTestCase {
+
+ private PSDocumentHandler docHandler;
+ private PSPainter psPainter;
+ private PSGenerator gen;
+ private IFState state;
+
+ @Before
+ public void setup() {
+ docHandler = new PSDocumentHandler();
+ gen = mock(PSGenerator.class);
+ docHandler.gen = gen;
+ state = IFState.create();
+ psPainter = new PSPainter(docHandler, state);
+ }
+
+ @Test
+ public void testNonZeroFontSize() throws IOException {
+ testFontSize(6, times(1));
+ }
+
+ @Test
+ public void testZeroFontSize() throws IOException {
+ testFontSize(0, never());
+ }
+
+ private void testFontSize(int fontSize, VerificationMode test) throws IOException {
+ state.setFontSize(fontSize);
+ try {
+ psPainter.drawText(10, 10, 2, 2, null, "Test");
+ } catch (Exception ex) {
+ //Expected
+ }
+ verify(gen, test).useColor(state.getTextColor());
+ }
+}
diff --git a/test/java/org/apache/fop/render/ps/PSRenderingUtilTestCase.java b/test/java/org/apache/fop/render/ps/PSRenderingUtilTestCase.java
new file mode 100644
index 000000000..3f1088fe1
--- /dev/null
+++ b/test/java/org/apache/fop/render/ps/PSRenderingUtilTestCase.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.render.ps;
+
+import java.io.IOException;
+
+import org.junit.Test;
+
+import org.apache.xmlgraphics.ps.PSGenerator;
+
+import org.apache.fop.render.ps.extensions.PSPageTrailerCodeBefore;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+
+public class PSRenderingUtilTestCase {
+
+ private final String content = "<< /MyEntry 0 >> command";
+ private final PSPageTrailerCodeBefore ptcb = new PSPageTrailerCodeBefore(content);
+ private final PSGenerator gen = mock(PSGenerator.class);
+
+ @Test
+ public void testWriteEnclosedExtensionAttachment() throws IOException {
+ PSRenderingUtil.writeEnclosedExtensionAttachment(gen, ptcb);
+ verify(gen).writeln(content);
+ }
+
+}