OLD | NEW |
| (Empty) |
1 This test checks SVGLength - converting from px to all other unit types | |
2 | |
3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
". | |
4 | |
5 | |
6 | |
7 Set value to be 2px | |
8 PASS length.unitType is SVGLength.SVG_LENGTHTYPE_PX | |
9 PASS length.value is 2 | |
10 PASS length.valueInSpecifiedUnits is 2 | |
11 PASS length.valueAsString is "2px" | |
12 | |
13 Convert from px to unitless | |
14 PASS length.convertToSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_NUMBER) is undefine
d. | |
15 PASS length.valueAsString is "2" | |
16 PASS length.value is 2 | |
17 PASS length.valueInSpecifiedUnits is 2 | |
18 PASS length.unitType is SVGLength.SVG_LENGTHTYPE_NUMBER | |
19 | |
20 Reset to 2px | |
21 | |
22 Try converting from px to percentage, should fail as the SVGLength is not associ
ated with a SVGSVGElement, and thus no viewport information is available | |
23 PASS length.convertToSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PERCENTAGE) threw e
xception NotSupportedError: Failed to execute 'convertToSpecifiedUnits' on 'SVGL
ength': Could not resolve relative length.. | |
24 PASS length.valueAsString is "2px" | |
25 PASS length.value is 2 | |
26 PASS length.valueInSpecifiedUnits is 2 | |
27 PASS length.unitType is SVGLength.SVG_LENGTHTYPE_PX | |
28 | |
29 Reset to 2px | |
30 | |
31 Try converting from px to ems, should fail as the SVGLength is not associated wi
th a SVGSVGElement, and thus no font-size information is available | |
32 PASS length.convertToSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_EMS) threw exceptio
n NotSupportedError: Failed to execute 'convertToSpecifiedUnits' on 'SVGLength':
Could not resolve relative length.. | |
33 PASS length.valueAsString is "2px" | |
34 PASS length.value is 2 | |
35 PASS length.valueInSpecifiedUnits is 2 | |
36 PASS length.unitType is SVGLength.SVG_LENGTHTYPE_PX | |
37 | |
38 Reset to 2px | |
39 | |
40 Try converting from px to exs, should fail as the SVGLength is not associated wi
th a SVGSVGElement, and thus no font-size information is available | |
41 PASS length.convertToSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_EXS) threw exceptio
n NotSupportedError: Failed to execute 'convertToSpecifiedUnits' on 'SVGLength':
Could not resolve relative length.. | |
42 PASS length.valueAsString is "2px" | |
43 PASS length.value is 2 | |
44 PASS length.valueInSpecifiedUnits is 2 | |
45 PASS length.unitType is SVGLength.SVG_LENGTHTYPE_PX | |
46 | |
47 Reset to 2px | |
48 | |
49 Convert from px to cm | |
50 PASS length.convertToSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_CM) is undefined. | |
51 PASS length.valueAsString is "0.0529167cm" | |
52 PASS length.valueInSpecifiedUnits.toFixed(7) is "0.0529167" | |
53 PASS length.value.toFixed(1) is "2.0" | |
54 PASS length.unitType is SVGLength.SVG_LENGTHTYPE_CM | |
55 | |
56 Reset to 2px | |
57 | |
58 Convert from px to mm | |
59 PASS length.convertToSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_MM) is undefined. | |
60 PASS length.valueAsString is "0.529167mm" | |
61 PASS length.valueInSpecifiedUnits.toFixed(6) is "0.529167" | |
62 PASS length.value.toFixed(1) is "2.0" | |
63 PASS length.unitType is SVGLength.SVG_LENGTHTYPE_MM | |
64 | |
65 Reset to 2px | |
66 | |
67 Convert from px to in | |
68 PASS length.convertToSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_IN) is undefined. | |
69 PASS length.valueAsString is "0.0208333in" | |
70 PASS length.valueInSpecifiedUnits.toFixed(7) is "0.0208333" | |
71 PASS length.value.toFixed(1) is "2.0" | |
72 PASS length.unitType is SVGLength.SVG_LENGTHTYPE_IN | |
73 | |
74 Reset to 2px | |
75 | |
76 Convert from px to pt | |
77 PASS length.convertToSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PT) is undefined. | |
78 PASS length.valueAsString is "1.5pt" | |
79 PASS length.valueInSpecifiedUnits is 1.5 | |
80 PASS length.value.toFixed(1) is "2.0" | |
81 PASS length.unitType is SVGLength.SVG_LENGTHTYPE_PT | |
82 | |
83 Reset to 2px | |
84 | |
85 Convert from px to pc | |
86 PASS length.convertToSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PC) is undefined. | |
87 PASS length.valueInSpecifiedUnits.toFixed(3) is "0.125" | |
88 PASS length.value.toFixed(1) is "2.0" | |
89 PASS length.unitType is SVGLength.SVG_LENGTHTYPE_PC | |
90 PASS successfullyParsed is true | |
91 | |
92 TEST COMPLETE | |
93 | |
OLD | NEW |