Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.batik.test.svg
Class SelfContainedSVGOnLoadTest  view SelfContainedSVGOnLoadTest download SelfContainedSVGOnLoadTest.java

java.lang.Object
  extended byorg.apache.batik.test.AbstractTest
      extended byorg.apache.batik.test.svg.SelfContainedSVGOnLoadTest
All Implemented Interfaces:
org.apache.batik.test.Test

public class SelfContainedSVGOnLoadTest
extends org.apache.batik.test.AbstractTest

This test takes an SVG file as an input. It processes the input SVG (meaning it turns it into a GVT tree) and then dispatches the 'onload' event. The SVG input file should contain script that will position the result of the test in the DOM using the following namespace:
xmlns:test="http://xml.apache.org/batik/test"
The result should be set in the result attribute of the <testResult> element by the script embeded in the input SVG test file.
Sample input SVG file:
<svg ... onload="runTest(evt)" xmlns:test="http://xml.apache.org/batik/test" > <script type="text/ecmascript"> function runTest(evt) { ...; // do some test var rootSvg = document.getDocumentElement(); var result = document.createElementNS("http://xml.apache.org/batik/test", "testResult"); result.setAttributeNS(null, "result", "failed"); result.setAttributeNS(null, "errorCode", "org.apache.batik.css.dom.wrong.computed.value"); rootSvg.appendChild(result); } </script> </svg>

Version:
$Id: SelfContainedSVGOnLoadTest.java,v 1.6 2004/08/18 07:17:03 vhardy Exp $

Field Summary
static java.lang.String ATTRIBUTE_KEY
           
static java.lang.String ATTRIBUTE_RESULT
           
static java.lang.String ATTRIBUTE_VALUE
           
static java.lang.String ENTRY_KEY_ERROR_DESCRIPTION
          Entry describing the error
static java.lang.String ENTRY_KEY_NUMBER_OF_TEST_RESULT_ELEMENTS
          Entry describing the number of testResult elements found in the document after dispatching onload.
static java.lang.String ENTRY_KEY_RESULT_VALUE
          Entry describing the result value (different from 'passed' or 'failed' found in the 'result' attribute.
static java.lang.String ERROR_CANNOT_LOAD_SVG_DOCUMENT
          Error when the input file cannot be loaded into a Document object {0} = IOException message
static java.lang.String ERROR_MISSING_OR_EMPTY_ERROR_CODE_ON_FAILED_TEST
          The result was 'failed' but there was no 'errorCode' attribute or it was the empty string
static java.lang.String ERROR_UNEXPECTED_NUMBER_OF_TEST_RESULT_ELEMENTS
          There is either 0 or more than one elements in the document after dispatching the onload event.
static java.lang.String ERROR_UNEXPECTED_RESULT_VALUE
          The 'result' attribute value is neither 'passed' nor 'failed'
static java.lang.String ERROR_WHILE_PROCESSING_SVG_DOCUMENT
          Error while building the GVT tree or dispatching the 'onload' event.
protected  java.lang.String svgURL
          The URL for the input SVG document to be tested
static java.lang.String TAG_ERROR_DESCRIPTION_ENTRY
           
static java.lang.String TAG_TEST_RESULT
          Test Constants
static java.lang.String TEST_RESULT_FAILED
           
static java.lang.String TEST_RESULT_PASSED
           
static java.lang.String testNS
          Test Namespace
 
Fields inherited from class org.apache.batik.test.AbstractTest
id, name, parent
 
Constructor Summary
protected SelfContainedSVGOnLoadTest()
          Default constructor
  SelfContainedSVGOnLoadTest(java.lang.String svgURL)
           
 
Method Summary
protected  org.apache.batik.bridge.UserAgent buildUserAgent()
          Give subclasses a chance to build their own UserAgent
protected  java.lang.String resolveURL(java.lang.String url)
          Resolves the input string as follows.
 org.apache.batik.test.TestReport runImpl()
          Run this test and produce a report.
 
Methods inherited from class org.apache.batik.test.AbstractTest
assertEquals, assertEquals, assertNull, assertTrue, error, getId, getName, getParent, getQualifiedId, reportError, reportException, reportSuccess, run, runImplBasic, setId, setName, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ERROR_CANNOT_LOAD_SVG_DOCUMENT

public static final java.lang.String ERROR_CANNOT_LOAD_SVG_DOCUMENT
Error when the input file cannot be loaded into a Document object {0} = IOException message

See Also:
Constant Field Values

ERROR_WHILE_PROCESSING_SVG_DOCUMENT

public static final java.lang.String ERROR_WHILE_PROCESSING_SVG_DOCUMENT
Error while building the GVT tree or dispatching the 'onload' event.

See Also:
Constant Field Values

ERROR_UNEXPECTED_NUMBER_OF_TEST_RESULT_ELEMENTS

public static final java.lang.String ERROR_UNEXPECTED_NUMBER_OF_TEST_RESULT_ELEMENTS
There is either 0 or more than one elements in the document after dispatching the onload event.

See Also:
Constant Field Values

ERROR_UNEXPECTED_RESULT_VALUE

public static final java.lang.String ERROR_UNEXPECTED_RESULT_VALUE
The 'result' attribute value is neither 'passed' nor 'failed'

See Also:
Constant Field Values

ERROR_MISSING_OR_EMPTY_ERROR_CODE_ON_FAILED_TEST

public static final java.lang.String ERROR_MISSING_OR_EMPTY_ERROR_CODE_ON_FAILED_TEST
The result was 'failed' but there was no 'errorCode' attribute or it was the empty string

See Also:
Constant Field Values

ENTRY_KEY_ERROR_DESCRIPTION

public static final java.lang.String ENTRY_KEY_ERROR_DESCRIPTION
Entry describing the error

See Also:
Constant Field Values

ENTRY_KEY_NUMBER_OF_TEST_RESULT_ELEMENTS

public static final java.lang.String ENTRY_KEY_NUMBER_OF_TEST_RESULT_ELEMENTS
Entry describing the number of testResult elements found in the document after dispatching onload.

See Also:
Constant Field Values

ENTRY_KEY_RESULT_VALUE

public static final java.lang.String ENTRY_KEY_RESULT_VALUE
Entry describing the result value (different from 'passed' or 'failed' found in the 'result' attribute.

See Also:
Constant Field Values

testNS

public static final java.lang.String testNS
Test Namespace

See Also:
Constant Field Values

TAG_TEST_RESULT

public static final java.lang.String TAG_TEST_RESULT
Test Constants

See Also:
Constant Field Values

TAG_ERROR_DESCRIPTION_ENTRY

public static final java.lang.String TAG_ERROR_DESCRIPTION_ENTRY
See Also:
Constant Field Values

ATTRIBUTE_RESULT

public static final java.lang.String ATTRIBUTE_RESULT
See Also:
Constant Field Values

ATTRIBUTE_KEY

public static final java.lang.String ATTRIBUTE_KEY
See Also:
Constant Field Values

ATTRIBUTE_VALUE

public static final java.lang.String ATTRIBUTE_VALUE
See Also:
Constant Field Values

TEST_RESULT_PASSED

public static final java.lang.String TEST_RESULT_PASSED
See Also:
Constant Field Values

TEST_RESULT_FAILED

public static final java.lang.String TEST_RESULT_FAILED
See Also:
Constant Field Values

svgURL

protected java.lang.String svgURL
The URL for the input SVG document to be tested

Constructor Detail

SelfContainedSVGOnLoadTest

public SelfContainedSVGOnLoadTest(java.lang.String svgURL)

SelfContainedSVGOnLoadTest

protected SelfContainedSVGOnLoadTest()
Default constructor

Method Detail

resolveURL

protected java.lang.String resolveURL(java.lang.String url)
Resolves the input string as follows. + First, the string is interpreted as a file description. If the file exists, then the file name is turned into a URL. + Otherwise, the string is supposed to be a URL. If it is an invalid URL, an IllegalArgumentException is thrown.


runImpl

public org.apache.batik.test.TestReport runImpl()
                                         throws java.lang.Exception
Run this test and produce a report. The test goes through the following steps:
  • load the input SVG into a Document
  • build the GVT tree corresponding to the Document and dispatch the 'onload' event
  • looks for one and only one <testResult> element in the Document. This is used to build the returned TestReport


buildUserAgent

protected org.apache.batik.bridge.UserAgent buildUserAgent()
Give subclasses a chance to build their own UserAgent