aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorGlen Mazza <gmazza@apache.org>2004-07-07 22:16:53 +0000
committerGlen Mazza <gmazza@apache.org>2004-07-07 22:16:53 +0000
commitb3087c3781c2ce9db4efbb07701943888dd54e78 (patch)
treebf85fb4bd19314ea7e8b9ddc8c2d7b2fe56893f5 /test
parented53ed2ac6ef7c26569f11c0df22ba4e841f43ce (diff)
downloadxmlgraphics-fop-b3087c3781c2ce9db4efbb07701943888dd54e78.tar.gz
xmlgraphics-fop-b3087c3781c2ce9db4efbb07701943888dd54e78.zip
Switch to JAXP identity transformation for DOM Document example.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197765 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test')
-rw-r--r--test/java/org/apache/fop/BasicDriverTestCase.java14
1 files changed, 10 insertions, 4 deletions
diff --git a/test/java/org/apache/fop/BasicDriverTestCase.java b/test/java/org/apache/fop/BasicDriverTestCase.java
index c512a50ec..d591d6602 100644
--- a/test/java/org/apache/fop/BasicDriverTestCase.java
+++ b/test/java/org/apache/fop/BasicDriverTestCase.java
@@ -27,6 +27,7 @@ import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.sax.SAXResult;
import javax.xml.transform.stream.StreamSource;
@@ -96,18 +97,23 @@ public class BasicDriverTestCase extends AbstractFOPTestCase {
}
/**
- * Tests Driver with Document and OutputStream.
+ * Tests DOM with JAXP and OutputStream generating PostScript.
* @throws Exception if anything fails
*/
public void testFO2PDFWithDOM() throws Exception {
File foFile = new File(getBaseDir(), "test/xml/bugtests/block.fo");
ByteArrayOutputStream baout = new ByteArrayOutputStream();
Driver driver = new Driver();
-
driver.setOutputStream(baout);
driver.setRenderer(Driver.RENDER_PDF);
- driver.render(loadDocument(foFile));
- assertTrue("Generated PDF has zero length", baout.size() > 0);
+
+ TransformerFactory factory = TransformerFactory.newInstance();
+ Transformer transformer = factory.newTransformer(); //Identity transf.
+ Source src = new DOMSource(loadDocument(foFile));
+ Result res = new SAXResult(driver.getContentHandler());
+ transformer.transform(src, res);
+
+ assertTrue("Generated PostScript has zero length", baout.size() > 0);
}
/**