blob: cbf357e7f030b9ae69fb0f6f7147bdebab813008 [file] [log] [blame]
<!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');
</script>