You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by vh...@apache.org on 2002/07/08 13:54:03 UTC

cvs commit: xml-batik/test-resources/org/apache/batik/svggen regsvggen.xml

vhardy      2002/07/08 04:54:02

  Modified:    sources/org/apache/batik/script/rhino RhinoClassLoader.java
               test-resources/org/apache/batik/svggen regsvggen.xml
  Added:       test-sources/org/apache/batik/svggen
                        ShowGraphics2DOutput.java
  Log:
  Fixed problem when handling documents with null URL. Problem appeared in RhinoClassLoader
  
  Revision  Changes    Path
  1.4       +6 -2      xml-batik/sources/org/apache/batik/script/rhino/RhinoClassLoader.java
  
  Index: RhinoClassLoader.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/script/rhino/RhinoClassLoader.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- RhinoClassLoader.java	13 Jun 2002 11:19:38 -0000	1.3
  +++ RhinoClassLoader.java	8 Jul 2002 11:54:02 -0000	1.4
  @@ -98,7 +98,11 @@
        * can be read.
        */
       protected PermissionCollection getPermissions(CodeSource codesource) {
  -        PermissionCollection perms = super.getPermissions(codesource);
  +        PermissionCollection perms = null;
  +
  +        if (codesource != null) {
  +            perms = super.getPermissions(codesource);
  +        }
   
           if (documentURL != null && perms != null) {
               Permission p = null;
  
  
  
  1.1                  xml-batik/test-sources/org/apache/batik/svggen/ShowGraphics2DOutput.java
  
  Index: ShowGraphics2DOutput.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.svggen;
  
  import org.apache.batik.swing.*;
  import org.apache.batik.svggen.*;
  import org.apache.batik.dom.svg.SVGDOMImplementation;
  import org.w3c.dom.*;
  import org.w3c.dom.svg.*;
  import org.apache.batik.dom.svg.*;
  import javax.swing.*;
  import java.awt.*;
  import java.awt.geom.*;
  import org.apache.batik.bridge.*;
  import org.apache.batik.test.*;
  
  /**
   * Checks that the content generated from the SVGGraphics2D and to which
   * an event handler has been added can be processed by Batik.
   *
   * @author <a mailto="vincent.hardy@sun.com">Vincent Hardy</a>
   * @version $Id: ShowGraphics2DOutput.java,v 1.1 2002/07/08 11:54:02 vhardy Exp $
   */
  public class ShowGraphics2DOutput extends AbstractTest {
      public TestReport runImpl() throws Exception {
  
          DOMImplementation impl = SVGDOMImplementation.getDOMImplementation();
          String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
          SVGDocument doc = (SVGDocument)impl.createDocument(svgNS, "svg", null);
          
          SVGGraphics2D g = new SVGGraphics2D(doc);
  
          Shape circle = new Ellipse2D.Double(0,0,50,50);
          g.setPaint(Color.red);
          g.fill(circle);
          g.translate(60,0);
          g.setPaint(Color.green);
          g.fill(circle);
          g.translate(60,0);
          g.setPaint(Color.blue);
          g.fill(circle);
          g.setSVGCanvasSize(new Dimension(180,50));
  
          Element root = doc.getDocumentElement();
  
          // The following populates the document root with the 
          // generated SVG content.
          g.getRoot(root);
  
          root.setAttribute("onload", "System.out.println('hello')");
  
          // Now that the SVG file has been loaded, build
          // a GVT Tree from it
          TestUserAgent userAgent = new TestUserAgent();
          GVTBuilder builder = new GVTBuilder();
          BridgeContext ctx = new BridgeContext(userAgent);
          ctx.setDynamic(true);
  
          builder.build(ctx, doc);
          BaseScriptingEnvironment scriptEnvironment 
              = new BaseScriptingEnvironment(ctx);
          scriptEnvironment.loadScripts();
          scriptEnvironment.dispatchSVGLoadEvent();
  
          if (!userAgent.failed) {
              return reportSuccess();
          } else {
              return reportError("Got exception while processing document");
          }
      }
  
      class TestUserAgent extends UserAgentAdapter {
          boolean failed;
  
          public void displayError(Exception e) {
              failed = true;
          } 
      }
  }
  
  
  
  1.17      +3 -2      xml-batik/test-resources/org/apache/batik/svggen/regsvggen.xml
  
  Index: regsvggen.xml
  ===================================================================
  RCS file: /home/cvs/xml-batik/test-resources/org/apache/batik/svggen/regsvggen.xml,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- regsvggen.xml	18 Jun 2002 08:05:23 -0000	1.16
  +++ regsvggen.xml	8 Jul 2002 11:54:02 -0000	1.17
  @@ -37,7 +37,8 @@
       <test id="ShearTest" />
       <test id="Texture" />
       <test id="TextSpacePreserve" />    
  -    <test id="TransformCollapse" />
  +    <test id="TransformCollapse" /> 
   
  +    <test id="ShowSVG" class="org.apache.batik.svggen.ShowGraphics2DOutput" />
       <test id="GetRootTest" class="org.apache.batik.svggen.GetRootTest" />
   </testSuite>
  
  
  

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