From b3087c3781c2ce9db4efbb07701943888dd54e78 Mon Sep 17 00:00:00 2001 From: Glen Mazza Date: Wed, 7 Jul 2004 22:16:53 +0000 Subject: 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 --- test/java/org/apache/fop/BasicDriverTestCase.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'test') 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); } /** -- cgit v1.2.3