summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2009-03-24 08:08:54 +0000
committerJeremias Maerki <jeremias@apache.org>2009-03-24 08:08:54 +0000
commitc71b4374b1b89486e7103116eaace7c0adf9a84d (patch)
tree72aff0d427887852c950c14dd3e9b60d684e6d6c /test
parent837cacd29624ddf4f1a58fc7069121ee8652c8f7 (diff)
downloadxmlgraphics-fop-c71b4374b1b89486e7103116eaace7c0adf9a84d.tar.gz
xmlgraphics-fop-c71b4374b1b89486e7103116eaace7c0adf9a84d.zip
Amendment to revision 755894:
The mimicking fix didn't work for all output formats. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@757681 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test')
-rw-r--r--test/java/org/apache/fop/intermediate/IFMimickingTestCase.java41
-rw-r--r--test/test-no-xml-metrics.xconf18
2 files changed, 53 insertions, 6 deletions
diff --git a/test/java/org/apache/fop/intermediate/IFMimickingTestCase.java b/test/java/org/apache/fop/intermediate/IFMimickingTestCase.java
index b6b6aebd6..610bc600b 100644
--- a/test/java/org/apache/fop/intermediate/IFMimickingTestCase.java
+++ b/test/java/org/apache/fop/intermediate/IFMimickingTestCase.java
@@ -31,6 +31,7 @@ import javax.xml.transform.stream.StreamSource;
import junit.framework.TestCase;
+import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.apps.Fop;
import org.apache.fop.apps.FopFactory;
@@ -40,6 +41,7 @@ import org.apache.fop.events.EventFormatter;
import org.apache.fop.events.EventListener;
import org.apache.fop.render.intermediate.IFContext;
import org.apache.fop.render.intermediate.IFDocumentHandler;
+import org.apache.fop.render.intermediate.IFException;
import org.apache.fop.render.intermediate.IFSerializer;
/**
@@ -47,15 +49,42 @@ import org.apache.fop.render.intermediate.IFSerializer;
*/
public class IFMimickingTestCase extends TestCase {
+ private FopFactory fopFactory;
+
+ /** {@inheritDoc} */
+ protected void setUp() throws Exception {
+ super.setUp();
+ fopFactory = FopFactory.newInstance();
+ File configFile = new File("test/test-no-xml-metrics.xconf");
+ fopFactory.setUserConfig(configFile);
+ }
+
/**
- * Tests IF document handler mimicking.
+ * Tests IF document handler mimicking with PDF output.
* @throws Exception if an error occurs
*/
- public void testMimicking() throws Exception {
- FopFactory fopFactory = FopFactory.newInstance();
- File configFile = new File("test/test-no-xml-metrics.xconf");
- fopFactory.setUserConfig(configFile);
+ public void testMimickingPDF() throws Exception {
+ doTestMimicking(MimeConstants.MIME_PDF);
+ }
+
+ /**
+ * Tests IF document handler mimicking with PostScript output.
+ * @throws Exception if an error occurs
+ */
+ public void testMimickingPS() throws Exception {
+ doTestMimicking(MimeConstants.MIME_POSTSCRIPT);
+ }
+
+ /**
+ * Tests IF document handler mimicking with TIFF output.
+ * @throws Exception if an error occurs
+ */
+ public void testMimickingTIFF() throws Exception {
+ doTestMimicking(MimeConstants.MIME_TIFF);
+ }
+ private void doTestMimicking(String mime) throws FOPException, IFException,
+ TransformerException {
//Set up XMLRenderer to render to a DOM
DOMResult domResult = new DOMResult();
@@ -73,7 +102,7 @@ public class IFMimickingTestCase extends TestCase {
//Create an instance of the target renderer so the XMLRenderer can use its font setup
IFDocumentHandler targetHandler = userAgent.getRendererFactory().createDocumentHandler(
- userAgent, MimeConstants.MIME_PDF);
+ userAgent, mime);
//Setup painter
IFSerializer serializer = new IFSerializer();
diff --git a/test/test-no-xml-metrics.xconf b/test/test-no-xml-metrics.xconf
index d47e0ec8f..beb24c0ef 100644
--- a/test/test-no-xml-metrics.xconf
+++ b/test/test-no-xml-metrics.xconf
@@ -22,5 +22,23 @@
</font>
</fonts>
</renderer>
+ <renderer mime="application/postscript">
+ <fonts>
+ <font embed-url="glb12.ttf" kerning="yes">
+ <font-triplet name="Gladiator Bold" style="normal" weight="normal"/>
+ <font-triplet name="Gladiator" style="normal" weight="bold"/>
+ <font-triplet name="Gladiator" style="normal" weight="normal"/>
+ </font>
+ </fonts>
+ </renderer>
+ <renderer mime="image/tiff">
+ <fonts>
+ <font embed-url="glb12.ttf" kerning="yes">
+ <font-triplet name="Gladiator Bold" style="normal" weight="normal"/>
+ <font-triplet name="Gladiator" style="normal" weight="bold"/>
+ <font-triplet name="Gladiator" style="normal" weight="normal"/>
+ </font>
+ </fonts>
+ </renderer>
</renderers>
</fop>