blob: bfe48581fa1ffddd857c5dbe09eb5986341086bc [file] [log] [blame]
This test checks the use of SVGAnimatedEnumeration within SVGMarkerElement
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Check initial 'markerUnits' value
PASS markerElement.markerUnits.toString() is "[object SVGAnimatedEnumeration]"
PASS typeof(markerElement.markerUnits.baseVal) is "number"
PASS markerElement.markerUnits.baseVal is SVGMarkerElement.SVG_MARKERUNITS_USERSPACEONUSE
Switch to 'strokeWidth'
PASS markerElement.markerUnits.baseVal = SVGMarkerElement.SVG_MARKERUNITS_STROKEWIDTH is SVGMarkerElement.SVG_MARKERUNITS_STROKEWIDTH
PASS markerElement.markerUnits.baseVal is SVGMarkerElement.SVG_MARKERUNITS_STROKEWIDTH
PASS markerElement.getAttribute('markerUnits') is "strokeWidth"
Try setting invalid values
PASS markerElement.markerUnits.baseVal = 3 threw exception TypeError: Type error.
PASS markerElement.markerUnits.baseVal is SVGMarkerElement.SVG_MARKERUNITS_STROKEWIDTH
PASS markerElement.getAttribute('markerUnits') is "strokeWidth"
PASS markerElement.markerUnits.baseVal = -1 threw exception TypeError: Type error.
PASS markerElement.markerUnits.baseVal is SVGMarkerElement.SVG_MARKERUNITS_STROKEWIDTH
PASS markerElement.getAttribute('markerUnits') is "strokeWidth"
PASS markerElement.markerUnits.baseVal = 0 threw exception TypeError: Type error.
PASS markerElement.markerUnits.baseVal is SVGMarkerElement.SVG_MARKERUNITS_STROKEWIDTH
PASS markerElement.getAttribute('markerUnits') is "strokeWidth"
Switch to 'userSpaceOnUse'
PASS markerElement.markerUnits.baseVal = SVGMarkerElement.SVG_MARKERUNITS_USERSPACEONUSE is SVGMarkerElement.SVG_MARKERUNITS_USERSPACEONUSE
PASS markerElement.markerUnits.baseVal is SVGMarkerElement.SVG_MARKERUNITS_USERSPACEONUSE
PASS markerElement.getAttribute('markerUnits') is "userSpaceOnUse"
Check initial 'orient' value
PASS markerElement.orientType.toString() is "[object SVGAnimatedEnumeration]"
PASS typeof(markerElement.orientType.baseVal) is "number"
PASS markerElement.orientAngle.baseVal.value is 0
PASS markerElement.orientAngle.baseVal.unitType is SVGAngle.SVG_ANGLETYPE_UNSPECIFIED
PASS markerElement.orientType.baseVal is SVGMarkerElement.SVG_MARKER_ORIENT_AUTO
Switch to 'auto-start-reverse' value - by modifying the orient attribute.
PASS markerElement.setAttribute('orient', 'auto-start-reverse') did not throw exception.
PASS markerElement.orientAngle.baseVal.value is 0
PASS markerElement.orientAngle.baseVal.unitType is SVGAngle.SVG_ANGLETYPE_UNSPECIFIED
PASS markerElement.orientType.baseVal is SVGMarkerElement.SVG_MARKER_ORIENT_UNKNOWN
PASS markerElement.getAttribute('orient') is "auto-start-reverse"
Switch to 'Pi/2 rad' value - via setOrientToAngle()
PASS anglePiHalfRad = svgElement.createSVGAngle(); anglePiHalfRad.newValueSpecifiedUnits(SVGAngle.SVG_ANGLETYPE_RAD, (Math.PI / 2).toFixed(2)) is undefined.
PASS markerElement.setOrientToAngle(anglePiHalfRad) is undefined.
PASS markerElement.orientAngle.baseVal.value.toFixed(1) is "90.0"
PASS markerElement.orientAngle.baseVal.unitType is SVGAngle.SVG_ANGLETYPE_RAD
PASS markerElement.orientType.baseVal is SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE
PASS markerElement.getAttribute('orient') is "1.57rad"
Switch to 'auto' value - via setOrientToAuto()
PASS markerElement.setOrientToAuto() is undefined.
PASS markerElement.orientAngle.baseVal.value is 0
PASS markerElement.orientAngle.baseVal.unitType is SVGAngle.SVG_ANGLETYPE_UNSPECIFIED
PASS markerElement.orientType.baseVal is SVGMarkerElement.SVG_MARKER_ORIENT_AUTO
PASS markerElement.getAttribute('orient') is "auto"
Switch to '20deg' value - via setOrientToAngle()
PASS angle20deg = svgElement.createSVGAngle(); angle20deg.newValueSpecifiedUnits(SVGAngle.SVG_ANGLETYPE_DEG, 20) is undefined.
PASS markerElement.setOrientToAngle(angle20deg) is undefined.
PASS markerElement.orientAngle.baseVal.value is 20
PASS markerElement.orientAngle.baseVal.unitType is SVGAngle.SVG_ANGLETYPE_DEG
PASS markerElement.orientType.baseVal is SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE
PASS markerElement.getAttribute('orient') is "20deg"
Switch to '10deg' value
PASS markerElement.orientAngle.baseVal.value = 10 is 10
PASS markerElement.orientAngle.baseVal.value is 10
PASS markerElement.orientAngle.baseVal.unitType is SVGAngle.SVG_ANGLETYPE_DEG
PASS markerElement.orientType.baseVal is SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE
PASS markerElement.getAttribute('orient') is "10deg"
Switch to 'auto' value - by modifying orientType, this shouldn't change the orientAngle, but change the 'orient' attribute
PASS markerElement.orientType.baseVal = SVGMarkerElement.SVG_MARKER_ORIENT_AUTO is SVGMarkerElement.SVG_MARKER_ORIENT_AUTO
PASS markerElement.orientAngle.baseVal.value is 10
PASS markerElement.orientAngle.baseVal.unitType is SVGAngle.SVG_ANGLETYPE_DEG
PASS markerElement.orientType.baseVal is SVGMarkerElement.SVG_MARKER_ORIENT_AUTO
PASS markerElement.getAttribute('orient') is "auto"
Switch to '10deg' value - by modifying orientType to be angle again, the 10deg should be preserved in the orientAngle, and the 'orient' attribute should change
PASS markerElement.orientType.baseVal = SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE is SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE
PASS markerElement.orientAngle.baseVal.value is 10
PASS markerElement.orientAngle.baseVal.unitType is SVGAngle.SVG_ANGLETYPE_DEG
PASS markerElement.orientType.baseVal is SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE
PASS markerElement.getAttribute('orient') is "10deg"
Try setting invalid values
PASS markerElement.orientType.baseVal = 3 threw exception TypeError: Type error.
PASS markerElement.orientType.baseVal is SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE
PASS markerElement.getAttribute('orient') is "10deg"
PASS markerElement.orientType.baseVal = -1 threw exception TypeError: Type error.
PASS markerElement.orientType.baseVal is SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE
PASS markerElement.getAttribute('orient') is "10deg"
PASS markerElement.orientType.baseVal = 0 threw exception TypeError: Type error.
PASS markerElement.orientType.baseVal is SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE
PASS markerElement.getAttribute('orient') is "10deg"
Test case sensitivity of attributes - try setting invalid values
PASS markerElement.setAttribute('orient', 'AUTO-START-REVERSE') did not throw exception.
PASS markerElement.getAttribute('orient') is "AUTO-START-REVERSE"
PASS markerElement.orientType.baseVal is SVGMarkerElement.SVG_MARKER_ORIENT_UNKNOWN
PASS markerElement.setAttribute('orient', 'AUTO') did not throw exception.
PASS markerElement.getAttribute('orient') is "AUTO"
PASS markerElement.orientType.baseVal is SVGMarkerElement.SVG_MARKER_ORIENT_UNKNOWN
Switch back to 'auto' value
PASS markerElement.orientType.baseVal = SVGMarkerElement.SVG_MARKER_ORIENT_AUTO is SVGMarkerElement.SVG_MARKER_ORIENT_AUTO
PASS markerElement.orientAngle.baseVal.value is 0
PASS markerElement.orientAngle.baseVal.unitType is SVGAngle.SVG_ANGLETYPE_UNSPECIFIED
PASS markerElement.orientType.baseVal is SVGMarkerElement.SVG_MARKER_ORIENT_AUTO
PASS markerElement.getAttribute('orient') is "auto"
Switch to '100grad' value - only touch orientAngle, shouldn't change orientType nor the 'orient' attribute
PASS markerElement.orientAngle.baseVal.newValueSpecifiedUnits(SVGAngle.SVG_ANGLETYPE_GRAD, 100) is undefined.
PASS markerElement.orientAngle.baseVal.value is 90
PASS markerElement.orientAngle.baseVal.unitType is SVGAngle.SVG_ANGLETYPE_GRAD
PASS markerElement.orientType.baseVal is SVGMarkerElement.SVG_MARKER_ORIENT_AUTO
PASS markerElement.getAttribute('orient') is "auto"
Finish switching to '100grad' value - by modifying the orientType to angle
PASS markerElement.orientType.baseVal = SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE is SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE
PASS markerElement.orientAngle.baseVal.value is 90
PASS markerElement.orientAngle.baseVal.unitType is SVGAngle.SVG_ANGLETYPE_GRAD
PASS markerElement.orientType.baseVal is SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE
PASS markerElement.getAttribute('orient') is "100grad"
PASS successfullyParsed is true
TEST COMPLETE