aboutsummaryrefslogtreecommitdiffstats
path: root/test/java/org/apache/fop/layoutengine
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2006-03-27 09:51:14 +0000
committerJeremias Maerki <jeremias@apache.org>2006-03-27 09:51:14 +0000
commit0a2d149c230858d311f6d4d776072704a0096ac2 (patch)
tree3dcbf5ed7be99ab2a93f5911ff2ff40e10364fc6 /test/java/org/apache/fop/layoutengine
parent60fc6535d1a4bb48faea00e1d4793d18bc0f7f98 (diff)
downloadxmlgraphics-fop-0a2d149c230858d311f6d4d776072704a0096ac2.tar.gz
xmlgraphics-fop-0a2d149c230858d311f6d4d776072704a0096ac2.zip
Merged Temp_API_Finalization branch back into FOP Trunk:
Finalized API according to the plan in the Wiki: http://wiki.apache.org/xmlgraphics-fop/ApiDesign In addition to that: Deprecated the rest of the Fop constructors. Refactored the FopServlet a bit to make it more versatile and still easy to understand. The FopPrintServlet is now a subclass of FopServlet. Some further cleanup on the way. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@389086 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/java/org/apache/fop/layoutengine')
-rw-r--r--test/java/org/apache/fop/layoutengine/LayoutEngineTester.java17
1 files changed, 10 insertions, 7 deletions
diff --git a/test/java/org/apache/fop/layoutengine/LayoutEngineTester.java b/test/java/org/apache/fop/layoutengine/LayoutEngineTester.java
index 7fd8fe4e4..f3262e881 100644
--- a/test/java/org/apache/fop/layoutengine/LayoutEngineTester.java
+++ b/test/java/org/apache/fop/layoutengine/LayoutEngineTester.java
@@ -21,7 +21,6 @@ package org.apache.fop.layoutengine;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Constructor;
-import java.net.MalformedURLException;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -43,11 +42,10 @@ import javax.xml.transform.sax.TransformerHandler;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
-import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.apps.Fop;
+import org.apache.fop.apps.FopFactory;
import org.apache.fop.apps.FormattingResults;
-import org.apache.fop.apps.MimeConstants;
import org.apache.fop.layoutmgr.ElementListObserver;
import org.apache.fop.render.xml.XMLRenderer;
import org.apache.xpath.XPathAPI;
@@ -56,7 +54,6 @@ import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
/**
@@ -67,6 +64,10 @@ public class LayoutEngineTester {
private static final Map CHECK_CLASSES = new java.util.HashMap();
+ // configure fopFactory as desired
+ private FopFactory fopFactory = FopFactory.newInstance();
+ private FopFactory fopFactoryWithBase14Kerning = FopFactory.newInstance();
+
private SAXTransformerFactory tfactory
= (SAXTransformerFactory)SAXTransformerFactory.newInstance();
@@ -89,6 +90,8 @@ public class LayoutEngineTester {
*/
public LayoutEngineTester(File areaTreeBackupDir) {
this.areaTreeBackupDir = areaTreeBackupDir;
+ fopFactory.setBase14KerningEnabled(false);
+ fopFactoryWithBase14Kerning.setBase14KerningEnabled(true);
}
private Templates getTestcase2FOStylesheet() throws TransformerConfigurationException {
@@ -137,6 +140,7 @@ public class LayoutEngineTester {
XObject xo = XPathAPI.eval(testDoc, "/testcase/cfg/base14kerning");
String s = xo.str();
boolean base14kerning = ("true".equalsIgnoreCase(s));
+ FopFactory effFactory = (base14kerning ? fopFactoryWithBase14Kerning : fopFactory);
//Setup Transformer to convert the testcase XML to XSL-FO
Transformer transformer = getTestcase2FOStylesheet().newTransformer();
@@ -147,14 +151,13 @@ public class LayoutEngineTester {
athandler.setResult(domres);
//Setup FOP for area tree rendering
- FOUserAgent ua = new FOUserAgent();
+ FOUserAgent ua = effFactory.newFOUserAgent();
ua.setBaseURL(testFile.getParentFile().toURL().toString());
- ua.setBase14KerningEnabled(base14kerning);
XMLRenderer atrenderer = new XMLRenderer();
atrenderer.setUserAgent(ua);
atrenderer.setContentHandler(athandler);
ua.setRendererOverride(atrenderer);
- fop = new Fop(MimeConstants.MIME_FOP_AREA_TREE, ua);
+ fop = effFactory.newFop(ua);
SAXResult fores = new SAXResult(fop.getDefaultHandler());
transformer.transform(src, fores);