Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- Manifest: dom/svg/test/mochitest.toml
<!DOCTYPE html>
<title>Test for getPathSegmentAtLength for d property</title>
<meta charset=utf-8>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
svg {
width: 10%;
height: 10%;
background: #eee;
}
svg path {
fill: none;
stroke: #000;
}
</style>
<div id="log"></div>
<svg viewBox="0 0 20 10">
<path id='target1' d="M2,2 L8,8 L12,4"/>
</svg>
<script>
/* global test, assert_equals */
'use strict';
test(function() {
let target1 = document.getElementById('target1');
assert_equals(target1.getPathSegmentAtLength(5).type, "L");
assert_array_equals(target1.getPathSegmentAtLength(5).values, [8, 8]);
assert_equals(target1.getPathSegmentAtLength(10).type, "L");
assert_array_equals(target1.getPathSegmentAtLength(10).values, [12, 4]);
}, "getPathSegmentAtLength works properly on d attribute");
</script>