OLD | NEW |
| (Empty) |
1 description("This test checks the SVGPoint API"); | |
2 | |
3 var svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg"); | |
4 var point = svgElement.createSVGPoint(); | |
5 | |
6 debug(""); | |
7 debug("Check initial point values"); | |
8 shouldBe("point.x", "0"); | |
9 shouldBe("point.y", "0"); | |
10 | |
11 debug(""); | |
12 debug("Check assigning points"); | |
13 shouldBe("point.x = 100", "100"); | |
14 shouldBe("point.y = 200", "200"); | |
15 | |
16 debug(""); | |
17 debug("Check assigning invalid points"); | |
18 shouldBe("point.x = point", "point"); | |
19 shouldBeNull("point.y = null"); | |
20 | |
21 debug(""); | |
22 debug("Check that the point contains the correct values"); | |
23 shouldBe("point.x", "NaN"); | |
24 shouldBe("point.y", "0"); | |
25 | |
26 debug(""); | |
27 debug("Reset to -50, 100"); | |
28 point.x = -50; | |
29 point.y = 100; | |
30 | |
31 debug(""); | |
32 debug("Check 'matrixTransform' method - multiply with -1,0,0,2,10,10 matrix, sho
uld flip x coordinate, multiply y by two and translate each coordinate by 10"); | |
33 var ctm = svgElement.createSVGMatrix(); | |
34 ctm.a = -1; | |
35 ctm.d = 2; | |
36 ctm.e = 10; | |
37 ctm.f = 10; | |
38 shouldBeEqualToString("(newPoint = point.matrixTransform(ctm)).toString()", "[ob
ject SVGPoint]"); | |
39 shouldBe("newPoint.x", "60"); | |
40 shouldBe("newPoint.y", "210"); | |
41 | |
42 debug(""); | |
43 debug("Check invalid arguments for 'matrixTransform'"); | |
44 shouldThrow("point.matrixTransform()"); | |
45 shouldThrow("point.matrixTransform(-1)"); | |
46 shouldThrow("point.matrixTransform(5)"); | |
47 shouldThrow("point.matrixTransform('aString')"); | |
48 shouldThrow("point.matrixTransform(point)"); | |
49 shouldThrow("point.matrixTransform(svgElement)"); | |
50 | |
51 successfullyParsed = true; | |
OLD | NEW |