Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/svg/dom/SVGGeometryElement-getPointAtLength-detached.html |
| diff --git a/third_party/WebKit/LayoutTests/svg/dom/SVGGeometryElement-getPointAtLength-detached.html b/third_party/WebKit/LayoutTests/svg/dom/SVGGeometryElement-getPointAtLength-detached.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..cafd63ddf82175602866796037bd3ad206845009 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/svg/dom/SVGGeometryElement-getPointAtLength-detached.html |
| @@ -0,0 +1,52 @@ |
| +<!DOCTYPE html> |
| +<title>SVGGeometryElement.getPointAtLength method (element detached)</title> |
| +<script src="../../resources/testharness.js"></script> |
| +<script src="../../resources/testharnessreport.js"></script> |
| +<script> |
| +test(function() { |
| + var pathElement = document.createElementNS("http://www.w3.org/2000/svg", "path"); |
| + |
| + function pointAtLength(string) { |
| + pathElement.setAttribute("d", string); |
| + |
| + var point = pathElement.getPointAtLength(700); |
| + return [Math.round(point.x), Math.round(point.y)]; |
| + } |
| + |
| + assert_array_equals(pointAtLength('M0,20 L400,20 L640,20'), [640, 20]); |
| + assert_array_equals(pointAtLength('M0,20 L400,20 L640,20 z'), [580, 20]); |
| + assert_array_equals(pointAtLength('M0,20 L400,20 z M 320,20 L640,20'), [100, 20]); |
| + assert_array_equals(pointAtLength('M0,20 L20,40'), [20, 40]); |
| +}, document.title + " with SVGPathElement"); |
| + |
| +test(function() { |
| + var rectElement = document.createElementNS("http://www.w3.org/2000/svg", "rect"); |
| + |
| + function pointAtLength(rx, ry, width, height) { |
| + rectElement.setAttribute("rx", rx); |
| + rectElement.setAttribute("ry", ry); |
| + rectElement.setAttribute("width", width); |
| + rectElement.setAttribute("height", height); |
| + |
| + var point = rectElement.getPointAtLength(300); |
| + return [Math.round(point.x), Math.round(point.y)]; |
| + } |
| + |
| + assert_array_equals(pointAtLength('0', '0', '200', '300'), [0, 0]); |
|
fs
2016/10/26 11:00:04
Nit: Same as in -attached.html
Shanmuga Pandi
2016/10/26 11:28:28
Done.
|
| + assert_array_equals(pointAtLength('50', '50', '200', '300'), [0, 0]); |
| +}, document.title + " with SVGRectElement"); |
| + |
| +test(function() { |
| + var circleElement = document.createElementNS("http://www.w3.org/2000/svg", "circle"); |
| + |
| + function pointAtLength(string) { |
|
fs
2016/10/26 11:00:04
Nit: Same as in -attached.html
Shanmuga Pandi
2016/10/26 11:28:28
Done.
|
| + circleElement.setAttribute("r", string); |
| + |
| + var point = circleElement.getPointAtLength(100); |
| + return [Math.round(point.x), Math.round(point.y)]; |
| + } |
| + |
| + assert_array_equals(pointAtLength('10'), [0, 0]); |
|
fs
2016/10/26 11:00:04
Nit: Same as in -attached.html
Shanmuga Pandi
2016/10/26 11:28:28
Done.
|
| + assert_array_equals(pointAtLength('100'), [0, 0]); |
| +}, document.title + " with SVGCircleElement"); |
| +</script> |