]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Basic functionality tests for PS and RTF besides PDF. Still no detailed output checki...
authorJeremias Maerki <jeremias@apache.org>
Sat, 8 Nov 2003 15:14:34 +0000 (15:14 +0000)
committerJeremias Maerki <jeremias@apache.org>
Sat, 8 Nov 2003 15:14:34 +0000 (15:14 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196997 13f79535-47bb-0310-9956-ffa450edef68

test/java/org/apache/fop/BasicDriverTestCase.java

index 0838ef1ad033b8f7be553a686a5e81dc7534419d..ce8bddd11b97f2cf84256b2c0d775781e57c9e99 100644 (file)
@@ -172,7 +172,7 @@ public class BasicDriverTestCase extends AbstractFOPTestCase {
     }
 
     /**
-     * Tests Driver with JAXP and OutputStream.
+     * Tests Driver with JAXP and OutputStream generating PDF.
      * @throws Exception if anything fails
      */
     public void testFO2PDFWithJAXP() throws Exception {
@@ -192,6 +192,48 @@ public class BasicDriverTestCase extends AbstractFOPTestCase {
         assertTrue("Generated PDF has zero length", baout.size() > 0);
     }
 
+    /**
+     * Tests Driver with JAXP and OutputStream generating PostScript.
+     * @throws Exception if anything fails
+     */
+    public void testFO2PSWithJAXP() throws Exception {
+        File foFile = new File(getBaseDir(), "test/xml/bugtests/block.fo");
+        ByteArrayOutputStream baout = new ByteArrayOutputStream();
+        Driver driver = new Driver();
+        ContainerUtil.enableLogging(driver, this.logger);
+        driver.setOutputStream(baout);
+        driver.setRenderer(Driver.RENDER_PS);
+        
+        TransformerFactory factory = TransformerFactory.newInstance();
+        Transformer transformer = factory.newTransformer(); //Identity transf.
+        Source src = new StreamSource(foFile);
+        Result res = new SAXResult(driver.getContentHandler());
+        transformer.transform(src, res);
+        
+        assertTrue("Generated PostScript has zero length", baout.size() > 0);
+    }
+
+    /**
+     * Tests Driver with JAXP and OutputStream generating RTF.
+     * @throws Exception if anything fails
+     */
+    public void testFO2RTFWithJAXP() throws Exception {
+        File foFile = new File(getBaseDir(), "test/xml/bugtests/block.fo");
+        ByteArrayOutputStream baout = new ByteArrayOutputStream();
+        Driver driver = new Driver();
+        ContainerUtil.enableLogging(driver, this.logger);
+        driver.setOutputStream(baout);
+        driver.setRenderer(Driver.RENDER_RTF);
+        
+        TransformerFactory factory = TransformerFactory.newInstance();
+        Transformer transformer = factory.newTransformer(); //Identity transf.
+        Source src = new StreamSource(foFile);
+        Result res = new SAXResult(driver.getContentHandler());
+        transformer.transform(src, res);
+        
+        assertTrue("Generated RTF has zero length", baout.size() > 0);
+    }
+
     /**
      * Tests Driver with XsltInputHandler and OutputStream.
      * @throws Exception if anything fails