Implement SVGGeometryElement's isPointInFill and isPointInStroke
[WebKit-https.git] / LayoutTests / svg / dom / SVGPoint.html
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../../resources/js-test-pre.js"></script>
5 </head>
6 <body>
7 <p id="description"></p>
8 <div id="console"></div>
9 <script>
10 description("This test checks the SVGPoint API");
11
12 var svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
13 var point = svgElement.createSVGPoint();
14
15 debug("");
16 debug("Check initial point values");
17 shouldBe("point.x", "0");
18 shouldBe("point.y", "0");
19
20 debug("");
21 debug("Check assigning points");
22 shouldBe("point.x = 100", "100");
23 shouldBe("point.y = 200", "200");
24
25 debug("");
26 debug("Check assigning invalid points");
27 shouldBe("point.x = point", "point");
28 shouldBeNull("point.y = null");
29
30 debug("");
31 debug("Check that the point contains the correct values");
32 shouldBe("point.x", "NaN");
33 shouldBe("point.y", "0");
34
35 debug("");
36 debug("Reset to -50, 100");
37 point.x = -50;
38 point.y = 100;
39
40 debug("");
41 debug("Check 'matrixTransform' method - multiply with -1,0,0,2,10,10 matrix, should flip x coordinate, multiply y by two and translate each coordinate by 10");
42 var ctm = svgElement.createSVGMatrix();
43 ctm.a = -1;
44 ctm.d = 2;
45 ctm.e = 10;
46 ctm.f = 10;
47 shouldBeEqualToString("(newPoint = point.matrixTransform(ctm)).toString()", "[object SVGPoint]");
48 shouldBe("newPoint.x", "60");
49 shouldBe("newPoint.y", "210");
50
51 debug("");
52 debug("Check invalid arguments for 'matrixTransform'");
53 shouldThrow("point.matrixTransform()");
54 shouldThrow("point.matrixTransform(-1)");
55 shouldThrow("point.matrixTransform(5)");
56 shouldThrow("point.matrixTransform('aString')");
57 shouldThrow("point.matrixTransform(point)");
58 shouldThrow("point.matrixTransform(svgElement)");
59
60 successfullyParsed = true;
61 </script>
62 <script src="../../resources/js-test-post.js"></script>
63 </body>
64 </html>