You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2003/11/08 16:14:34 UTC

cvs commit: xml-fop/test/java/org/apache/fop BasicDriverTestCase.java

jeremias    2003/11/08 07:14:34

  Modified:    test/java/org/apache/fop BasicDriverTestCase.java
  Log:
  Basic functionality tests for PS and RTF besides PDF. Still no detailed output checking, only checking that no exception is thrown.
  
  Revision  Changes    Path
  1.3       +44 -2     xml-fop/test/java/org/apache/fop/BasicDriverTestCase.java
  
  Index: BasicDriverTestCase.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/test/java/org/apache/fop/BasicDriverTestCase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BasicDriverTestCase.java	27 Sep 2003 20:57:48 -0000	1.2
  +++ BasicDriverTestCase.java	8 Nov 2003 15:14:34 -0000	1.3
  @@ -172,7 +172,7 @@
       }
   
       /**
  -     * Tests Driver with JAXP and OutputStream.
  +     * Tests Driver with JAXP and OutputStream generating PDF.
        * @throws Exception if anything fails
        */
       public void testFO2PDFWithJAXP() throws Exception {
  @@ -190,6 +190,48 @@
           transformer.transform(src, res);
           
           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);
       }
   
       /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org


Re: cvs commit: xml-fop/test/java/org/apache/fop BasicDriverTestCase.java

Posted by Jeremias Maerki <de...@greenmail.ch>.
Hmm, you mean adding MD5 tests? I'd rather not do that. These digests
change too often. The BasicDriverTestCase's purpose is to verify that
the overall API works and that some reasonable output has been generated
and no exceptions were thrown. So instead of just checking whether
anything at all has been written to the OutputStream or not I'd rather
check the output if the correct file headers and file footers can be
found. Where applicable we could also test for the presence of a
particular text in the document. But these tests are not conformance
tests so I wouldn't want to do MD5s here. Not even bitmap diffing.

On 08.11.2003 18:02:24 J.Pietschmann wrote:
> jeremias@apache.org wrote:
> >   Basic functionality tests for PS and RTF besides PDF.
> 
> Can you check how this can be incorporated into
> GenericFOPTestCase.java?
> 
> J.Pietschmann



Jeremias Maerki


Re: cvs commit: xml-fop/test/java/org/apache/fop BasicDriverTestCase.java

Posted by "J.Pietschmann" <j3...@yahoo.de>.
jeremias@apache.org wrote:
>   Basic functionality tests for PS and RTF besides PDF.

Can you check how this can be incorporated into
GenericFOPTestCase.java?

J.Pietschmann