hillion     02/05/02 05:59:33

  Modified:    test-resources/org/apache/batik/dom/svg unitTesting.xml
  Added:       test-resources/org/apache/batik/dom/svg lengthTest.svg
               test-sources/org/apache/batik/dom/svg
                        EcmaScriptSVGDOMTest.java
  Log:
  Committed tests for SVGLength.
  
  Revision  Changes    Path
  1.2       +9 -1      
xml-batik/test-resources/org/apache/batik/dom/svg/unitTesting.xml
  
  Index: unitTesting.xml
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/test-resources/org/apache/batik/dom/svg/unitTesting.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- unitTesting.xml   15 Apr 2002 10:16:18 -0000      1.1
  +++ unitTesting.xml   2 May 2002 12:59:33 -0000       1.2
  @@ -8,7 +8,7 @@
   
   <!-- ========================================================================= -->
   <!-- @author [EMAIL PROTECTED]                                                  -->
  -<!-- @version $Id: unitTesting.xml,v 1.1 2002/04/15 10:16:18 hillion Exp $  -->
  +<!-- @version $Id: unitTesting.xml,v 1.2 2002/05/02 12:59:33 hillion Exp $  -->
   <!-- ========================================================================= -->
   <testSuite id="dom.svg.unitTesting"
              name="org.apache.batik.dom.svg package - Unit Testing">
  @@ -32,5 +32,13 @@
                value="test-resources/org/apache/batik/dom/svg/test.svg" />
           <arg class="java.lang.String" value="nodeID" />
       </test>
  +
  +    <!-- ================================================================ -->
  +    <!-- Self contained tests                                             -->
  +    <!-- ================================================================ -->
  +    <testGroup id="basic" name="Basic SVG DOM Testing"
  +               class="org.apache.batik.dom.svg.EcmaScriptSVGDOMTest">
  +        <test id="lengthTest"/>
  +    </testGroup>
   
   </testSuite>
  
  
  
  1.1                  xml-batik/test-resources/org/apache/batik/dom/svg/lengthTest.svg
  
  Index: lengthTest.svg
  ===================================================================
  <?xml version="1.0" standalone="no"?>
  <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
  "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd";>
  
  <!-- ========================================================================= -->
  <!-- Copyright (C) The Apache Software Foundation. All rights reserved.        -->
  <!--                                                                           -->
  <!-- This software is published under the terms of the Apache Software License -->
  <!-- version 1.1, a copy of which has been included with this distribution in  -->
  <!-- the LICENSE file.                                                         -->
  <!-- ========================================================================= -->
  
  <!-- ========================================================================= -->
  <!-- This test checks that the various RGB values read from the SVGColor       -->
  <!-- interface return accurate values.                                         -->
  <!--                                                                           -->
  <!-- @author [EMAIL PROTECTED]                                                  -->
  <!-- @version $Id: lengthTest.svg,v 1.1 2002/05/02 12:59:33 hillion Exp $            
-->
  <!-- ========================================================================= -->
  
  <svg xmlns="http://www.w3.org/2000/svg"; 
       xmlns:xlink="http://www.w3.org/1999/xlink"; 
       xmlns:test="http://xml.apache.org/batik/test";
       width="450" height="500" viewBox="0 0 450 500"
       onload="runTest(evt)">
  
    <test:testResult id="testResult" />
  
    <script type="text/ecmascript"><![CDATA[
       var testNS = "http://xml.apache.org/batik/test";;
  
       function runTest() {
           var result = document.getElementById("testResult");
           result.setAttributeNS(null, "result", "failed");
           
           var r1 = document.getElementById("r1")
           if (r1 == null){
            result.setAttributeNS(null, "errorCode", "cannot.find.test.element");
            var entry = document.createElementNS(testNS, "errorDescriptionEntry");
            entry.setAttributeNS(null, "id", "missing.element.id");
            entry.setAttributeNS(null, "value", "r1");
            result.appendChild(entry);
            return;
           }
  
           var r2 = document.getElementById("r2")
           if (r2 == null){
            result.setAttributeNS(null, "errorCode", "cannot.find.test.element");
            var entry = document.createElementNS(testNS, "errorDescriptionEntry");
            entry.setAttributeNS(null, "id", "missing.element.id");
            entry.setAttributeNS(null, "value", "r2");
            result.appendChild(entry);
            return;
           }
  
           var r3 = document.getElementById("r3")
           if (r3 == null){
            result.setAttributeNS(null, "errorCode", "cannot.find.test.element");
            var entry = document.createElementNS(testNS, "errorDescriptionEntry");
            entry.setAttributeNS(null, "id", "missing.element.id");
            entry.setAttributeNS(null, "value", "r3");
            result.appendChild(entry);
            return;
           }
  
          alert(r1.width.baseVal.value)
          alert(r2.width.baseVal.value)
          alert(r3.width.baseVal.value)
  
           if (r1.width.baseVal.value != 20) {
             result.setAttributeNS(null, "errorCode", "invalid.r1.width");
             var entry = document.createElementNS(testNS,
                                                  "errorDescriptionEntry");
             entry.setAttributeNS(null, "id", "r1.value.found");
             entry.setAttributeNS(null, "value", r1.width.baseVal.value);
             result.appendChild(entry);
             return;
           }
  
           if (r2.width.baseVal.value > 20.00001 ||
               r2.width.baseVal.value < 19.99999) {
             result.setAttributeNS(null, "errorCode", "invalid.r2.width");
             var entry = document.createElementNS(testNS,
                                                  "errorDescriptionEntry");
             entry.setAttributeNS(null, "id", "r2.value.found");
             entry.setAttributeNS(null, "value", r2.width.baseVal.value);
             result.appendChild(entry);
             return;
           }
  
           if (r3.width.baseVal.value > 20.00001 ||
               r3.width.baseVal.value < 19.99999) {
             result.setAttributeNS(null, "errorCode", "invalid.r3.width");
             var entry = document.createElementNS(testNS,
                                                  "errorDescriptionEntry");
             entry.setAttributeNS(null, "id", "r3.value.found");
             entry.setAttributeNS(null, "value", r3.width.baseVal.value);
             result.appendChild(entry);
             return;
           }
  
           result.setAttributeNS(null, "result", "passed");
       }
    ]]></script>
  
    <g>
       <rect id="r1" x="0" y="10" width="20" height="80"/>
       <rect id="r2" x="6.66%" y="2%" width="4.4444444444%" height="16%"/>
       <rect id="r3" x="15.87mm" y="2.645mm" width="5.2916666666mm"
                     height="21.16mm"/>
    </g>
  </svg>
  
  
  
  1.1                  
xml-batik/test-sources/org/apache/batik/dom/svg/EcmaScriptSVGDOMTest.java
  
  Index: EcmaScriptSVGDOMTest.java
  ===================================================================
  /*****************************************************************************
   * Copyright (C) The Apache Software Foundation. All rights reserved.        *
   * ------------------------------------------------------------------------- *
   * This software is published under the terms of the Apache Software License *
   * version 1.1, a copy of which has been included with this distribution in  *
   * the LICENSE file.                                                         *
   *****************************************************************************/
  
  package org.apache.batik.dom.svg;
  
  import org.apache.batik.test.svg.SelfContainedSVGOnLoadTest;
  
  /**
   * Helper class to simplify writing the unitTesting.xml file for 
   * CSS DOM Tests.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]";>Vincent Hardy</a>
   * @version $Id: EcmaScriptSVGDOMTest.java,v 1.1 2002/05/02 12:59:33 hillion Exp $
   */
  
  public class EcmaScriptSVGDOMTest extends SelfContainedSVGOnLoadTest {
      public void setId(String id){
          super.setId(id);
          svgURL = resolveURL("test-resources/org/apache/batik/dom/svg/" + id + 
".svg");
      }
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to