hillion 02/04/11 09:51:36 Modified: sources/org/apache/batik/css/dom CSSOMSVGColor.java CSSOMStyleDeclaration.java sources/org/apache/batik/script Window.java sources/org/apache/batik/script/rhino WindowWrapper.java test-resources/org/apache/batik/css/dom rgbTest.svg unitTesting.xml Added: test-resources/org/apache/batik/css/dom rgbPresentationTest.svg rgbUpdateTest.svg Log: tests committed. Revision Changes Path 1.2 +4 -4 xml-batik/sources/org/apache/batik/css/dom/CSSOMSVGColor.java Index: CSSOMSVGColor.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/css/dom/CSSOMSVGColor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- CSSOMSVGColor.java 9 Apr 2002 16:27:17 -0000 1.1 +++ CSSOMSVGColor.java 11 Apr 2002 16:51:35 -0000 1.2 @@ -32,7 +32,7 @@ * This class implements the {@link SVGColor} interface. * * @author <a href="mailto:[EMAIL PROTECTED]">Stephane Hillion</a> - * @version $Id: CSSOMSVGColor.java,v 1.1 2002/04/09 16:27:17 hillion Exp $ + * @version $Id: CSSOMSVGColor.java,v 1.2 2002/04/11 16:51:35 hillion Exp $ */ public class CSSOMSVGColor implements SVGColor, @@ -93,7 +93,7 @@ /** * <b>DOM</b>: Implements {@link - * org.w3c.dom.css.CSSValue#setCssText(String)}. + * org.w3c.dom.svg.CSSValue#setCssText(String)}. */ public void setCssText(String cssText) throws DOMException { if (handler == null) { @@ -107,7 +107,7 @@ /** * <b>DOM</b>: Implements {@link - * org.w3c.dom.css.CSSValue#getCssValueType()}. + * org.w3c.dom.svg.CSSValue#getCssValueType()}. */ public short getCssValueType() { return CSS_CUSTOM; @@ -158,7 +158,7 @@ /** * <b>DOM</b>: Implements {@link - * org.w3c.dom.css.SVGColor#getICCColor()}. + * org.w3c.dom.svg.SVGColor#getICCColor()}. */ public SVGICCColor getICCColor() { return this; 1.4 +2 -2 xml-batik/sources/org/apache/batik/css/dom/CSSOMStyleDeclaration.java Index: CSSOMStyleDeclaration.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/css/dom/CSSOMStyleDeclaration.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- CSSOMStyleDeclaration.java 10 Apr 2002 09:29:07 -0000 1.3 +++ CSSOMStyleDeclaration.java 11 Apr 2002 16:51:35 -0000 1.4 @@ -24,7 +24,7 @@ * This class represents a style declaration. * * @author <a href="mailto:[EMAIL PROTECTED]">Stephane Hillion</a> - * @version $Id: CSSOMStyleDeclaration.java,v 1.3 2002/04/10 09:29:07 hillion Exp $ + * @version $Id: CSSOMStyleDeclaration.java,v 1.4 2002/04/11 16:51:35 hillion Exp $ */ public class CSSOMStyleDeclaration implements CSSStyleDeclaration { @@ -258,7 +258,7 @@ /** * This class represents a CSS value returned by this declaration. */ - protected class StyleDeclarationValue + public class StyleDeclarationValue extends CSSOMValue implements CSSOMValue.ValueProvider { 1.4 +1 -1 xml-batik/sources/org/apache/batik/script/Window.java Index: Window.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/script/Window.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Window.java 10 Apr 2002 16:19:03 -0000 1.3 +++ Window.java 11 Apr 2002 16:51:36 -0000 1.4 @@ -18,7 +18,7 @@ * environment of a SVG document. * * @author <a href="mailto:[EMAIL PROTECTED]">Stephane Hillion</a> - * @version $Id: Window.java,v 1.3 2002/04/10 16:19:03 hillion Exp $ + * @version $Id: Window.java,v 1.4 2002/04/11 16:51:36 hillion Exp $ */ public interface Window { @@ -93,7 +93,7 @@ public interface GetURLHandler { /** - * Called when 'getURL()' returns. + * Called before 'getURL()' returns. * @param success Whether the data was successfully retreived. * @param mime The data MIME type. * @param content The data. 1.7 +1 -2 xml-batik/sources/org/apache/batik/script/rhino/WindowWrapper.java Index: WindowWrapper.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/script/rhino/WindowWrapper.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- WindowWrapper.java 10 Apr 2002 16:19:03 -0000 1.6 +++ WindowWrapper.java 11 Apr 2002 16:51:36 -0000 1.7 @@ -15,7 +15,6 @@ import org.mozilla.javascript.Function; import org.mozilla.javascript.FunctionObject; import org.mozilla.javascript.JavaScriptException; -import org.mozilla.javascript.NativeBoolean; import org.mozilla.javascript.NativeJavaObject; import org.mozilla.javascript.Scriptable; import org.mozilla.javascript.ScriptableObject; @@ -33,7 +32,7 @@ * This class wraps a Window object to expose it to the interpreter. * * @author <a href="mailto:[EMAIL PROTECTED]">Stephane Hillion</a> - * @version $Id: WindowWrapper.java,v 1.6 2002/04/10 16:19:03 hillion Exp $ + * @version $Id: WindowWrapper.java,v 1.7 2002/04/11 16:51:36 hillion Exp $ */ public class WindowWrapper extends ScriptableObject { 1.2 +9 -7 xml-batik/test-resources/org/apache/batik/css/dom/rgbTest.svg Index: rgbTest.svg =================================================================== RCS file: /home/cvs/xml-batik/test-resources/org/apache/batik/css/dom/rgbTest.svg,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- rgbTest.svg 11 Apr 2002 08:07:24 -0000 1.1 +++ rgbTest.svg 11 Apr 2002 16:51:36 -0000 1.2 @@ -16,7 +16,7 @@ <!-- --> <!-- @author [EMAIL PROTECTED] --> <!-- @author [EMAIL PROTECTED] --> -<!-- @version $Id: rgbTest.svg,v 1.1 2002/04/11 08:07:24 vhardy Exp $ --> +<!-- @version $Id: rgbTest.svg,v 1.2 2002/04/11 16:51:36 hillion Exp $ --> <!-- ========================================================================= --> <svg xmlns="http://www.w3.org/2000/svg" @@ -59,7 +59,9 @@ return; } - if (val.red != 1){ + val = val.getRGBColor() + + if (val.red.cssText != "1"){ result.setAttributeNS(null, "errorCode", "invalid red component"); var entry = document.createElementNS(testNS, "errorDescriptionEntry"); entry.setAttributeNS(null, "id", "expected.red"); @@ -72,11 +74,11 @@ return; } - if (val.green != 1){ + if (val.green.cssText != "2"){ result.setAttributeNS(null, "errorCode", "invalid green component"); var entry = document.createElementNS(testNS, "errorDescriptionEntry"); entry.setAttributeNS(null, "id", "expected.green"); - entry.setAttributeNS(null, "value", "1"); + entry.setAttributeNS(null, "value", "2"); result.appendChild(entry); entry = document.createElementNS(testNS, "errorDescriptionEntry"); entry.setAttributeNS(null, "id", "found.green"); @@ -85,11 +87,11 @@ return; } - if (val.blue != 1){ + if (val.blue.cssText != "3"){ result.setAttributeNS(null, "errorCode", "invalid blue component"); var entry = document.createElementNS(testNS, "errorDescriptionEntry"); entry.setAttributeNS(null, "id", "expected.blue"); - entry.setAttributeNS(null, "value", "1"); + entry.setAttributeNS(null, "value", "3"); result.appendChild(entry); entry = document.createElementNS(testNS, "errorDescriptionEntry"); entry.setAttributeNS(null, "id", "found.blue"); @@ -104,7 +106,7 @@ <g fill="blue"> <rect x="10%" y="10%" width="80%" height="80%" - style="opacity:0.5; fill: rgb(1,2,3)" id="targetElement" onclick="f()"/> + style="opacity:0.5; fill: rgb(1,2,3)" id="targetElement"/> </g> </svg> 1.2 +4 -2 xml-batik/test-resources/org/apache/batik/css/dom/unitTesting.xml Index: unitTesting.xml =================================================================== RCS file: /home/cvs/xml-batik/test-resources/org/apache/batik/css/dom/unitTesting.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- unitTesting.xml 11 Apr 2002 08:07:24 -0000 1.1 +++ unitTesting.xml 11 Apr 2002 16:51:36 -0000 1.2 @@ -8,13 +8,15 @@ <!-- ========================================================================= --> <!-- @author [EMAIL PROTECTED] --> -<!-- @version $Id: unitTesting.xml,v 1.1 2002/04/11 08:07:24 vhardy Exp $ --> +<!-- @version $Id: unitTesting.xml,v 1.2 2002/04/11 16:51:36 hillion Exp $ --> <!-- ========================================================================= --> <testSuite id="css.dom.unitTesting" name="CSS DOM - Unit Testing" class="org.apache.batik.css.dom.EcmaScriptCSSDOMTest"> <testGroup id="basic" name="Basic CSS DOM Testing"> <test id="rgbTest" /> + <test id="rgbUpdateTest" /> + <test id="rgbPresentationTest" /> </testGroup> -</testSuite> \ No newline at end of file +</testSuite> 1.1 xml-batik/test-resources/org/apache/batik/css/dom/rgbPresentationTest.svg Index: rgbPresentationTest.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] --> <!-- @author [EMAIL PROTECTED] --> <!-- @version $Id: rgbPresentationTest.svg,v 1.1 2002/04/11 16:51:36 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") var elt = document.getElementById("targetElement") result.setAttributeNS(null, "result", "failed") if (elt == 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", "targetElement") result.appendChild(entry) return } var val = elt.getPresentationAttribute("fill") if (val == null) { result.setAttributeNS(null, "errorCode", "CSSStyleDeclaration.getPropertyCSSValue returned null") return } var rgb = val.getRGBColor() if (rgb.red.cssText != "1"){ result.setAttributeNS(null, "errorCode", "invalid red component"); var entry = document.createElementNS(testNS, "errorDescriptionEntry"); entry.setAttributeNS(null, "id", "expected.red"); entry.setAttributeNS(null, "value", "1"); result.appendChild(entry); entry = document.createElementNS(testNS, "errorDescriptionEntry"); entry.setAttributeNS(null, "id", "found.red"); entry.setAttributeNS(null, "value", "" + rgb.red); result.appendChild(entry); return; } if (rgb.green.cssText != "2"){ result.setAttributeNS(null, "errorCode", "invalid green component"); var entry = document.createElementNS(testNS, "errorDescriptionEntry"); entry.setAttributeNS(null, "id", "expected.green"); entry.setAttributeNS(null, "value", "2"); result.appendChild(entry); entry = document.createElementNS(testNS, "errorDescriptionEntry"); entry.setAttributeNS(null, "id", "found.green"); entry.setAttributeNS(null, "value", "" + rgb.green); result.appendChild(entry); return; } if (rgb.blue.cssText != "3"){ result.setAttributeNS(null, "errorCode", "invalid blue component"); var entry = document.createElementNS(testNS, "errorDescriptionEntry"); entry.setAttributeNS(null, "id", "expected.blue"); entry.setAttributeNS(null, "value", "3"); result.appendChild(entry); entry = document.createElementNS(testNS, "errorDescriptionEntry"); entry.setAttributeNS(null, "id", "found.blue"); entry.setAttributeNS(null, "value", "" + rgb.blue); result.appendChild(entry); return; } elt.setAttributeNS(null, "fill", "#030201") if (rgb.red.cssText != "3"){ result.setAttributeNS(null, "errorCode", "invalid red component"); var entry = document.createElementNS(testNS, "errorDescriptionEntry"); entry.setAttributeNS(null, "id", "expected.red"); entry.setAttributeNS(null, "value", "1"); result.appendChild(entry); entry = document.createElementNS(testNS, "errorDescriptionEntry"); entry.setAttributeNS(null, "id", "found.red"); entry.setAttributeNS(null, "value", "" + rgb.red); result.appendChild(entry); return; } if (rgb.green.cssText != "2"){ result.setAttributeNS(null, "errorCode", "invalid green component"); var entry = document.createElementNS(testNS, "errorDescriptionEntry"); entry.setAttributeNS(null, "id", "expected.green"); entry.setAttributeNS(null, "value", "2"); result.appendChild(entry); entry = document.createElementNS(testNS, "errorDescriptionEntry"); entry.setAttributeNS(null, "id", "found.green"); entry.setAttributeNS(null, "value", "" + rgb.green); result.appendChild(entry); return; } if (rgb.blue.cssText != "1"){ result.setAttributeNS(null, "errorCode", "invalid blue component"); var entry = document.createElementNS(testNS, "errorDescriptionEntry"); entry.setAttributeNS(null, "id", "expected.blue"); entry.setAttributeNS(null, "value", "3"); result.appendChild(entry); entry = document.createElementNS(testNS, "errorDescriptionEntry"); entry.setAttributeNS(null, "id", "found.blue"); entry.setAttributeNS(null, "value", "" + rgb.blue); result.appendChild(entry); return; } result.setAttributeNS(null, "result", "passed"); } ]]></script> <g fill="blue"> <rect x="10%" y="10%" width="80%" height="80%" fill="rgb(1,2,3)" id="targetElement"/> </g> </svg> 1.1 xml-batik/test-resources/org/apache/batik/css/dom/rgbUpdateTest.svg Index: rgbUpdateTest.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] --> <!-- @author [EMAIL PROTECTED] --> <!-- @version $Id: rgbUpdateTest.svg,v 1.1 2002/04/11 16:51:36 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") var elt = document.getElementById("targetElement") result.setAttributeNS(null, "result", "failed") if (elt == 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", "targetElement") result.appendChild(entry) return } var decl = elt.getStyle() if (decl == null){ result.setAttributeNS(null, "errorCode", "getStyle() returned null") return } var val = decl.getPropertyCSSValue("fill") if (val == null) { result.setAttributeNS(null, "errorCode", "CSSStyleDeclaration.getPropertyCSSValue returned null") return } val = val.getRGBColor() val.red.cssText = 4 if (val.red.cssText != "4"){ result.setAttributeNS(null, "errorCode", "invalid red component") var entry = document.createElementNS(testNS, "errorDescriptionEntry") entry.setAttributeNS(null, "id", "expected.red") entry.setAttributeNS(null, "value", "4") result.appendChild(entry) entry = document.createElementNS(testNS, "errorDescriptionEntry") entry.setAttributeNS(null, "id", "found.red") entry.setAttributeNS(null, "value", "" + val.red) result.appendChild(entry) return } val = decl.getPropertyCSSValue("fill") val.cssText = "#050607" if (val.red.cssText != "5"){ result.setAttributeNS(null, "errorCode", "invalid red component") var entry = document.createElementNS(testNS, "errorDescriptionEntry") entry.setAttributeNS(null, "id", "expected.red") entry.setAttributeNS(null, "value", "5") result.appendChild(entry) entry = document.createElementNS(testNS, "errorDescriptionEntry") entry.setAttributeNS(null, "id", "found.red") entry.setAttributeNS(null, "value", "" + val.red) result.appendChild(entry) return } if (val.green.cssText != "6"){ result.setAttributeNS(null, "errorCode", "invalid green component"); var entry = document.createElementNS(testNS, "errorDescriptionEntry"); entry.setAttributeNS(null, "id", "expected.green"); entry.setAttributeNS(null, "value", "6"); result.appendChild(entry); entry = document.createElementNS(testNS, "errorDescriptionEntry"); entry.setAttributeNS(null, "id", "found.green"); entry.setAttributeNS(null, "value", "" + val.green); result.appendChild(entry); return; } if (val.blue.cssText != "7"){ result.setAttributeNS(null, "errorCode", "invalid blue component"); var entry = document.createElementNS(testNS, "errorDescriptionEntry"); entry.setAttributeNS(null, "id", "expected.blue"); entry.setAttributeNS(null, "value", "7"); result.appendChild(entry); entry = document.createElementNS(testNS, "errorDescriptionEntry"); entry.setAttributeNS(null, "id", "found.blue"); entry.setAttributeNS(null, "value", "" + val.blue); result.appendChild(entry); return; } result.setAttributeNS(null, "result", "passed"); } ]]></script> <g fill="blue"> <rect x="10%" y="10%" width="80%" height="80%" style="opacity:0.5; fill: rgb(1,2,3)" id="targetElement"/> </g> </svg>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]