All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.batik.parser.unitTesting.xml Maven / Gradle / Ivy

The newest version!
<!--
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at
   
        http://www.apache.org/licenses/LICENSE-2.0
   
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
-->

<!-- ================================================================ -->
<!-- @author [email protected]                                     -->
<!-- @version $Id$  -->
<!-- ================================================================ -->
<testSuite id="parser.unitTesting" 
           name="org.apache.batik.parser package - Unit Testing">

    <!-- ================================================================== -->
    <!-- LengthParser tests                                                 -->
    <!-- The first argument is the string to parse                          -->
    <!-- The second argument is the expected string                         -->
    <!-- ================================================================== -->
   <testGroup id="lengthParser" 
              class="org.apache.batik.parser.LengthParserTest">
      <test id="lengthParser1">
          <arg class="java.lang.String" value="123.456" />
          <arg class="java.lang.String" value="123.456" />
      </test>

      <test id="lengthParser2">
          <arg class="java.lang.String" value="123em" />
          <arg class="java.lang.String" value="123.0em" />
      </test>

      <test id="lengthParser3">
          <arg class="java.lang.String" value=".456ex" />
          <arg class="java.lang.String" value="0.456ex" />
      </test>

      <test id="lengthParser4">
          <arg class="java.lang.String" value="-.456789in" />
          <arg class="java.lang.String" value="-0.456789in" />
      </test>

      <test id="lengthParser5">
          <arg class="java.lang.String" value="-456789.cm" />
          <arg class="java.lang.String" value="-456789.0cm" />
      </test>

      <test id="lengthParser6">
          <arg class="java.lang.String" value="-4567890.mm" />
          <arg class="java.lang.String" value="-4567890.0mm" />
      </test>

      <test id="lengthParser7">
          <arg class="java.lang.String" value="-000456789.pc" />
          <arg class="java.lang.String" value="-456789.0pc" />
      </test>

      <test id="lengthParser8">
          <arg class="java.lang.String" value="-0.00456789pt" />
          <arg class="java.lang.String" value="-0.00456789pt" />
      </test>

      <test id="lengthParser9">
          <arg class="java.lang.String" value="-0px" />
          <arg class="java.lang.String" value="0.0px" />
      </test>

      <test id="lengthParser10">
          <arg class="java.lang.String" value="0000%" />
          <arg class="java.lang.String" value="0.0%" />
      </test>
   </testGroup>

    <!-- ================================================================== -->
    <!-- LengthParser failure tests                                         -->
    <!-- The argument is the string to parse                                -->
    <!-- ================================================================== -->

   <testGroup id="lengthParserFail"
              class="org.apache.batik.parser.LengthParserFailureTest">

      <test id="lengthParserFail1">
          <arg class="java.lang.String" value="123.456.7" />
      </test>

      <test id="lengthParserFail2">
          <arg class="java.lang.String" value="1e+" />
      </test>

      <test id="lengthParserFail3">
          <arg class="java.lang.String" value="+e3" />
      </test>

      <test id="lengthParserFail4">
          <arg class="java.lang.String" value="1Em" />
      </test>

      <test id="lengthParserFail5">
          <arg class="java.lang.String" value="--1" />
      </test>

      <test id="lengthParserFail6">
          <arg class="java.lang.String" value="-1E--2" />
      </test>

      <test id="lengthParserFail7">
          <arg class="java.lang.String" value="-.E+1" />
      </test>

      <test id="lengthParserFail8">
          <arg class="java.lang.String" value="-.0EE+1" />
      </test>

      <test id="lengthParserFail9">
          <arg class="java.lang.String" value="1Eem" />
      </test>

      <test id="lengthParserFail10">
          <arg class="java.lang.String" value="1em%" />
      </test>
   </testGroup>

    <!-- ================================================================== -->
    <!-- PathParser tests                                                   -->
    <!-- The first argument is the string to parse                          -->
    <!-- The second argument is the expected string                         -->
    <!-- ================================================================== -->
    <testGroup class="org.apache.batik.parser.PathParserTest">
       <test id="pathParser1" >
           <arg class="java.lang.String" value="M1 2" />
           <arg class="java.lang.String" value="M1.0 2.0" />
       </test>

       <test id="pathParser2" >
           <arg class="java.lang.String" value="m1.1 2.0" />
           <arg class="java.lang.String" value="m1.1 2.0" />
       </test>

       <test id="pathParser3" >
           <arg class="java.lang.String" value="M1 2z" />
           <arg class="java.lang.String" value="M1.0 2.0Z" />
       </test>

       <test id="pathParser4" >
           <arg class="java.lang.String" value="M1 2e3Z" />
           <arg class="java.lang.String" value="M1.0 2000.0Z" />
       </test>

       <test id="pathParser5" >
           <arg class="java.lang.String" value="M1 2L 3,4" />
           <arg class="java.lang.String" value="M1.0 2.0L3.0 4.0" />
       </test>

       <test id="pathParser5.1" >
           <arg class="java.lang.String" value="M1 2 3,4" />
           <arg class="java.lang.String" value="M1.0 2.0L3.0 4.0" />
       </test>

       <test id="pathParser5.2" >
           <arg class="java.lang.String" value="M1, 2, 3,4" />
           <arg class="java.lang.String" value="M1.0 2.0L3.0 4.0" />
       </test>

       <test id="pathParser5.3" >
           <arg class="java.lang.String" value="m1, 2, 3,4" />
           <arg class="java.lang.String" value="m1.0 2.0l3.0 4.0" />
       </test>

       <test id="pathParser6" >
           <arg class="java.lang.String" value="M1 2H3.1" />
           <arg class="java.lang.String" value="M1.0 2.0H3.1" />
       </test>

       <test id="pathParser6.1" >
           <arg class="java.lang.String" value="M1 2H3.1 4" />
           <arg class="java.lang.String" value="M1.0 2.0H3.1H4.0" />
       </test>
       <test id="pathParser6.2" >
           <arg class="java.lang.String" value="M1 2H3.1,4" />
           <arg class="java.lang.String" value="M1.0 2.0H3.1H4.0" />
       </test>

       <test id="pathParser7" >
           <arg class="java.lang.String" value="M1 2h 3.1" />
           <arg class="java.lang.String" value="M1.0 2.0h3.1" />
       </test>
       <test id="pathParser7.1" >
           <arg class="java.lang.String" value="M1 2h 3.1 4" />
           <arg class="java.lang.String" value="M1.0 2.0h3.1h4.0" />
       </test>
       <test id="pathParser7.2" >
           <arg class="java.lang.String" value="M1 2h 3.1,4" />
           <arg class="java.lang.String" value="M1.0 2.0h3.1h4.0" />
       </test>

       <test id="pathParser8" >
           <arg class="java.lang.String" value="M1 2H 3.1,4" />
           <arg class="java.lang.String" value="M1.0 2.0H3.1H4.0" />
       </test>

       <test id="pathParser9" >
           <arg class="java.lang.String" value="M1 2h 3.1-4" />
           <arg class="java.lang.String" value="M1.0 2.0h3.1h-4.0" />
       </test>

       <test id="pathParser10">
           <arg class="java.lang.String" value="M1 2V3.1e-3" />
           <arg class="java.lang.String" value="M1.0 2.0V0.0031" />
       </test>

       <test id="pathParser11">
           <arg class="java.lang.String" value="M1 2V3.1" />
           <arg class="java.lang.String" value="M1.0 2.0V3.1" />
       </test>

       <test id="pathParser12">
           <arg class="java.lang.String" value="M1 2v3.1,.4" />
           <arg class="java.lang.String" value="M1.0 2.0v3.1v0.4" />
       </test>

       <test id="pathParser13">
           <arg class="java.lang.String" value="M1 2v3.1-.4" />
           <arg class="java.lang.String" value="M1.0 2.0v3.1v-0.4" />
       </test>

       <test id="pathParser14">
           <arg class="java.lang.String" value="M1 2C3 4 5 6 7 8" />
           <arg class="java.lang.String" 
                value="M1.0 2.0C3.0 4.0 5.0 6.0 7.0 8.0" />
       </test>

       <test id="pathParser15">
           <arg class="java.lang.String" value="M1 2c.3.4.5.6.7.8" />
           <arg class="java.lang.String" 
                value="M1.0 2.0c0.3 0.4 0.5 0.6 0.7 0.8" />
       </test>

       <test id="pathParser16">
           <arg class="java.lang.String" value="M1 2S3+4+5+6" />
           <arg class="java.lang.String" value="M1.0 2.0S3.0 4.0 5.0 6.0" />
       </test>

       <test id="pathParser17">
           <arg class="java.lang.String" value="M1 2s.3+.4+.5-.6" />
           <arg class="java.lang.String" value="M1.0 2.0s0.3 0.4 0.5 -0.6" />
       </test>

       <test id="pathParser18">
           <arg class="java.lang.String" value="M1 2q3. 4.+5 6" />
           <arg class="java.lang.String" value="M1.0 2.0q3.0 4.0 5.0 6.0" />
       </test>

       <test id="pathParser19">
           <arg class="java.lang.String" value="M1 2Q.3e0.4.5.6" />
           <arg class="java.lang.String" value="M1.0 2.0Q0.3 0.4 0.5 0.6" />
       </test>

       <test id="pathParser20">
           <arg class="java.lang.String" value="M1 2t+.3-.4" />
           <arg class="java.lang.String" value="M1.0 2.0t0.3 -0.4" />
       </test>

       <test id="pathParser21">
           <arg class="java.lang.String" value="M1 2T -.3+4" />
           <arg class="java.lang.String" value="M1.0 2.0T-0.3 4.0" />
       </test>

       <test id="pathParser22">
           <arg class="java.lang.String" value="M1 2a3 4 5 0,1 6 7" />
           <arg class="java.lang.String" 
                value="M1.0 2.0a3.0 4.0 5.0 0 1 6.0 7.0" />
       </test>

       <test id="pathParser23">
           <arg class="java.lang.String" value="M1 2A3 4 5 0,1 6 7" />
           <arg class="java.lang.String" 
                value="M1.0 2.0A3.0 4.0 5.0 0 1 6.0 7.0" />
       </test>

       <test id="pathParser24">
           <arg class="java.lang.String" value="M1 2t+.3-.4,5,6" />
           <arg class="java.lang.String" value="M1.0 2.0t0.3 -0.4t5.0 6.0" />
       </test>

       <test id="pathParser25">
           <arg class="java.lang.String" value="M1 2T -.3+4 5-6" />
           <arg class="java.lang.String" value="M1.0 2.0T-0.3 4.0T5.0 -6.0" />
       </test>
    </testGroup>

    <!-- ================================================================== -->
    <!-- PathParser failure tests                                           -->
    <!-- The argument is the string to parse                                -->
    <!-- ================================================================== -->

    <testGroup class="org.apache.batik.parser.PathParserFailureTest">
       <test id="pathParserFail1">
           <arg class="java.lang.String" value="m 1ee2 3" />
       </test>

       <test id="pathParserFail2">
           <arg class="java.lang.String" value="m 1e4e2 3" />
       </test>

       <test id="pathParserFail3">
           <arg class="java.lang.String" value="m 1e+ 2" />
       </test>

       <test id="pathParserFail4">
           <arg class="java.lang.String" value="m 1 l 3 4" />
       </test>

       <test id="pathParserFail5">
           <arg class="java.lang.String" value="m 1.5.6.7 l 3 4" />
       </test>

       <test id="pathParserFail6">
           <arg class="java.lang.String" value="m 1.5,6.7,l 3 4" />
       </test>

       <test id="pathParserFail7">
           <arg class="java.lang.String" value="m 1.5,6.7,L 3 4" />
       </test>

       <test id="pathParserFail8">
           <arg class="java.lang.String" value="m 1.5,6.7,h 3" />
       </test>

       <test id="pathParserFail9">
           <arg class="java.lang.String" value="m 1.5,6.7,H 3" />
       </test>

       <test id="pathParserFail10">
           <arg class="java.lang.String" value="m 1.5,6.7,v 3" />
       </test>

       <test id="pathParserFail11">
           <arg class="java.lang.String" value="m 1.5,6.7,V 3" />
       </test>

       <test id="pathParserFail12">
           <arg class="java.lang.String" value="m 1.5,6.7,c 1,2 3,4 5,6" />
       </test>
       <test id="pathParserFail13">
           <arg class="java.lang.String" value="m 1.5,6.7,C 1,2 3,4 5,6" />
       </test>

       <test id="pathParserFail14">
           <arg class="java.lang.String" value="m 1.5,6.7,s 1,2 3,4" />
       </test>
       <test id="pathParserFail15">
           <arg class="java.lang.String" value="m 1.5,6.7,S 1,2 3,4" />
       </test>

       <test id="pathParserFail16">
           <arg class="java.lang.String" value="m 1.5,6.7,q 1,2 3,4" />
       </test>
       <test id="pathParserFail17">
           <arg class="java.lang.String" value="m 1.5,6.7,Q 1,2 3,4" />
       </test>

       <test id="pathParserFail18">
           <arg class="java.lang.String" value="m 1.5,6.7,t 1,2" />
       </test>
       <test id="pathParserFail19">
           <arg class="java.lang.String" value="m 1.5,6.7,T 1,2" />
       </test>

       <test id="pathParserFail20">
           <arg class="java.lang.String" value="m 1.5,6.7,a 2,2 0 1 1 2 2" />
       </test>
       <test id="pathParserFail21">
           <arg class="java.lang.String" value="m 1.5,6.7,A 4,4 0 1 1 2 2" />
       </test>

       <!-- Check for double path commands -->
       <test id="pathParserFail22">
           <arg class="java.lang.String" value="m m 1,2"/>
       </test>
       <test id="pathParserFail22.1">
           <arg class="java.lang.String" value="M M 1,2"/>
       </test>

       <test id="pathParserFail23">
           <arg class="java.lang.String" value="m 1,2 l l 3,4 z"/>
       </test>
       <test id="pathParserFail24">
           <arg class="java.lang.String" value="m 1,2 L L 3,4 z"/>
       </test>

       <test id="pathParserFail25">
           <arg class="java.lang.String" value="m 1,2 h h 3 z"/>
       </test>
       <test id="pathParserFail26">
           <arg class="java.lang.String" value="m 1,2 H H 3 z"/>
       </test>

       <test id="pathParserFail27">
           <arg class="java.lang.String" value="m 1,2 v v 3 z"/>
       </test>
       <test id="pathParserFail28">
           <arg class="java.lang.String" value="m 1,2 V V 3 z"/>
       </test>

       <test id="pathParserFail29">
           <arg class="java.lang.String" value="m 1,2 c c 1,2 3,4 5,6z"/>
       </test>
       <test id="pathParserFail30">
           <arg class="java.lang.String" value="m 1,2 C C 1,2 3,4 5,6 z"/>
       </test>

       <test id="pathParserFail31">
           <arg class="java.lang.String" value="m 1,2 s s 1,2 3,4 z"/>
       </test>
       <test id="pathParserFail32">
           <arg class="java.lang.String" value="m 1,2 S S 1,2 3,4 z"/>
       </test>

       <test id="pathParserFail33">
           <arg class="java.lang.String" value="m 1,2 q q 1,2 3,4 z"/>
       </test>
       <test id="pathParserFail34">
           <arg class="java.lang.String" value="m 1,2 Q Q 1,2 3,4 z"/>
       </test>

       <test id="pathParserFail35">
           <arg class="java.lang.String" value="m 1,2 t t 1,2 z"/>
       </test>
       <test id="pathParserFail36">
           <arg class="java.lang.String" value="m 1,2 T T 1,2 z"/>
       </test>

       <test id="pathParserFail37">
           <arg class="java.lang.String" value="m 1.5,6.7 a a 2,2 0 1 1 2 2" />
       </test>
       <test id="pathParserFail38">
           <arg class="java.lang.String" value="m 1.5,6.7 A A 4,4 0 1 1 2 2" />
       </test>
    </testGroup>

    <!-- ================================================================== -->
    <!-- TransformListParser tests                                          -->
    <!-- The first argument is the string to parse                          -->
    <!-- The second argument is the expected string                         -->
    <!-- ================================================================== -->

    <test id="transformParser1" class="org.apache.batik.parser.TransformListParserTest">
        <arg class="java.lang.String" value="matrix(1 2 3 4 5 6)" />
        <arg class="java.lang.String" value="matrix(1.0, 2.0, 3.0, 4.0, 5.0, 6.0)" />
    </test>

    <test id="transformParser2" class="org.apache.batik.parser.TransformListParserTest">
        <arg class="java.lang.String" value="translate(1)" />
        <arg class="java.lang.String" value="translate(1.0)" />
    </test>

    <test id="transformParser3" class="org.apache.batik.parser.TransformListParserTest">
        <arg class="java.lang.String" value="translate(1e2 3e4)" />
        <arg class="java.lang.String" value="translate(100.0, 30000.0)" />
    </test>

    <test id="transformParser4" class="org.apache.batik.parser.TransformListParserTest">
        <arg class="java.lang.String" value="scale(1e-2)" />
        <arg class="java.lang.String" value="scale(0.01)" />
    </test>

    <test id="transformParser5" class="org.apache.batik.parser.TransformListParserTest">
        <arg class="java.lang.String" value="scale(-1e-2 -3e-4)" />
        <arg class="java.lang.String" value="scale(-0.01, -3.0E-4)" />
    </test>

    <test id="transformParser6" class="org.apache.batik.parser.TransformListParserTest">
        <arg class="java.lang.String" value="skewX(1.234)" />
        <arg class="java.lang.String" value="skewX(1.234)" />
    </test>

    <test id="transformParser7" class="org.apache.batik.parser.TransformListParserTest">
        <arg class="java.lang.String" value="skewY(.1)" />
        <arg class="java.lang.String" value="skewY(0.1)" />
    </test>

    <test id="transformParser8" class="org.apache.batik.parser.TransformListParserTest">
        <arg class="java.lang.String" value="translate(1,2) skewY(.1)" />
        <arg class="java.lang.String" value="translate(1.0, 2.0) skewY(0.1)" />
    </test>

    <test id="transformParser9" class="org.apache.batik.parser.TransformListParserTest">
        <arg class="java.lang.String" value="scale(1,2),skewX(.1e1)" />
        <arg class="java.lang.String" value="scale(1.0, 2.0) skewX(1.0)" />
    </test>

    <test id="transformParser10" class="org.apache.batik.parser.TransformListParserTest">
        <arg class="java.lang.String" value="scale(1) , skewX(2) translate(3,4)" />
        <arg class="java.lang.String" value="scale(1.0) skewX(2.0) translate(3.0, 4.0)"/>
    </test>

</testSuite>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy