vhardy      2002/06/10 02:29:08

  Modified:    test-resources/org/apache/batik/test regard.xml
  Added:       test-sources/org/apache/batik/swing NullURITest.java
               test-resources/org/apache/batik/swing unitTesting.xml
  Log:
  Added test case for Bug/RFE #6683
  
  Revision  Changes    Path
  1.1                  xml-batik/test-sources/org/apache/batik/swing/NullURITest.java
  
  Index: NullURITest.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.swing;
  
  import javax.swing.*;
  import java.awt.event.*;
  
  import org.apache.batik.swing.svg.*;
  import org.apache.batik.test.*;
  
  /**
   * This test makes sure that setting the canvas's document uri to 
   * null does not cause a NullPointerException
   *
   * @author <a href="mailto:[EMAIL PROTECTED]";>Vincent Hardy</a>
   * @version $Id: NullURITest.java,v 1.1 2002/06/10 09:29:08 vhardy Exp $
   */
  public class NullURITest extends AbstractTest {
      /**
       * Code used if error happens while setting null URI on JSVGCanvas
       */
      public static final String ERROR_WITH_NULL_URI
          = "error.with.null.uri";
  
      public TestReport runImpl() throws Exception {
          final JSVGCanvas canvas = new JSVGCanvas();
          final String monitor = "monitor";
  
          class LoadListener extends SVGDocumentLoaderAdapter {
              public boolean failed = false;
              public void documentLoadingFailed(SVGDocumentLoaderEvent e) {
                  synchronized(monitor){
                      System.out.println(">>>>>>>>>>>>>>> in documentLoadingFailed");
                      failed = true;
                      monitor.notifyAll();
                  }
              }
  
              public void documentLoadingCancelled(SVGDocumentLoaderEvent e) {
                  synchronized(monitor){
                      monitor.notifyAll();
                  }
              }
  
              public void documentLoadingCompleted(SVGDocumentLoaderEvent e) {
                  synchronized(monitor){
                      monitor.notifyAll();
                  }
              }
          }
  
          LoadListener l = new LoadListener();
          canvas.addSVGDocumentLoaderListener(l);
  
          canvas.setURI(null);
  
          // Give chance to the DocumentLoader thread to kick in
          // This is not 
          synchronized(monitor){
              // Document loading should not take more than 10 sec.
              // Put a maximum to avoid deadlocks in case something
              // else goes wrong.
              monitor.wait(10000);
          }
  
          if (!l.failed){
              return reportSuccess();
          } else {
              return reportError(ERROR_WITH_NULL_URI);
          }
      }
  }
  
  
  
  1.1                  xml-batik/test-resources/org/apache/batik/swing/unitTesting.xml
  
  Index: unitTesting.xml
  ===================================================================
  <!-- ========================================================================= -->
  <!-- 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.                                                         -->
  <!-- ========================================================================= -->
  
  <!-- ========================================================================= -->
  <!-- @author [EMAIL PROTECTED]                                         -->
  <!-- @version $Id $  -->
  <!-- ========================================================================= -->
  <testSuite id="swing.unitTesting" name="org.apache.batik.swing package - Unit 
Testing">
      <test id="NullURITest" class="org.apache.batik.swing.NullURITest" />
  </testSuite>
  
  
  
  1.27      +2 -1      xml-batik/test-resources/org/apache/batik/test/regard.xml
  
  Index: regard.xml
  ===================================================================
  RCS file: /home/cvs/xml-batik/test-resources/org/apache/batik/test/regard.xml,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- regard.xml        6 Jun 2002 08:21:22 -0000       1.26
  +++ regard.xml        10 Jun 2002 09:29:08 -0000      1.27
  @@ -11,7 +11,7 @@
   <!-- regression testing.                                                       -->
   <!--                                                                           -->
   <!-- @author [EMAIL PROTECTED]                                         -->
  -<!-- @version $Id: regard.xml,v 1.26 2002/06/06 08:21:22 vhardy Exp $  -->
  +<!-- @version $Id: regard.xml,v 1.27 2002/06/10 09:29:08 vhardy Exp $  -->
   <!-- ========================================================================= -->
   <testRun id="regard" name="Batik Standard Regression Test Run">
       <testReportProcessor class="org.apache.batik.test.xml.XMLTestReportProcessor" > 
  @@ -61,6 +61,7 @@
       <testSuite href="file:test-resources/org/apache/batik/gvt/unitTesting.xml" /> 
       <testSuite href="file:test-resources/org/apache/batik/parser/unitTesting.xml" 
/> 
       <testSuite 
href="file:test-resources/org/apache/batik/script/rhino/unitTesting.xml" />
  +    <testSuite href="file:test-resources/org/apache/batik/swing/unitTesting.xml" />
       <testSuite 
href="file:test-resources/org/apache/batik/transcoder/image/unitTesting.xml" /> 
       <testSuite 
href="file:test-resources/org/apache/batik/css/engine/value/unitTesting.xml" /> 
   
  
  
  

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

Reply via email to