vhardy 01/11/19 04:45:28 Modified: test-sources/org/apache/batik/apps/rasterizer SVGConverterTest.java sources/org/apache/batik/apps/rasterizer SVGConverter.java Log: Fixed bug 4888 and added corresponding regression test. Revision Changes Path 1.11 +32 -1 xml-batik/test-sources/org/apache/batik/apps/rasterizer/SVGConverterTest.java Index: SVGConverterTest.java =================================================================== RCS file: /home/cvs/xml-batik/test-sources/org/apache/batik/apps/rasterizer/SVGConverterTest.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- SVGConverterTest.java 2001/11/06 15:04:51 1.10 +++ SVGConverterTest.java 2001/11/19 12:45:27 1.11 @@ -24,7 +24,7 @@ * of source and destination sources. * * @author <a href="mailto:[EMAIL PROTECTED]">Vincent Hardy</a> - * @version $Id: SVGConverterTest.java,v 1.10 2001/11/06 15:04:51 hillion Exp $ + * @version $Id: SVGConverterTest.java,v 1.11 2001/11/19 12:45:27 vhardy Exp $ */ public class SVGConverterTest extends DefaultTestSuite { public SVGConverterTest(){ @@ -171,6 +171,7 @@ addTest(t); t.setId("SourcesConfigTest.SimpleList"); + // // Check destination @@ -193,6 +194,20 @@ addTest(t); t.setId("DestConfigTest.DstDir"); + // + // Check that complete process goes without error + // + t = new OperationTest(){ + protected void configure(SVGConverter c){ + c.setSources(new String[]{"samples/anne.svg"}); + c.setDst(new File("anne.png")); + File file = new File("anne.png"); + file.deleteOnExit(); + } + }; + addTest(t); + t.setId("OperationTest.Bug4888"); + /////////////////////////////////////////////////////////////////////// // Add configuration error test. These tests check that the expected // error gets reported for a given mis-configuration @@ -671,6 +686,22 @@ public void onSourceTranscodingSuccess(SVGConverterSource source, File dest){ } +} + +/** + * Tests that a convertion task goes without exception. + */ +class OperationTest extends AbstractTest{ + public TestReport runImpl() throws Exception { + SVGConverter c = new SVGConverter(); + configure(c); + c.execute(); + return reportSuccess(); + } + + protected void configure(SVGConverter c){ + // Should be overridden by subclasses. + } } /** 1.8 +12 -9 xml-batik/sources/org/apache/batik/apps/rasterizer/SVGConverter.java Index: SVGConverter.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/apps/rasterizer/SVGConverter.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- SVGConverter.java 2001/11/09 02:37:11 1.7 +++ SVGConverter.java 2001/11/19 12:45:28 1.8 @@ -80,7 +80,7 @@ * <li>pixelToMillimeter: defines the size of a pixel when processing the SVG documents.</li> * </ul> * - * @version $Id: SVGConverter.java,v 1.7 2001/11/09 02:37:11 deweese Exp $ + * @version $Id: SVGConverter.java,v 1.8 2001/11/19 12:45:28 vhardy Exp $ * @author Henri Ruini * @author <a href="mailto:[EMAIL PROTECTED]">Vincent Hardy</a> */ @@ -864,15 +864,18 @@ // Create object from output directory. - outputDir = new File(output.getParent()); - if (outputDir.exists() == false) { - // Output directory doesn't exist, so create it. - success = outputDir.mkdirs(); - } else { - if (outputDir.isDirectory() == false) { - // File, which have a same name as the output directory, exists. - // Create output directory. + String parentDir = output.getParent(); + if (parentDir != null){ + outputDir = new File(output.getParent()); + if (outputDir.exists() == false) { + // Output directory doesn't exist, so create it. success = outputDir.mkdirs(); + } else { + if (outputDir.isDirectory() == false) { + // File, which have a same name as the output directory, exists. + // Create output directory. + success = outputDir.mkdirs(); + } } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]