blob: 7e47563de04b448bcafa6344b2a6e2cbc4897d49 [file] [log] [blame]
This test checks SVGLength - converting from px to all other unit types
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Set value to be 2px
PASS length.unitType is SVGLength.SVG_LENGTHTYPE_PX
PASS length.value is 2
PASS length.valueInSpecifiedUnits is 2
PASS length.valueAsString is "2px"
Convert from px to unitless
PASS length.convertToSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_NUMBER) is undefined.
PASS length.valueAsString is "2"
PASS length.value is 2
PASS length.valueInSpecifiedUnits is 2
PASS length.unitType is SVGLength.SVG_LENGTHTYPE_NUMBER
Reset to 2px
Try converting from px to percentage, should fail as the SVGLength is not associated with a SVGSVGElement, and thus no viewport information is available
PASS length.convertToSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PERCENTAGE) threw exception NotSupportedError: The operation is not supported..
PASS length.valueAsString is "2px"
PASS length.value is 2
PASS length.valueInSpecifiedUnits is 2
PASS length.unitType is SVGLength.SVG_LENGTHTYPE_PX
Reset to 2px
Try converting from px to ems, should fail as the SVGLength is not associated with a SVGSVGElement, and thus no font-size information is available
PASS length.convertToSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_EMS) threw exception NotSupportedError: The operation is not supported..
PASS length.valueAsString is "2px"
PASS length.value is 2
PASS length.valueInSpecifiedUnits is 2
PASS length.unitType is SVGLength.SVG_LENGTHTYPE_PX
Reset to 2px
Try converting from px to exs, should fail as the SVGLength is not associated with a SVGSVGElement, and thus no font-size information is available
PASS length.convertToSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_EXS) threw exception NotSupportedError: The operation is not supported..
PASS length.valueAsString is "2px"
PASS length.value is 2
PASS length.valueInSpecifiedUnits is 2
PASS length.unitType is SVGLength.SVG_LENGTHTYPE_PX
Reset to 2px
Convert from px to cm
PASS length.convertToSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_CM) is undefined.
PASS length.valueAsString.slice(-2) is "cm"
PASS length.valueInSpecifiedUnits.toFixed(7) is "0.0529167"
PASS length.value.toFixed(1) is "2.0"
PASS length.unitType is SVGLength.SVG_LENGTHTYPE_CM
Reset to 2px
Convert from px to mm
PASS length.convertToSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_MM) is undefined.
PASS length.valueAsString.slice(-2) is "mm"
PASS length.valueInSpecifiedUnits.toFixed(6) is "0.529167"
PASS length.value.toFixed(1) is "2.0"
PASS length.unitType is SVGLength.SVG_LENGTHTYPE_MM
Reset to 2px
Convert from px to in
PASS length.convertToSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_IN) is undefined.
PASS length.valueAsString.slice(-2) is "in"
PASS length.valueInSpecifiedUnits.toFixed(7) is "0.0208333"
PASS length.value.toFixed(1) is "2.0"
PASS length.unitType is SVGLength.SVG_LENGTHTYPE_IN
Reset to 2px
Convert from px to pt
PASS length.convertToSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PT) is undefined.
PASS length.valueAsString is "1.5pt"
PASS length.valueInSpecifiedUnits is 1.5
PASS length.value.toFixed(1) is "2.0"
PASS length.unitType is SVGLength.SVG_LENGTHTYPE_PT
Reset to 2px
Convert from px to pc
PASS length.convertToSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PC) is undefined.
PASS length.valueInSpecifiedUnits.toFixed(3) is "0.125"
PASS length.value.toFixed(1) is "2.0"
PASS length.unitType is SVGLength.SVG_LENGTHTYPE_PC
PASS successfullyParsed is true
TEST COMPLETE