You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-commits@xmlgraphics.apache.org by ga...@apache.org on 2014/11/16 22:34:00 UTC

svn commit: r1640032 - in /xmlgraphics/batik/branches/junit: test-resources/org/apache/batik/css/engine/value/ test-resources/org/apache/batik/parser/ test/java/org/apache/batik/parser/

Author: gadams
Date: Sun Nov 16 21:34:00 2014
New Revision: 1640032

URL: http://svn.apache.org/r1640032
Log:
Continue converting unit tests.

Removed:
    xmlgraphics/batik/branches/junit/test-resources/org/apache/batik/css/engine/value/unitTesting.xml
    xmlgraphics/batik/branches/junit/test-resources/org/apache/batik/parser/unitTesting.xml
Modified:
    xmlgraphics/batik/branches/junit/test/java/org/apache/batik/parser/LengthParserFailureTestCase.java
    xmlgraphics/batik/branches/junit/test/java/org/apache/batik/parser/LengthParserTestCase.java
    xmlgraphics/batik/branches/junit/test/java/org/apache/batik/parser/PathParserFailureTestCase.java
    xmlgraphics/batik/branches/junit/test/java/org/apache/batik/parser/PathParserTestCase.java
    xmlgraphics/batik/branches/junit/test/java/org/apache/batik/parser/TransformListParserTestCase.java

Modified: xmlgraphics/batik/branches/junit/test/java/org/apache/batik/parser/LengthParserFailureTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/junit/test/java/org/apache/batik/parser/LengthParserFailureTestCase.java?rev=1640032&r1=1640031&r2=1640032&view=diff
==============================================================================
--- xmlgraphics/batik/branches/junit/test/java/org/apache/batik/parser/LengthParserFailureTestCase.java (original)
+++ xmlgraphics/batik/branches/junit/test/java/org/apache/batik/parser/LengthParserFailureTestCase.java Sun Nov 16 21:34:00 2014
@@ -18,47 +18,70 @@
  */
 package org.apache.batik.parser;
 
-import java.io.*;
+import java.io.StringReader;
 
-import org.apache.batik.test.*;
-
-import org.junit.Ignore;
 import org.junit.Test;
 
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
 /**
  * To test the length parser.
  *
  * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  * @version $Id$
  */
-@Ignore
-public class LengthParserFailureTestCase extends AbstractTest {
+public class LengthParserFailureTestCase {
+
+    @Test(expected=ParseException.class)
+    public void testLengthParserFail1() throws Exception {
+        testLengthParserFailure("123.456.7");
+    }
+
+    @Test(expected=ParseException.class)
+    public void testLengthParserFail2() throws Exception {
+        testLengthParserFailure("1e+");
+    }
+
+    @Test(expected=ParseException.class)
+    public void testLengthParserFail3() throws Exception {
+        testLengthParserFailure("+e3");
+    }
+
+    @Test(expected=ParseException.class)
+    public void testLengthParserFail4() throws Exception {
+        testLengthParserFailure("1Em");
+    }
 
-    protected String sourceLength;
+    @Test(expected=ParseException.class)
+    public void testLengthParserFail5() throws Exception {
+        testLengthParserFailure("--1");
+    }
+
+    @Test(expected=ParseException.class)
+    public void testLengthParserFail6() throws Exception {
+        testLengthParserFailure("-1E--2");
+    }
+
+    @Test(expected=ParseException.class)
+    public void testLengthParserFail7() throws Exception {
+        testLengthParserFailure("-.E+1");
+    }
+
+    @Test(expected=ParseException.class)
+    public void testLengthParserFail8() throws Exception {
+        testLengthParserFailure("-.0EE+1");
+    }
+
+    @Test(expected=ParseException.class)
+    public void testLengthParserFail9() throws Exception {
+        testLengthParserFailure("1Eem");
+    }
 
-    /**
-     * Creates a new LengthParserFailureTest.
-     * @param slength The length to parse.
-     */
-    public LengthParserFailureTestCase(String slength) {
-        sourceLength = slength;
+    @Test(expected=ParseException.class)
+    public void testLengthParserFail10() throws Exception {
+        testLengthParserFailure("1em%");
     }
 
-    public TestReport runImpl() throws Exception {
+    private void testLengthParserFailure(String length) throws Exception {
         LengthParser pp = new LengthParser();
-        try {
-            pp.parse(new StringReader(sourceLength));
-        } catch (ParseException e) {
-            return reportSuccess();
-        }
-        DefaultTestReport report = new DefaultTestReport(this);
-        report.setErrorCode("parse.without.error");
-        report.addDescriptionEntry("input.text", sourceLength);
-        report.setPassed(false);
-        return report;
+        pp.parse(new StringReader(length));
     }
 }

Modified: xmlgraphics/batik/branches/junit/test/java/org/apache/batik/parser/LengthParserTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/junit/test/java/org/apache/batik/parser/LengthParserTestCase.java?rev=1640032&r1=1640031&r2=1640032&view=diff
==============================================================================
--- xmlgraphics/batik/branches/junit/test/java/org/apache/batik/parser/LengthParserTestCase.java (original)
+++ xmlgraphics/batik/branches/junit/test/java/org/apache/batik/parser/LengthParserTestCase.java Sun Nov 16 21:34:00 2014
@@ -18,16 +18,11 @@
  */
 package org.apache.batik.parser;
 
-import java.io.*;
+import java.io.StringReader;
 
-import org.apache.batik.test.*;
-
-import org.junit.Ignore;
 import org.junit.Test;
 
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.assertEquals;
 
 /**
  * To test the length parser.
@@ -35,56 +30,76 @@ import static org.junit.Assert.fail;
  * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  * @version $Id$
  */
-@Ignore
-public class LengthParserTestCase extends AbstractTest {
+public class LengthParserTestCase {
 
-    protected String sourceLength;
-    protected String destinationLength;
+    @Test
+    public void testLengthParser1() throws Exception {
+        testLength("123.456", "123.456");
+    }
 
-    protected StringBuffer buffer;
-    protected String resultLength;
+    @Test
+    public void testLengthParser2() throws Exception {
+        testLength("123em", "123.0em");
+    }
 
-    /**
-     * Creates a new LengthParserTest.
-     * @param slength The length to parse.
-     * @param dlength The length after serialization.
-     */
-    public LengthParserTestCase(String slength, String dlength) {
-        sourceLength = slength;
-        destinationLength = dlength;
+    @Test
+    public void testLengthParser3() throws Exception {
+        testLength(".456ex", "0.456ex");
     }
 
-    public TestReport runImpl() throws Exception {
-        LengthParser pp = new LengthParser();
-        pp.setLengthHandler(new TestHandler());
+    @Test
+    public void testLengthParser4() throws Exception {
+        testLength("-.456789in", "-0.456789in");
+    }
 
-        try {
-            pp.parse(new StringReader(sourceLength));
-        } catch (ParseException e) {
-            DefaultTestReport report = new DefaultTestReport(this);
-            report.setErrorCode("parse.error");
-            report.addDescriptionEntry("exception.text", e.getMessage());
-            report.setPassed(false);
-            return report;
-        }
+    @Test
+    public void testLengthParser5() throws Exception {
+        testLength("-456789.cm", "-456789.0cm");
+    }
 
-        if (!destinationLength.equals(resultLength)) {
-            DefaultTestReport report = new DefaultTestReport(this);
-            report.setErrorCode("invalid.parsing.events");
-            report.addDescriptionEntry("expected.text", destinationLength);
-            report.addDescriptionEntry("generated.text", resultLength);
-            report.setPassed(false);
-            return report;
-        }
+    @Test
+    public void testLengthParser6() throws Exception {
+        testLength("-4567890.mm", "-4567890.0mm");
+    }
+
+    @Test
+    public void testLengthParser7() throws Exception {
+        testLength("-000456789.pc", "-456789.0pc");
+    }
 
-        return reportSuccess();
+    @Test
+    public void testLengthParser8() throws Exception {
+        testLength("-0.00456789pt", "-0.00456789pt");
     }
 
-    class TestHandler extends DefaultLengthHandler {
-        public TestHandler() {}
+    @Test
+    public void testLengthParser9() throws Exception {
+        testLength("-0px", "0.0px");
+    }
+
+    @Test
+    public void testLengthParser10() throws Exception {
+        testLength("0000%", "0.0%");
+    }
+
+    private void testLength(String length, String expected) throws Exception {
+        LengthParser pp = new LengthParser();
+        StringBuffer results = new StringBuffer();
+        pp.setLengthHandler(new TestHandler(results));
+        pp.parse(new StringReader(length));
+        assertEquals(null, expected, results.toString());
+    }
+
+    private static class TestHandler extends DefaultLengthHandler {
+        
+        private StringBuffer buffer;
+
+        public TestHandler(StringBuffer buffer) {
+            this.buffer = buffer;
+        }
 
         public void startLength() throws ParseException {
-            buffer = new StringBuffer();
+            buffer.setLength(0);
         }
         
         public void lengthValue(float v) throws ParseException {
@@ -128,7 +143,6 @@ public class LengthParserTestCase extend
         }
 
         public void endLength() throws ParseException {
-            resultLength = buffer.toString();
         }
     }
 }

Modified: xmlgraphics/batik/branches/junit/test/java/org/apache/batik/parser/PathParserFailureTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/junit/test/java/org/apache/batik/parser/PathParserFailureTestCase.java?rev=1640032&r1=1640031&r2=1640032&view=diff
==============================================================================
--- xmlgraphics/batik/branches/junit/test/java/org/apache/batik/parser/PathParserFailureTestCase.java (original)
+++ xmlgraphics/batik/branches/junit/test/java/org/apache/batik/parser/PathParserFailureTestCase.java Sun Nov 16 21:34:00 2014
@@ -18,47 +18,216 @@
  */
 package org.apache.batik.parser;
 
-import java.io.*;
+import java.io.StringReader;
 
-import org.apache.batik.test.*;
-
-import org.junit.Ignore;
 import org.junit.Test;
 
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
 /**
  * To test the path parser.
  *
  * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  * @version $Id$
  */
-@Ignore
-public class PathParserFailureTestCase extends AbstractTest {
+public class PathParserFailureTestCase {
+
+    @Test(expected=ParseException.class)
+    public void testPathParserFail1() throws Exception {
+        testPathParserFailure("m 1ee2 3");
+    }
+
+    @Test(expected=ParseException.class)
+    public void testPathParserFail2() throws Exception {
+        testPathParserFailure("m 1e4e2 3");
+    }
+
+    @Test(expected=ParseException.class)
+    public void testPathParserFail3() throws Exception {
+        testPathParserFailure("m 1e+ 2");
+    }
+
+    @Test(expected=ParseException.class)
+    public void testPathParserFail4() throws Exception {
+        testPathParserFailure("m 1 l 3 4");
+    }
+
+    @Test(expected=ParseException.class)
+    public void testPathParserFail5() throws Exception {
+        testPathParserFailure("m 1.5.6.7 l 3 4");
+    }
+
+    @Test(expected=ParseException.class)
+    public void testPathParserFail6() throws Exception {
+        testPathParserFailure("m 1.5,6.7,l 3 4");
+    }
+
+    @Test(expected=ParseException.class)
+    public void testPathParserFail7() throws Exception {
+        testPathParserFailure("m 1.5,6.7,L 3 4");
+    }
+
+    @Test(expected=ParseException.class)
+    public void testPathParserFail8() throws Exception {
+        testPathParserFailure("m 1.5,6.7,h 3");
+    }
+
+    @Test(expected=ParseException.class)
+    public void testPathParserFail9() throws Exception {
+        testPathParserFailure("m 1.5,6.7,H 3");
+    }
+
+    @Test(expected=ParseException.class)
+    public void testPathParserFail10() throws Exception {
+        testPathParserFailure("m 1.5,6.7,v 3");
+    }
+
+    @Test(expected=ParseException.class)
+    public void testPathParserFail11() throws Exception {
+        testPathParserFailure("m 1.5,6.7,V 3");
+    }
+
+    @Test(expected=ParseException.class)
+    public void testPathParserFail12() throws Exception {
+        testPathParserFailure("m 1.5,6.7,c 1,2 3,4 5,6");
+    }
+
+    @Test(expected=ParseException.class)
+    public void testPathParserFail13() throws Exception {
+        testPathParserFailure("m 1.5,6.7,C 1,2 3,4 5,6");
+    }
+
+    @Test(expected=ParseException.class)
+    public void testPathParserFail14() throws Exception {
+        testPathParserFailure("m 1.5,6.7,s 1,2 3,4");
+    }
+
+    @Test(expected=ParseException.class)
+    public void testPathParserFail15() throws Exception {
+        testPathParserFailure("m 1.5,6.7,S 1,2 3,4");
+    }
+
+    @Test(expected=ParseException.class)
+    public void testPathParserFail16() throws Exception {
+        testPathParserFailure("m 1.5,6.7,q 1,2 3,4");
+    }
+
+    @Test(expected=ParseException.class)
+    public void testPathParserFail17() throws Exception {
+        testPathParserFailure("m 1.5,6.7,Q 1,2 3,4");
+    }
+
+    @Test(expected=ParseException.class)
+    public void testPathParserFail18() throws Exception {
+        testPathParserFailure("m 1.5,6.7,t 1,2");
+    }
+
+    @Test(expected=ParseException.class)
+    public void testPathParserFail19() throws Exception {
+        testPathParserFailure("m 1.5,6.7,T 1,2");
+    }
+
+    @Test(expected=ParseException.class)
+    public void testPathParserFail20() throws Exception {
+        testPathParserFailure("m 1.5,6.7,a 2,2 0 1 1 2 2");
+    }
+
+    @Test(expected=ParseException.class)
+    public void testPathParserFail21() throws Exception {
+        testPathParserFailure("m 1.5,6.7,A 4,4 0 1 1 2 2");
+    }
+
+    @Test(expected=ParseException.class)
+    public void testPathParserFail22() throws Exception {
+        testPathParserFailure("m m 1,2");
+    }
+
+    @Test(expected=ParseException.class)
+    public void testPathParserFail23() throws Exception {
+        testPathParserFailure("M M 1,2");
+    }
+
+    @Test(expected=ParseException.class)
+    public void testPathParserFail24() throws Exception {
+        testPathParserFailure("m 1,2 l l 3,4 z");
+    }
+
+    @Test(expected=ParseException.class)
+    public void testPathParserFail25() throws Exception {
+        testPathParserFailure("m 1,2 L L 3,4 z");
+    }
+
+    @Test(expected=ParseException.class)
+    public void testPathParserFail26() throws Exception {
+        testPathParserFailure("m 1,2 h h 3 z");
+    }
 
-    protected String sourcePath;
+    @Test(expected=ParseException.class)
+    public void testPathParserFail27() throws Exception {
+        testPathParserFailure("m 1,2 H H 3 z");
+    }
+
+    @Test(expected=ParseException.class)
+    public void testPathParserFail28() throws Exception {
+        testPathParserFailure("m 1,2 v v 3 z");
+    }
+
+    @Test(expected=ParseException.class)
+    public void testPathParserFail29() throws Exception {
+        testPathParserFailure("m 1,2 V V 3 z");
+    }
 
-    /**
-     * Creates a new PathParserFailureTest.
-     * @param spath The path to parse.
-     */
-    public PathParserFailureTestCase(String spath) {
-        sourcePath = spath;
+    @Test(expected=ParseException.class)
+    public void testPathParserFail30() throws Exception {
+        testPathParserFailure("m 1,2 c c 1,2 3,4 5,6z");
     }
 
-    public TestReport runImpl() throws Exception {
+    @Test(expected=ParseException.class)
+    public void testPathParserFail31() throws Exception {
+        testPathParserFailure("m 1,2 C C 1,2 3,4 5,6 z");
+    }
+
+    @Test(expected=ParseException.class)
+    public void testPathParserFail32() throws Exception {
+        testPathParserFailure("m 1,2 s s 1,2 3,4 z");
+    }
+
+    @Test(expected=ParseException.class)
+    public void testPathParserFail33() throws Exception {
+        testPathParserFailure("m 1,2 S S 1,2 3,4 z");
+    }
+
+    @Test(expected=ParseException.class)
+    public void testPathParserFail34() throws Exception {
+        testPathParserFailure("m 1,2 q q 1,2 3,4 z");
+    }
+
+    @Test(expected=ParseException.class)
+    public void testPathParserFail35() throws Exception {
+        testPathParserFailure("m 1,2 Q Q 1,2 3,4 z");
+    }
+
+    @Test(expected=ParseException.class)
+    public void testPathParserFail36() throws Exception {
+        testPathParserFailure("m 1,2 t t 1,2 z");
+    }
+
+    @Test(expected=ParseException.class)
+    public void testPathParserFail37() throws Exception {
+        testPathParserFailure("m 1,2 T T 1,2 z");
+    }
+
+    @Test(expected=ParseException.class)
+    public void testPathParserFail38() throws Exception {
+        testPathParserFailure("m 1.5,6.7 a a 2,2 0 1 1 2 2");
+    }
+
+    @Test(expected=ParseException.class)
+    public void testPathParserFail39() throws Exception {
+        testPathParserFailure("m 1.5,6.7 A A 4,4 0 1 1 2 2");
+    }
+
+    private void testPathParserFailure(String path) throws Exception {
         PathParser pp = new PathParser();
-        try {
-            pp.parse(new StringReader(sourcePath));
-        } catch (Exception e) {
-            return reportSuccess();
-        }
-        DefaultTestReport report = new DefaultTestReport(this);
-        report.setErrorCode("parse.without.error");
-        report.addDescriptionEntry("input.text", sourcePath);
-        report.setPassed(false);
-        return report;
+        pp.parse(new StringReader(path));
     }
+
 }

Modified: xmlgraphics/batik/branches/junit/test/java/org/apache/batik/parser/PathParserTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/junit/test/java/org/apache/batik/parser/PathParserTestCase.java?rev=1640032&r1=1640031&r2=1640032&view=diff
==============================================================================
--- xmlgraphics/batik/branches/junit/test/java/org/apache/batik/parser/PathParserTestCase.java (original)
+++ xmlgraphics/batik/branches/junit/test/java/org/apache/batik/parser/PathParserTestCase.java Sun Nov 16 21:34:00 2014
@@ -18,16 +18,11 @@
  */
 package org.apache.batik.parser;
 
-import java.io.*;
+import java.io.StringReader;
 
-import org.apache.batik.test.*;
-
-import org.junit.Ignore;
 import org.junit.Test;
 
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.assertEquals;
 
 /**
  * To test the path parser.
@@ -35,56 +30,186 @@ import static org.junit.Assert.fail;
  * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  * @version $Id$
  */
-@Ignore
-public class PathParserTestCase extends AbstractTest {
+public class PathParserTestCase {
 
-    protected String sourcePath;
-    protected String destinationPath;
+    @Test
+    public void testPathParser1() throws Exception {
+        testPath("M1 2", "M1.0 2.0");
+    }
 
-    protected StringBuffer buffer;
-    protected String resultPath;
+    @Test
+    public void testPathParser2() throws Exception {
+        testPath("m1.1 2.0", "m1.1 2.0");
+    }
 
-    /**
-     * Creates a new PathParserTest.
-     * @param spath The path to parse.
-     * @param dpath The path after serialization.
-     */
-    public PathParserTestCase(String spath, String dpath) {
-        sourcePath = spath;
-        destinationPath = dpath;
+    @Test
+    public void testPathParser3() throws Exception {
+        testPath("M1 2z", "M1.0 2.0Z");
     }
 
-    public TestReport runImpl() throws Exception {
-        PathParser pp = new PathParser();
-        pp.setPathHandler(new TestHandler());
+    @Test
+    public void testPathParser4() throws Exception {
+        testPath("M1 2e3Z", "M1.0 2000.0Z");
+    }
 
-        try {
-            pp.parse(new StringReader(sourcePath));
-        } catch (ParseException e) {
-            DefaultTestReport report = new DefaultTestReport(this);
-            report.setErrorCode("parse.error");
-            report.addDescriptionEntry("exception.text", e.getMessage());
-            report.setPassed(false);
-            return report;
-        }
+    @Test
+    public void testPathParser5() throws Exception {
+        testPath("M1 2L 3,4", "M1.0 2.0L3.0 4.0");
+    }
 
-        if (!destinationPath.equals(resultPath)) {
-            DefaultTestReport report = new DefaultTestReport(this);
-            report.setErrorCode("invalid.parsing.events");
-            report.addDescriptionEntry("expected.text", destinationPath);
-            report.addDescriptionEntry("generated.text", resultPath);
-            report.setPassed(false);
-            return report;
-        }
+    @Test
+    public void testPathParser5_1() throws Exception {
+        testPath("M1 2 3,4", "M1.0 2.0L3.0 4.0");
+    }
+
+    @Test
+    public void testPathParser5_2() throws Exception {
+        testPath("M1, 2, 3,4", "M1.0 2.0L3.0 4.0");
+    }
+
+    @Test
+    public void testPathParser5_3() throws Exception {
+        testPath("m1, 2, 3,4", "m1.0 2.0l3.0 4.0");
+    }
+
+    @Test
+    public void testPathParser6() throws Exception {
+        testPath("M1 2H3.1", "M1.0 2.0H3.1");
+    }
+
+    @Test
+    public void testPathParser6_1() throws Exception {
+        testPath("M1 2H3.1 4", "M1.0 2.0H3.1H4.0");
+    }
+
+    @Test
+    public void testPathParser6_2() throws Exception {
+        testPath("M1 2H3.1,4", "M1.0 2.0H3.1H4.0");
+    }
+
+    @Test
+    public void testPathParser7() throws Exception {
+        testPath("M1 2h 3.1", "M1.0 2.0h3.1");
+    }
+
+    @Test
+    public void testPathParser7_1() throws Exception {
+        testPath("M1 2h 3.1 4", "M1.0 2.0h3.1h4.0");
+    }
+
+    @Test
+    public void testPathParser7_2() throws Exception {
+        testPath("M1 2h 3.1,4", "M1.0 2.0h3.1h4.0");
+    }
+
+    @Test
+    public void testPathParser8() throws Exception {
+        testPath("M1 2H 3.1,4", "M1.0 2.0H3.1H4.0");
+    }
+
+    @Test
+    public void testPathParser9() throws Exception {
+        testPath("M1 2h 3.1-4", "M1.0 2.0h3.1h-4.0");
+    }
+
+    @Test
+    public void testPathParser10() throws Exception {
+        testPath("M1 2V3.1e-3", "M1.0 2.0V0.0031");
+    }
+
+    @Test
+    public void testPathParser11() throws Exception {
+        testPath("M1 2V3.1", "M1.0 2.0V3.1");
+    }
 
-        return reportSuccess();
+    @Test
+    public void testPathParser12() throws Exception {
+        testPath("M1 2v3.1,.4", "M1.0 2.0v3.1v0.4");
     }
 
-    class TestHandler extends DefaultPathHandler {
-        public TestHandler() {}
+    @Test
+    public void testPathParser13() throws Exception {
+        testPath("M1 2v3.1-.4", "M1.0 2.0v3.1v-0.4");
+    }
+
+    @Test
+    public void testPathParser14() throws Exception {
+        testPath("M1 2C3 4 5 6 7 8", "M1.0 2.0C3.0 4.0 5.0 6.0 7.0 8.0");
+    }
+
+    @Test
+    public void testPathParser15() throws Exception {
+        testPath("M1 2c.3.4.5.6.7.8", "M1.0 2.0c0.3 0.4 0.5 0.6 0.7 0.8");
+    }
+
+    @Test
+    public void testPathParser16() throws Exception {
+        testPath("M1 2S3+4+5+6", "M1.0 2.0S3.0 4.0 5.0 6.0");
+    }
+
+    @Test
+    public void testPathParser17() throws Exception {
+        testPath("M1 2s.3+.4+.5-.6", "M1.0 2.0s0.3 0.4 0.5 -0.6");
+    }
+
+    @Test
+    public void testPathParser18() throws Exception {
+        testPath("M1 2q3. 4.+5 6", "M1.0 2.0q3.0 4.0 5.0 6.0");
+    }
+
+    @Test
+    public void testPathParser19() throws Exception {
+        testPath("M1 2Q.3e0.4.5.6", "M1.0 2.0Q0.3 0.4 0.5 0.6");
+    }
+
+    @Test
+    public void testPathParser20() throws Exception {
+        testPath("M1 2t+.3-.4", "M1.0 2.0t0.3 -0.4");
+    }
+
+    @Test
+    public void testPathParser21() throws Exception {
+        testPath("M1 2T -.3+4", "M1.0 2.0T-0.3 4.0");
+    }
+
+    @Test
+    public void testPathParser22() throws Exception {
+        testPath("M1 2a3 4 5 0,1 6 7", "M1.0 2.0a3.0 4.0 5.0 0 1 6.0 7.0");
+    }
+
+    @Test
+    public void testPathParser23() throws Exception {
+        testPath("M1 2A3 4 5 0,1 6 7", "M1.0 2.0A3.0 4.0 5.0 0 1 6.0 7.0");
+    }
+
+    @Test
+    public void testPathParser24() throws Exception {
+        testPath("M1 2t+.3-.4,5,6", "M1.0 2.0t0.3 -0.4t5.0 6.0");
+    }
+
+    @Test
+    public void testPathParser25() throws Exception {
+        testPath("M1 2T -.3+4 5-6", "M1.0 2.0T-0.3 4.0T5.0 -6.0");
+    }
+
+    private void testPath(String path, String expected) throws Exception {
+        PathParser pp = new PathParser();
+        StringBuffer results = new StringBuffer();
+        pp.setPathHandler(new TestHandler(results));
+        pp.parse(new StringReader(path));
+        assertEquals(null, expected, results.toString());
+    }
+
+    private static class TestHandler extends DefaultPathHandler {
+
+        private StringBuffer buffer;
+
+        public TestHandler(StringBuffer buffer) {
+            this.buffer = buffer;
+        }
 
         public void startPath() throws ParseException {
-            buffer = new StringBuffer();
+            buffer.setLength(0);
         }
         
         public void movetoRel(float x, float y) throws ParseException {
@@ -102,7 +227,6 @@ public class PathParserTestCase extends 
         }
 
         public void endPath() throws ParseException {
-            resultPath = buffer.toString();
         }
 
         public void closePath() throws ParseException {

Modified: xmlgraphics/batik/branches/junit/test/java/org/apache/batik/parser/TransformListParserTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/branches/junit/test/java/org/apache/batik/parser/TransformListParserTestCase.java?rev=1640032&r1=1640031&r2=1640032&view=diff
==============================================================================
--- xmlgraphics/batik/branches/junit/test/java/org/apache/batik/parser/TransformListParserTestCase.java (original)
+++ xmlgraphics/batik/branches/junit/test/java/org/apache/batik/parser/TransformListParserTestCase.java Sun Nov 16 21:34:00 2014
@@ -17,16 +17,11 @@
 
 package org.apache.batik.parser;
 
-import java.io.*;
+import java.io.StringReader;
 
-import org.apache.batik.test.*;
-
-import org.junit.Ignore;
 import org.junit.Test;
 
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.assertEquals;
 
 /**
  * To test the transform list parser.
@@ -34,58 +29,80 @@ import static org.junit.Assert.fail;
  * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  * @version $Id$
  */
-@Ignore
-public class TransformListParserTestCase extends AbstractTest {
+public class TransformListParserTestCase {
 
-    protected String sourceTransform;
-    protected String destinationTransform;
+    @Test
+    public void testTransformParser1() throws Exception {
+        testTransformList("matrix(1 2 3 4 5 6)", "matrix(1.0, 2.0, 3.0, 4.0, 5.0, 6.0)");
+    }
 
-    protected StringBuffer buffer;
-    protected String resultTransform;
+    @Test
+    public void testTransformParser2() throws Exception {
+        testTransformList("translate(1)", "translate(1.0)");
+    }
 
-    /**
-     * Creates a new TransformListParserTest.
-     * @param stransform The transform to parse.
-     * @param dtransform The transform after serialization.
-     */
-    public TransformListParserTestCase(String stransform, String dtransform) {
-        sourceTransform = stransform;
-        destinationTransform = dtransform;
+    @Test
+    public void testTransformParser3() throws Exception {
+        testTransformList("translate(1e2 3e4)", "translate(100.0, 30000.0)");
     }
 
-    public TestReport runImpl() throws Exception {
-        TransformListParser pp = new TransformListParser();
-        pp.setTransformListHandler(new TestHandler());
+    @Test
+    public void testTransformParser4() throws Exception {
+        testTransformList("scale(1e-2)", "scale(0.01)");
+    }
 
-        try {
-            pp.parse(new StringReader(sourceTransform));
-        } catch (ParseException e) {
-            DefaultTestReport report = new DefaultTestReport(this);
-            report.setErrorCode("parse.error");
-            report.addDescriptionEntry("exception.text", e.getMessage());
-            report.setPassed(false);
-            return report;
-        }
+    @Test
+    public void testTransformParser5() throws Exception {
+        testTransformList("scale(-1e-2 -3e-4)", "scale(-0.01, -3.0E-4)");
+    }
 
-        if (!destinationTransform.equals(resultTransform)) {
-            DefaultTestReport report = new DefaultTestReport(this);
-            report.setErrorCode("invalid.parsing.events");
-            report.addDescriptionEntry("expected.text", destinationTransform);
-            report.addDescriptionEntry("generated.text", resultTransform);
-            report.setPassed(false);
-            return report;
-        }
+    @Test
+    public void testTransformParser6() throws Exception {
+        testTransformList("skewX(1.234)", "skewX(1.234)");
+    }
 
-        return reportSuccess();
+    @Test
+    public void testTransformParser7() throws Exception {
+        testTransformList("skewY(.1)", "skewY(0.1)");
     }
 
-    class TestHandler extends DefaultTransformListHandler {
-        boolean first;
-        public TestHandler() {}
+    @Test
+    public void testTransformParser8() throws Exception {
+        testTransformList("translate(1,2) skewY(.1)", "translate(1.0, 2.0) skewY(0.1)");
+    }
+
+    @Test
+    public void testTransformParser9() throws Exception {
+        testTransformList("scale(1,2),skewX(.1e1)", "scale(1.0, 2.0) skewX(1.0)");
+    }
+
+    @Test
+    public void testTransformParser10() throws Exception {
+        testTransformList("scale(1) , skewX(2) translate(3,4)", "scale(1.0) skewX(2.0) translate(3.0, 4.0)");
+    }
+
+    private void testTransformList(String path, String expected) throws Exception {
+        TransformListParser pp = new TransformListParser();
+        StringBuffer results = new StringBuffer();
+        pp.setTransformListHandler(new TestHandler(results));
+        pp.parse(new StringReader(path));
+        assertEquals(null, expected, results.toString());
+    }
+
+    private static class TestHandler extends DefaultTransformListHandler {
+
+        private StringBuffer buffer;
+        private boolean first;
+
+        public TestHandler(StringBuffer buffer) {
+            this.buffer = buffer;
+            this.first = true;
+        }
+
         public void startTransformList() throws ParseException {
-            buffer = new StringBuffer();
-            first = true;
+            buffer.setLength(0);
         }
+
         public void matrix(float a, float b, float c, float d, float e, float f)
             throws ParseException {
             if (!first) {
@@ -106,18 +123,21 @@ public class TransformListParserTestCase
             buffer.append(f);
             buffer.append(")");
         }
+
         public void rotate(float theta) throws ParseException {
             if (!first) {
                 buffer.append(' ');
             }
             first = false;
         }
+
         public void rotate(float theta, float cx, float cy) throws ParseException {
             if (!first) {
                 buffer.append(' ');
             }
             first = false;
         }
+
         public void translate(float tx) throws ParseException {
             if (!first) {
                 buffer.append(' ');
@@ -127,6 +147,7 @@ public class TransformListParserTestCase
             buffer.append(tx);
             buffer.append(")");
         }
+
         public void translate(float tx, float ty) throws ParseException {
             if (!first) {
                 buffer.append(' ');
@@ -138,6 +159,7 @@ public class TransformListParserTestCase
             buffer.append(ty);
             buffer.append(")");
         }
+
         public void scale(float sx) throws ParseException {
             if (!first) {
                 buffer.append(' ');
@@ -147,6 +169,7 @@ public class TransformListParserTestCase
             buffer.append(sx);
             buffer.append(")");
         }
+
         public void scale(float sx, float sy) throws ParseException {
             if (!first) {
                 buffer.append(' ');
@@ -158,6 +181,7 @@ public class TransformListParserTestCase
             buffer.append(sy);
             buffer.append(")");
         }
+
         public void skewX(float skx) throws ParseException {
             if (!first) {
                 buffer.append(' ');
@@ -167,6 +191,7 @@ public class TransformListParserTestCase
             buffer.append(skx);
             buffer.append(")");
         }
+
         public void skewY(float sky) throws ParseException {
             if (!first) {
                 buffer.append(' ');
@@ -176,8 +201,9 @@ public class TransformListParserTestCase
             buffer.append(sky);
             buffer.append(")");
         }
+
         public void endTransformList() throws ParseException {
-            resultTransform = buffer.toString();
         }
+
     }
 }