| <html xmlns="http://www.w3.org/1999/xhtml"> |
| <head> |
| <script src="../../resources/js-test-pre.js"></script> |
| </head> |
| <body onload="run()"> |
| <svg id="svg" xmlns="http://www.w3.org/2000/svg" width="200" height="200"> |
| <circle id="c1" cx="50" cy="50" r="50" fill="none" stroke="black" stroke-width="20" stroke-dashoffset="20" stroke-dasharray="20 20"/> |
| </svg> |
| <p id="description"></p> |
| <div id="console"></div> |
| <script type="text/javascript"> |
| <![CDATA[ |
| window.enablePixelTesting = false; |
| window.jsTestIsAsync = true; |
| var c1 = document.getElementById("c1"); |
| |
| function run() { |
| description("Test SVGGeometryElement APIs for circle."); |
| |
| debug(""); |
| debug("Test isPointInFill()"); |
| shouldBe("c1.isPointInFill({})", "false"); |
| shouldBe("c1.isPointInFill({x: 50, y: 50})", "true"); |
| shouldBe("c1.isPointInFill({x: 0, y: 50})", "true"); |
| shouldBe("c1.isPointInFill({x: 100, y: 50})", "true"); |
| shouldBe("c1.isPointInFill({x: 50, y: 0})", "true"); |
| shouldBe("c1.isPointInFill({x: 50, y: 100})", "true"); |
| shouldBe("c1.isPointInFill({x: -1, y: 50})", "false"); |
| shouldBe("c1.isPointInFill({x: 101, y: 50})", "false"); |
| shouldBe("c1.isPointInFill({x: 50, y: -1})", "false"); |
| shouldBe("c1.isPointInFill({x: 50, y: 101})", "false"); |
| shouldBe("c1.isPointInFill({x: 90, y: 90})", "false"); |
| shouldBe("c1.isPointInFill({x: 10, y: 10})", "false"); |
| shouldBe("c1.isPointInFill({x: 90, y: 10})", "false"); |
| shouldBe("c1.isPointInFill({x: 10, y: 90})", "false"); |
| |
| debug(""); |
| debug("Test isPointInStroke()"); |
| shouldBe("c1.isPointInStroke({})", "false"); |
| shouldBe("c1.isPointInStroke({x: 50, y: 50})", "false"); |
| shouldBe("c1.isPointInStroke({x: 100, y: 51})", "false"); |
| shouldBe("c1.isPointInStroke({x: 100, y: 49})", "true"); |
| shouldBe("c1.isPointInStroke({x: 0, y: 50})", "true"); |
| shouldBe("c1.isPointInStroke({x: 52, y: 100})", "true"); |
| shouldBe("c1.isPointInStroke({x: 48, y: 100})", "false"); |
| |
| debug(""); |
| debug("Test getTotalLength()"); |
| shouldBeCloseTo("c1.getTotalLength()", Math.PI * 100, 0.1); |
| |
| debug(""); |
| debug("Test getPointAtLength()"); |
| shouldBeCloseTo("c1.getPointAtLength(0).x", 100, 0.1); |
| shouldBeCloseTo("c1.getPointAtLength(0).y", 50, 0.1); |
| shouldBeCloseTo("c1.getPointAtLength(Math.PI * 100 / 4).x", 50, 0.1); |
| shouldBeCloseTo("c1.getPointAtLength(Math.PI * 100 / 4).y", 100, 0.1); |
| shouldBeCloseTo("c1.getPointAtLength(Math.PI * 100 / 2).x", 0, 0.1); |
| shouldBeCloseTo("c1.getPointAtLength(Math.PI * 100 / 2).y", 50, 0.1); |
| shouldBeCloseTo("c1.getPointAtLength(Math.PI * 100 / 8).x", 85.35, 1); |
| shouldBeCloseTo("c1.getPointAtLength(Math.PI * 100 / 8).y", 85.35, 1); |
| shouldBeCloseTo("c1.getPointAtLength(Math.PI * 100 * 2).x", 100, 0.1); |
| shouldBeCloseTo("c1.getPointAtLength(Math.PI * 100 * 2).y", 50, 0.1); |
| |
| finishJSTest(); |
| } |
| ]]> |
| </script> |
| <script src="../../resources/js-test-post.js"></script> |
| </body> |
| </html> |