Index: third_party/WebKit/LayoutTests/svg/dom/path-queries-pathLength.html |
diff --git a/third_party/WebKit/LayoutTests/svg/dom/path-queries-pathLength.html b/third_party/WebKit/LayoutTests/svg/dom/path-queries-pathLength.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..462acfc4ab08f1f1db7d507ff7f8c7ee10ea17c1 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/svg/dom/path-queries-pathLength.html |
@@ -0,0 +1,29 @@ |
+<!DOCTYPE html> |
+<title>SVGPathElement path metrics query w/ pathLength</title> |
+<script src=../../resources/testharness.js></script> |
+<script src=../../resources/testharnessreport.js></script> |
+<script> |
+setup(function() { |
+ window.path = document.createElementNS('http://www.w3.org/2000/svg', 'path'); |
+ path.setAttribute('d', 'M0,0L100,0L100,100'); |
+ path.setAttribute('pathLength', '1000'); |
+}); |
+ |
+test(function() { |
+ assert_approx_equals(path.getTotalLength(), 200, 1e-5); |
+}, document.title+', getTotalLength'); |
+ |
+test(function() { |
+ var point = path.getPointAtLength(50); |
+ assert_approx_equals(point.x, 50, 1e-5); |
+ assert_approx_equals(point.y, 0, 1e-5); |
+ var point = path.getPointAtLength(150); |
+ assert_approx_equals(point.x, 100, 1e-5); |
+ assert_approx_equals(point.y, 50, 1e-5); |
+}, document.title+', getPointAtLength'); |
+ |
+test(function() { |
+ assert_equals(path.getPathSegAtLength(50), 1); |
+ assert_equals(path.getPathSegAtLength(150), 2); |
+}, document.title+', getPathSegAtLength'); |
+</script> |