vhardy 01/10/16 03:38:10
Modified: test-sources/org/apache/batik/test DefaultTestSuite.java
test-sources/org/apache/batik/test/svg
SVGAlternateStyleSheetRenderingAccuracyTest.java
SVGMediaRenderingAccuracyTest.java
SVGRenderingAccuracyTest.java
SVGRenderingAccuracyTestValidator.java
test-sources/org/apache/batik/test/xml XMLReflect.java
XMLTestSuiteLoader.java
Added: test-sources/org/apache/batik/test/svg
ParametrizedRenderingAccuracyTest.java
PreconfiguredRenderingTest.java
SVGReferenceRenderingAccuracyTest.java
SamplesRenderingTest.java
Log:
Improved test suite:
a. The "class" attribute in testSuites is now inherited.
b. Added a notion of testGroup
c. Improved output for xml test reports.
Revision Changes Path
1.4 +13 -4
xml-batik/test-sources/org/apache/batik/test/DefaultTestSuite.java
Index: DefaultTestSuite.java
===================================================================
RCS file:
/home/cvs/xml-batik/test-sources/org/apache/batik/test/DefaultTestSuite.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DefaultTestSuite.java 2001/10/04 08:25:36 1.3
+++ DefaultTestSuite.java 2001/10/16 10:38:10 1.4
@@ -15,13 +15,13 @@
* Default implementation of the <tt>TestSuite</tt> interface.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Vincent Hardy</a>
- * @version $Id: DefaultTestSuite.java,v 1.3 2001/10/04 08:25:36 vhardy Exp $
+ * @version $Id: DefaultTestSuite.java,v 1.4 2001/10/16 10:38:10 vhardy Exp $
*/
public class DefaultTestSuite extends AbstractTest implements TestSuite {
/**
* This Test's name
*/
- private String name = this.getClass().getName();
+ private String name = null;
/**
* Stores the list of child tests
@@ -66,11 +66,20 @@
}
public String getName(){
- return name;
+ if(name != null){
+ return name;
+ }
+
+ String id = getId();
+ if(id != null && !"".equals(id)){
+ return id;
+ }
+
+ return this.getClass().getName();
}
public void setName(String name){
- if(name == null){
+ if(name == null && !"".equals(name)){
throw new IllegalArgumentException();
}
1.3 +5 -17
xml-batik/test-sources/org/apache/batik/test/svg/SVGAlternateStyleSheetRenderingAccuracyTest.java
Index: SVGAlternateStyleSheetRenderingAccuracyTest.java
===================================================================
RCS file:
/home/cvs/xml-batik/test-sources/org/apache/batik/test/svg/SVGAlternateStyleSheetRenderingAccuracyTest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SVGAlternateStyleSheetRenderingAccuracyTest.java 2001/10/12 07:37:19 1.2
+++ SVGAlternateStyleSheetRenderingAccuracyTest.java 2001/10/16 10:38:10 1.3
@@ -17,27 +17,15 @@
* alternate stylesheet label.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephane Hillion</a>
- * @version $Id: SVGAlternateStyleSheetRenderingAccuracyTest.java,v 1.2 2001/10/12
07:37:19 hillion Exp $
+ * @version $Id: SVGAlternateStyleSheetRenderingAccuracyTest.java,v 1.3 2001/10/16
10:38:10 vhardy Exp $
*/
public class SVGAlternateStyleSheetRenderingAccuracyTest
- extends SVGRenderingAccuracyTest {
-
+ extends ParametrizedRenderingAccuracyTest {
/**
- * The stylesheet to use for rendering.
- */
- protected String title;
-
- /**
* Constructor.
- * @param svgURL the URL String for the SVG document being tested.
- * @param refImgURL the URL for the reference image.
- * @param t The stylesheet title to use.
*/
- public SVGAlternateStyleSheetRenderingAccuracyTest(String svgURL,
- String refImgURL,
- String t) {
- super(svgURL, refImgURL);
- title = t;
+ public SVGAlternateStyleSheetRenderingAccuracyTest(){
+ super();
}
/**
@@ -48,7 +36,7 @@
*/
protected Document manipulateSVGDocument(Document doc) {
// enable the stylesheet
- ((SVGOMDocument)doc).enableAlternateStyleSheet(title);
+ ((SVGOMDocument)doc).enableAlternateStyleSheet(parameter);
return doc;
}
}
1.4 +4 -22
xml-batik/test-sources/org/apache/batik/test/svg/SVGMediaRenderingAccuracyTest.java
Index: SVGMediaRenderingAccuracyTest.java
===================================================================
RCS file:
/home/cvs/xml-batik/test-sources/org/apache/batik/test/svg/SVGMediaRenderingAccuracyTest.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SVGMediaRenderingAccuracyTest.java 2001/10/12 14:35:06 1.3
+++ SVGMediaRenderingAccuracyTest.java 2001/10/16 10:38:10 1.4
@@ -16,35 +16,17 @@
* media.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephane Hillion</a>
- * @version $Id: SVGMediaRenderingAccuracyTest.java,v 1.3 2001/10/12 14:35:06
hillion Exp $
+ * @version $Id: SVGMediaRenderingAccuracyTest.java,v 1.4 2001/10/16 10:38:10
vhardy Exp $
*/
-public class SVGMediaRenderingAccuracyTest extends SVGRenderingAccuracyTest {
-
+public class SVGMediaRenderingAccuracyTest
+ extends ParametrizedRenderingAccuracyTest {
/**
- * The media to use for rendering.
- */
- protected String media;
-
- /**
- * Constructor.
- * @param svgURL the URL String for the SVG document being tested.
- * @param refImgURL the URL for the reference image.
- * @param m The media to use.
- */
- public SVGMediaRenderingAccuracyTest(String svgURL,
- String refImgURL,
- String m) {
- super(svgURL, refImgURL);
- media = m;
- }
-
- /**
* Returns the <tt>ImageTranscoder</tt> the Test should
* use
*/
public ImageTranscoder getTestImageTranscoder(){
ImageTranscoder t = super.getTestImageTranscoder();
- t.addTranscodingHint(PNGTranscoder.KEY_MEDIA, media);
+ t.addTranscodingHint(PNGTranscoder.KEY_MEDIA, parameter);
return t;
}
1.15 +15 -1
xml-batik/test-sources/org/apache/batik/test/svg/SVGRenderingAccuracyTest.java
Index: SVGRenderingAccuracyTest.java
===================================================================
RCS file:
/home/cvs/xml-batik/test-sources/org/apache/batik/test/svg/SVGRenderingAccuracyTest.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- SVGRenderingAccuracyTest.java 2001/10/11 18:37:33 1.14
+++ SVGRenderingAccuracyTest.java 2001/10/16 10:38:10 1.15
@@ -64,7 +64,7 @@
* all pixel values are the same).
*
* @author <a href="mailto:[EMAIL PROTECTED]">Vincent Hardy</a>
- * @version $Id: SVGRenderingAccuracyTest.java,v 1.14 2001/10/11 18:37:33 hillion
Exp $
+ * @version $Id: SVGRenderingAccuracyTest.java,v 1.15 2001/10/16 10:38:10 vhardy
Exp $
*/
public class SVGRenderingAccuracyTest extends AbstractTest {
/**
@@ -278,6 +278,20 @@
*/
public SVGRenderingAccuracyTest(String svgURL,
String refImgURL){
+ setConfig(svgURL, refImgURL);
+ }
+
+ /**
+ * For subclasses
+ */
+ protected SVGRenderingAccuracyTest(){
+ }
+
+ /**
+ * Sets this test's config.
+ */
+ public void setConfig(String svgURL,
+ String refImgURL){
if(svgURL == null){
throw new IllegalArgumentException();
}
1.5 +67 -1
xml-batik/test-sources/org/apache/batik/test/svg/SVGRenderingAccuracyTestValidator.java
Index: SVGRenderingAccuracyTestValidator.java
===================================================================
RCS file:
/home/cvs/xml-batik/test-sources/org/apache/batik/test/svg/SVGRenderingAccuracyTestValidator.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- SVGRenderingAccuracyTestValidator.java 2001/10/08 14:51:35 1.4
+++ SVGRenderingAccuracyTestValidator.java 2001/10/16 10:38:10 1.5
@@ -34,7 +34,7 @@
* they are handled properly by the class.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Vincent Hardy</a>
- * @version $Id: SVGRenderingAccuracyTestValidator.java,v 1.4 2001/10/08 14:51:35
vhardy Exp $
+ * @version $Id: SVGRenderingAccuracyTestValidator.java,v 1.5 2001/10/16 10:38:10
vhardy Exp $
*/
public class SVGRenderingAccuracyTestValidator extends DefaultTestSuite {
/**
@@ -106,6 +106,7 @@
addTest(new SameSizeDifferentContent());
addTest(new AccurateRendering());
addTest(new AccurateRenderingWithVariation());
+ addTest(new DefaultConfigTest());
}
/**
@@ -140,6 +141,71 @@
tmpFile.deleteOnExit();
return tmpFile.toURL();
+ }
+
+
+ /**
+ * Validates that the default parameters computation is
+ * working as expected.
+ */
+ static class DefaultConfigTest extends AbstractTest {
+ String svgURL = "samples/anne.svg";
+ String expectedRefImgURL = "test-references/samples/anne.png";
+ String expectedVariationURL =
"test-references/samples/accepted-variation/anne.png";
+ String expectedCandidateURL =
"test-references/samples/candidate-variation/anne.png";
+
+ String ERROR_EXCEPTION_WHILE_BUILDING_TEST
+ = "error.exception.while.building.test";
+
+ String ERROR_UNEXPECTED_REFERENCE_IMAGE_URL
+ = "error.unexpected.reference.image.url";
+
+ String ERROR_UNEXPECTED_VARIATION_URL
+ = "error.unexpected.variation.url";
+
+ String ERROR_UNEXPECTED_CANDIDATE_URL
+ = "error.unexpected.candidate.url";
+
+ String ENTRY_KEY_EXPECTED_VALUE
+ = "entry.key.expected.value";
+
+ String ENTRY_KEY_FOUND_VALUE
+ = "entry.key.found.value";
+
+ public DefaultConfigTest(){
+ super();
+ setId("defaultTest");
+ }
+
+ public TestReport runImpl() throws Exception {
+ SVGRenderingAccuracyTest t
+ = new SamplesRenderingTest();
+
+ t.setId(svgURL);
+
+ if(!t.refImgURL.toString().endsWith(expectedRefImgURL)){
+ TestReport r = reportError(ERROR_UNEXPECTED_REFERENCE_IMAGE_URL);
+ r.addDescriptionEntry(ENTRY_KEY_EXPECTED_VALUE, expectedRefImgURL);
+ r.addDescriptionEntry(ENTRY_KEY_FOUND_VALUE, "" + t.refImgURL);
+ return r;
+ }
+
+ if(!t.variationURL.toString().endsWith(expectedVariationURL)){
+ TestReport r = reportError(ERROR_UNEXPECTED_VARIATION_URL);
+ r.addDescriptionEntry(ENTRY_KEY_EXPECTED_VALUE,
expectedVariationURL);
+ r.addDescriptionEntry(ENTRY_KEY_FOUND_VALUE, "" + t.variationURL);
+ return r;
+ }
+
+ if(!t.saveVariation.toURL().toString().endsWith(expectedCandidateURL)){
+ TestReport r = reportError(ERROR_UNEXPECTED_CANDIDATE_URL);
+ r.addDescriptionEntry(ENTRY_KEY_EXPECTED_VALUE,
expectedCandidateURL);
+ r.addDescriptionEntry(ENTRY_KEY_FOUND_VALUE, "" +
t.saveVariation.toURL().toString());
+ return r;
+ }
+
+ return reportSuccess();
+ }
}
1.1
xml-batik/test-sources/org/apache/batik/test/svg/ParametrizedRenderingAccuracyTest.java
Index: ParametrizedRenderingAccuracyTest.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.test.svg;
import java.io.File;
import org.apache.batik.dom.svg.SVGOMDocument;
import org.apache.batik.test.AbstractTest;
import org.w3c.dom.Document;
/**
* Base class for tests which take an additional parameter in addition
* to the SVG file.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Vincent Hardy</a>
* @version $Id: ParametrizedRenderingAccuracyTest.java,v 1.1 2001/10/16 10:38:10
vhardy Exp $
*/
public class ParametrizedRenderingAccuracyTest
extends SamplesRenderingTest {
public static final char PARAMETER_SEPARATOR = '-';
/**
* Parameter which was passed appended to the SVG file
*/
protected String parameter;
/**
* Constructor.
*/
public ParametrizedRenderingAccuracyTest(){
super();
}
public char getParameterSeparator(){
return PARAMETER_SEPARATOR;
}
public void setId(String id){
this.id = id;
String svgFile = id;
int n = svgFile.lastIndexOf(getParameterSeparator());
if(n == -1 || n+1 >= svgFile.length() ){
throw new IllegalArgumentException(id);
}
parameter = svgFile.substring(n+1, svgFile.length());
svgFile = svgFile.substring(0, n);
String[] dirNfile = breakSVGFile(svgFile);
setConfig(buildSVGURL(dirNfile[0], dirNfile[1]),
buildRefImgURL(dirNfile[0], dirNfile[1]));
setVariationURL(buildVariationURL(dirNfile[0], dirNfile[1]));
setSaveVariation(new File(buildSaveVariationFile(dirNfile[0], dirNfile[1])));
}
/**
* Gives a chance to the subclass to control the construction
* of the reference PNG file from the svgFile name
* The refImgURL is built as:
* getRefImagePrefix() + svgDir + getRefImageSuffix() + svgFile
*/
protected String buildRefImgURL(String svgDir, String svgFile){
return getRefImagePrefix() + svgDir + getRefImageSuffix() + svgFile +
parameter + PNG_EXTENSION;
}
/**
* Gives a chance to the subclass to control the construction
* of the variation URL, which is built as:
* getVariationPrefix() + svgDir + getVariationSuffix() + svgFile + parameter +
PNG_EXTENSION
*/
public String buildVariationURL(String svgDir, String svgFile){
return getVariationPrefix() + svgDir + getVariationSuffix() + svgFile +
parameter + PNG_EXTENSION;
}
/**
* Gives a chance to the subclass to control the construction
* of the saveVariation URL, which is built as:
* getSaveVariationPrefix() + svgDir + getSaveVariationSuffix() + svgFile +
parameter + PNG_EXTENSION
*/
public String buildSaveVariationFile(String svgDir, String svgFile){
return getSaveVariationPrefix() + svgDir + getSaveVariationSuffix() +
svgFile + parameter + PNG_EXTENSION;
}
}
1.1
xml-batik/test-sources/org/apache/batik/test/svg/PreconfiguredRenderingTest.java
Index: PreconfiguredRenderingTest.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.test.svg;
import java.io.File;
/**
* Convenience class for creating a SVGRenderingAccuracyTest with predefined
* rules for the various configuration parameters.
*
* @author <a href="[EMAIL PROTECTED]">Vincent Hardy</a>
* @version $Id: PreconfiguredRenderingTest.java,v 1.1 2001/10/16 10:38:10 vhardy
Exp $
*/
public abstract class PreconfiguredRenderingTest extends SVGRenderingAccuracyTest {
/**
* Generic constants
*/
public static final String PNG_EXTENSION = ".png";
public static final String SVG_EXTENSION = ".svg";
public static final char PATH_SEPARATOR = '/';
/**
* For preconfigured tests, the configuration has to be
* derived from the test identifier. The identifier should
* characterize the SVG file to be tested.
*/
public void setId(String id){
super.setId(id);
String svgFile = id;
String[] dirNfile = breakSVGFile(svgFile);
setConfig(buildSVGURL(dirNfile[0], dirNfile[1]),
buildRefImgURL(dirNfile[0], dirNfile[1]));
setVariationURL(buildVariationURL(dirNfile[0], dirNfile[1]));
setSaveVariation(new File(buildSaveVariationFile(dirNfile[0], dirNfile[1])));
}
/**
* Gives a chance to the subclass to prepend a prefix to the
* svgFile name.
* The svgURL is built as:
* getSVGURLPrefix() + svgDir + svgFile
*/
protected String buildSVGURL(String svgDir, String svgFile){
return getSVGURLPrefix() + svgDir +
svgFile + SVG_EXTENSION;
}
protected abstract String getSVGURLPrefix();
/**
* Gives a chance to the subclass to control the construction
* of the reference PNG file from the svgFile name
* The refImgURL is built as:
* getRefImagePrefix() + svgDir + getRefImageSuffix() + svgFile
*/
protected String buildRefImgURL(String svgDir, String svgFile){
return getRefImagePrefix() + svgDir + getRefImageSuffix() + svgFile +
PNG_EXTENSION;
}
protected abstract String getRefImagePrefix();
protected abstract String getRefImageSuffix();
/**
* Gives a chance to the subclass to control the construction
* of the variation URL, which is built as:
* getVariationPrefix() + svgDir + getVariationSuffix() + svgFile + PNG_EXTENSION
*/
public String buildVariationURL(String svgDir, String svgFile){
return getVariationPrefix() + svgDir + getVariationSuffix() + svgFile +
PNG_EXTENSION;
}
protected abstract String getVariationPrefix();
protected abstract String getVariationSuffix();
/**
* Gives a chance to the subclass to control the construction
* of the saveVariation URL, which is built as:
* getSaveVariationPrefix() + svgDir + getSaveVariationSuffix() + svgFile +
PNG_EXTENSION
*/
public String buildSaveVariationFile(String svgDir, String svgFile){
return getSaveVariationPrefix() + svgDir + getSaveVariationSuffix() +
svgFile + PNG_EXTENSION;
}
protected abstract String getSaveVariationPrefix();
protected abstract String getSaveVariationSuffix();
protected String[] breakSVGFile(String svgFile){
if(svgFile == null || !svgFile.endsWith(SVG_EXTENSION)){
throw new IllegalArgumentException(svgFile);
}
svgFile = svgFile.substring(0, svgFile.length() - SVG_EXTENSION.length());
int fileNameStart = svgFile.lastIndexOf(PATH_SEPARATOR);
String svgDir = "";
if(fileNameStart != -1){
if(svgFile.length() < fileNameStart + 2){
// Nothing after PATH_SEPARATOR
throw new IllegalArgumentException(svgFile);
}
svgDir = svgFile.substring(0, fileNameStart + 1);
svgFile = svgFile.substring(fileNameStart + 1);
}
return new String[]{svgDir, svgFile};
}
}
1.1
xml-batik/test-sources/org/apache/batik/test/svg/SVGReferenceRenderingAccuracyTest.java
Index: SVGReferenceRenderingAccuracyTest.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.test.svg;
import java.io.File;
import org.apache.batik.dom.svg.SVGOMDocument;
import org.apache.batik.test.AbstractTest;
import org.w3c.dom.Document;
/**
* Base class for tests which take an additional parameter in addition
* to the SVG file.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Vincent Hardy</a>
* @version $Id: SVGReferenceRenderingAccuracyTest.java,v 1.1 2001/10/16 10:38:10
vhardy Exp $
*/
public class SVGReferenceRenderingAccuracyTest
extends ParametrizedRenderingAccuracyTest {
protected String alias;
/**
* For this type of test, the id should be made as
* follows:<br />
* <fileName>#reference-alias <br />
* For example: <br />
* samples/anne.svg#svgView(viewBox(0,0,100,100))-viewBox1
*/
public void setId(String id){
this.id = id;
String svgFile = id;
int n = svgFile.lastIndexOf('#');
if(n == -1 || n+1 >= svgFile.length() ){
throw new IllegalArgumentException(id);
}
parameter = svgFile.substring(n+1, svgFile.length());
svgFile = svgFile.substring(0, n);
n = parameter.lastIndexOf('-');
if(n == -1 || n+1 >= parameter.length()){
throw new IllegalArgumentException(id);
}
alias = parameter.substring(n+1, parameter.length());
parameter = parameter.substring(0, n);
String[] dirNfile = breakSVGFile(svgFile);
setConfig(buildSVGURL(dirNfile[0], dirNfile[1]),
buildRefImgURL(dirNfile[0], dirNfile[1]));
setVariationURL(buildVariationURL(dirNfile[0], dirNfile[1]));
setSaveVariation(new File(buildSaveVariationFile(dirNfile[0], dirNfile[1])));
}
/**
* Gives a chance to the subclass to prepend a prefix to the
* svgFile name.
* The svgURL is built as:
* getSVGURLPrefix() + svgDir + svgFile + SVG_EXTENSION + "#" + parameter
*/
protected String buildSVGURL(String svgDir, String svgFile){
return getSVGURLPrefix() + svgDir +
svgFile + SVG_EXTENSION + "#" + parameter;
}
/**
* Gives a chance to the subclass to control the construction
* of the reference PNG file from the svgFile name
* The refImgURL is built as:
* getRefImagePrefix() + svgDir + getRefImageSuffix() + svgFile
*/
protected String buildRefImgURL(String svgDir, String svgFile){
return getRefImagePrefix() + svgDir + getRefImageSuffix() + svgFile + alias
+ PNG_EXTENSION;
}
/**
* Gives a chance to the subclass to control the construction
* of the variation URL, which is built as:
* getVariationPrefix() + svgDir + getVariationSuffix() + svgFile + parameter +
PNG_EXTENSION
*/
public String buildVariationURL(String svgDir, String svgFile){
return getVariationPrefix() + svgDir + getVariationSuffix() + svgFile +
alias + PNG_EXTENSION;
}
/**
* Gives a chance to the subclass to control the construction
* of the saveVariation URL, which is built as:
* getSaveVariationPrefix() + svgDir + getSaveVariationSuffix() + svgFile +
parameter + PNG_EXTENSION
*/
public String buildSaveVariationFile(String svgDir, String svgFile){
return getSaveVariationPrefix() + svgDir + getSaveVariationSuffix() +
svgFile + alias + PNG_EXTENSION;
}
}
1.1
xml-batik/test-sources/org/apache/batik/test/svg/SamplesRenderingTest.java
Index: SamplesRenderingTest.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.test.svg;
/**
* Preconfigured test for SVG files under the xml-batik directory.
*
* @author <a href="[EMAIL PROTECTED]">Vincent Hardy</a>
* @version $Id: SamplesRenderingTest.java,v 1.1 2001/10/16 10:38:10 vhardy Exp $
*/
public class SamplesRenderingTest extends PreconfiguredRenderingTest {
public static final String SVG_URL_PREFIX
= "";
public static final String REF_IMAGE_PREFIX
= "test-references/";
public static final String REF_IMAGE_SUFFIX
= "";
public static final String VARIATION_PREFIX
= "test-references/";
public static final String VARIATION_SUFFIX
= "accepted-variation/";
public static final String SAVE_VARIATION_PREFIX
= "test-references/";
public static final String SAVE_VARIATION_SUFFIX
= "candidate-variation/";
protected String getSVGURLPrefix(){
return SVG_URL_PREFIX;
}
protected String getRefImagePrefix(){
return REF_IMAGE_PREFIX;
}
protected String getRefImageSuffix(){
return REF_IMAGE_SUFFIX;
}
protected String getVariationPrefix(){
return VARIATION_PREFIX;
}
protected String getVariationSuffix(){
return VARIATION_SUFFIX;
}
protected String getSaveVariationPrefix(){
return SAVE_VARIATION_PREFIX;
}
protected String getSaveVariationSuffix(){
return SAVE_VARIATION_SUFFIX;
}
}
1.4 +30 -5 xml-batik/test-sources/org/apache/batik/test/xml/XMLReflect.java
Index: XMLReflect.java
===================================================================
RCS file:
/home/cvs/xml-batik/test-sources/org/apache/batik/test/xml/XMLReflect.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XMLReflect.java 2001/04/27 07:53:55 1.3
+++ XMLReflect.java 2001/10/16 10:38:10 1.4
@@ -23,7 +23,7 @@
* XML description.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Vincent Hardy</a>
- * @version $Id: XMLReflect.java,v 1.3 2001/04/27 07:53:55 cjolif Exp $
+ * @version $Id: XMLReflect.java,v 1.4 2001/10/16 10:38:10 vhardy Exp $
*/
public class XMLReflect implements XMLReflectConstants{
/**
@@ -32,8 +32,7 @@
public static Object buildObject(Element element) throws Exception {
String className
- = element.getAttributeNS(null,
- XR_CLASS_ATTRIBUTE);
+ = getInheritedClassAttribute(element);
Class cl = Class.forName(className);
Object[] argsArray = null;
@@ -158,8 +157,7 @@
*/
public static Object buildArgument(Element element) throws Exception {
if(!element.hasChildNodes()){
- String classAttr = element.getAttributeNS(null,
- XR_CLASS_ATTRIBUTE);
+ String classAttr = getInheritedClassAttribute(element);
// String based argument
Class cl = Class.forName(classAttr);
@@ -182,5 +180,32 @@
else{
return buildObject(element);
}
+ }
+
+ /**
+ * The class name to use is that of the element itself or, if not
+ * specified, that of its closest ancestor which defines it
+ * (through the XR_CLASS_ATTRIBUTE
+ */
+ public static String getInheritedClassAttribute(Element element){
+ if(element != null){
+ String classAttr = element.getAttributeNS(null,
+ XR_CLASS_ATTRIBUTE);
+
+ if(classAttr == null || "".equals(classAttr)){
+ Node parent = element.getParentNode();
+ if(parent != null && parent.getNodeType() == Node.ELEMENT_NODE){
+ return getInheritedClassAttribute((Element)parent);
+ }
+ else{
+ return null;
+ }
+ }
+
+ return classAttr;
+
+ }
+
+ return null;
}
}
1.4 +1 -3
xml-batik/test-sources/org/apache/batik/test/xml/XMLTestSuiteLoader.java
Index: XMLTestSuiteLoader.java
===================================================================
RCS file:
/home/cvs/xml-batik/test-sources/org/apache/batik/test/xml/XMLTestSuiteLoader.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XMLTestSuiteLoader.java 2001/10/15 11:21:44 1.3
+++ XMLTestSuiteLoader.java 2001/10/16 10:38:10 1.4
@@ -43,7 +43,7 @@
* into a <tt>TestSuite</tt> object.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Vincent Hardy</a>
- * @version $Id: XMLTestSuiteLoader.java,v 1.3 2001/10/15 11:21:44 vhardy Exp $
+ * @version $Id: XMLTestSuiteLoader.java,v 1.4 2001/10/16 10:38:10 vhardy Exp $
*/
public class XMLTestSuiteLoader implements XTSConstants {
/**
@@ -132,8 +132,6 @@
String suiteName
= element.getAttributeNS(null,
XTS_NAME_ATTRIBUTE);
-
- testSuite.setName(suiteName + " -- " + testSuite.getName());
String suiteId
= element.getAttributeNS(null,
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]