OLD | NEW |
1 description("Test scientific numbers on <length> values for SVG presentation att
ributes.") | 1 description("Test scientific numbers on <length> values for SVG presentation att
ributes.") |
2 if (window.testRunner) | 2 if (window.testRunner) |
3 testRunner.dumpAsText(); | 3 testRunner.dumpAsText(); |
4 createSVGTestCase(); | 4 createSVGTestCase(); |
5 | 5 |
6 var text = createSVGElement("text"); | 6 var text = createSVGElement("text"); |
7 text.setAttribute("id", "text"); | 7 text.setAttribute("id", "text"); |
8 text.setAttribute("x", "100px"); | 8 text.setAttribute("x", "100px"); |
9 text.setAttribute("y", "100px"); | 9 text.setAttribute("y", "100px"); |
10 rootSVGElement.appendChild(text); | 10 rootSVGElement.appendChild(text); |
11 | 11 |
12 function test(valueString, expectedValue) { | 12 function test(valueString, expectedValue) { |
13 » // Reset baseline-shift to baseline. | 13 // Reset baseline-shift to baseline. |
14 » text.setAttribute("baseline-shift", "baseline"); | 14 text.style.baselineShift = "baseline"; |
15 » shouldBeEqualToString("getComputedStyle(text).baselineShift", "baseline"
); | 15 shouldBeEqualToString("text.style.baselineShift", "baseline"); |
16 | 16 |
17 » // Run test | 17 // Run test |
18 » text.setAttribute("baseline-shift", valueString); | 18 text.style.baselineShift = valueString; |
19 » shouldBeEqualToString("getComputedStyle(text).baselineShift", expectedVa
lue); | 19 shouldBeEqualToString("text.style.baselineShift", expectedValue); |
20 } | 20 } |
21 | 21 |
22 debug(""); | 22 debug(""); |
23 debug("Test positive exponent values with 'e'"); | 23 debug("Test positive exponent values with 'e'"); |
24 test(".5e2", "50px"); | 24 test(".5e2", "50px"); |
25 test("5e1", "50px"); | 25 test("5e1", "50px"); |
26 test("0.5e2", "50px"); | 26 test("0.5e2", "50px"); |
27 test("+.5e2", "50px"); | 27 test("+.5e2", "50px"); |
28 test("+5e1", "50px"); | 28 test("+5e1", "50px"); |
29 test("+0.5e2", "50px"); | 29 test("+0.5e2", "50px"); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 debug(""); | 88 debug(""); |
89 debug("Invalid values"); | 89 debug("Invalid values"); |
90 test("50e0.0", "baseline"); | 90 test("50e0.0", "baseline"); |
91 test("50 e0", "baseline"); | 91 test("50 e0", "baseline"); |
92 test("50e 0", "baseline"); | 92 test("50e 0", "baseline"); |
93 test("50.e0", "baseline"); | 93 test("50.e0", "baseline"); |
94 | 94 |
95 var successfullyParsed = true; | 95 var successfullyParsed = true; |
96 | 96 |
97 completeTest(); | 97 completeTest(); |
OLD | NEW |