blob: bceaffed11b9b1ef9c8944fe3bc1fc416f37086e [file] [log] [blame]
This test checks the SVGColor API
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Check initial color values
PASS (stopColor = stopElement.style.getPropertyCSSValue('stop-color')).toString() is "[object SVGColor]"
PASS stopColor.colorType is SVGColor.SVG_COLORTYPE_RGBCOLOR
PASS (rgbColor = stopColor.rgbColor).toString() is "[object RGBColor]"
PASS rgbColor.red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 255
PASS rgbColor.green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
PASS rgbColor.blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
PASS stopElement.style.stopColor is "#ff0000"
PASS document.defaultView.getComputedStyle(stopElement).stopColor is "rgb(255, 0, 0)"
Try invalid arguments for setColor()
PASS stopColor.setColor(null, null, null) threw exception NoModificationAllowedError: An attempt was made to modify an object where modifications are not allowed..
PASS stopColor.setColor(SVGColor.SVG_COLORTYPE_RGBCOLOR, svgElement, ''); threw exception NoModificationAllowedError: An attempt was made to modify an object where modifications are not allowed..
PASS stopColor.setColor(SVGColor.SVG_COLORTYPE_RGBCOLOR, '', '') threw exception NoModificationAllowedError: An attempt was made to modify an object where modifications are not allowed..
PASS stopColor.setColor(SVGColor.SVG_COLORTYPE_CURRENTCOLOR + 1, '', ''); threw exception NoModificationAllowedError: An attempt was made to modify an object where modifications are not allowed..
PASS stopColor.setColor() threw exception TypeError: Not enough arguments.
PASS stopColor.setColor(stopColor) threw exception TypeError: Not enough arguments.
Try assigning to the readonly colorType property, which silently fails
PASS stopColor.colorType = SVGColor.SVG_COLORTYPE_UNKKNOWN; is undefined.
PASS stopColor.colorType is SVGColor.SVG_COLORTYPE_RGBCOLOR
PASS stopElement.style.stopColor is "#ff0000"
PASS document.defaultView.getComputedStyle(stopElement).stopColor is "rgb(255, 0, 0)"
Test using setColor() and SVG_COLORTYPE_UNKNOWN
PASS stopColor.setColor(SVGColor.SVG_COLORTYPE_UNKKNOWN, '', '') threw exception NoModificationAllowedError: An attempt was made to modify an object where modifications are not allowed..
PASS stopColor.setColor(SVGColor.SVG_COLORTYPE_UNKKNOWN, 'rgb(0,128,128)', '') threw exception NoModificationAllowedError: An attempt was made to modify an object where modifications are not allowed..
PASS stopColor.setColor(SVGColor.SVG_COLORTYPE_UNKKNOWN, '', 'icc-color(myRGB, 0, 1, 2)') threw exception NoModificationAllowedError: An attempt was made to modify an object where modifications are not allowed..
PASS stopColor.setColor(SVGColor.SVG_COLORTYPE_UNKKNOWN, 'rgb(0,0,0)', 'icc-color(myRGB, 0, 1, 2)') threw exception NoModificationAllowedError: An attempt was made to modify an object where modifications are not allowed..
Test using setColor() and SVG_COLORTYPE_RGBCOLOR_ICCCOLOR
PASS stopColor.setColor(SVGColor.SVG_COLORTYPE_RGBCOLOR_ICCCOLOR, 'rgb(77,0,77)', 'icc-color(myRGB, 0, 1, 2)') threw exception NoModificationAllowedError: An attempt was made to modify an object where modifications are not allowed..
PASS stopColor.colorType is SVGColor.SVG_COLORTYPE_RGBCOLOR
PASS stopColor.colorType is SVGColor.SVG_COLORTYPE_RGBCOLOR
PASS (rgbColor = stopColor.rgbColor).toString() is "[object RGBColor]"
PASS rgbColor.red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 255
PASS rgbColor.green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
PASS rgbColor.blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
PASS stopElement.style.stopColor is "#ff0000"
PASS document.defaultView.getComputedStyle(stopElement).stopColor is "rgb(255, 0, 0)"
Test using setColor() and SVG_COLORTYPE_CURRENTCOLOR
PASS stopColor.setColor(SVGColor.SVG_COLORTYPE_CURRENTCOLOR, 'rgb(77,0,77)', 'icc-color(myRGB, 0, 1, 2)') threw exception NoModificationAllowedError: An attempt was made to modify an object where modifications are not allowed..
PASS stopColor.colorType is SVGColor.SVG_COLORTYPE_RGBCOLOR
PASS stopColor.colorType is SVGColor.SVG_COLORTYPE_RGBCOLOR
PASS (rgbColor = stopColor.rgbColor).toString() is "[object RGBColor]"
PASS rgbColor.red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 255
PASS rgbColor.green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
PASS rgbColor.blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
PASS stopElement.style.stopColor is "#ff0000"
PASS document.defaultView.getComputedStyle(stopElement).stopColor is "rgb(255, 0, 0)"
Test using setColor() and SVG_COLORTYPE_RGBCOLOR
PASS stopColor.setColor(SVGColor.SVG_COLORTYPE_RGBCOLOR, 'rgb(0,77,0)', 'icc-color(myRGB, 0, 1, 2)') threw exception NoModificationAllowedError: An attempt was made to modify an object where modifications are not allowed..
PASS stopColor.colorType is SVGColor.SVG_COLORTYPE_RGBCOLOR
PASS stopColor.colorType is SVGColor.SVG_COLORTYPE_RGBCOLOR
PASS (rgbColor = stopColor.rgbColor).toString() is "[object RGBColor]"
PASS rgbColor.red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 255
PASS rgbColor.green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
PASS rgbColor.blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
PASS document.defaultView.getComputedStyle(stopElement).stopColor is "rgb(255, 0, 0)"
PASS successfullyParsed is true
TEST COMPLETE