зеркало из https://github.com/mozilla/gecko-dev.git
53 строки
1.7 KiB
HTML
53 строки
1.7 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<!--
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=1024926
|
|
-->
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Test path length changes when manipulated</title>
|
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
|
</head>
|
|
<body>
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1024926">Mozilla Bug 1024926</a>
|
|
<p id="display"></p>
|
|
<div id="content" style="display: none">
|
|
<svg width="100%" height="1" id="svg">
|
|
<path id="path_lines" d="M50,100l0,0l0,-50l100,0l86.3325,122.665z"></path>
|
|
<path id="path_straight_curve" d="M0,0 C100,0 150,0 200,0" />
|
|
</svg>
|
|
</div>
|
|
<pre id="test">
|
|
<script class="testbody" type="text/javascript">
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
// Test a closed path with a series of lines.
|
|
var path = document.getElementById("path_lines");
|
|
is(path.getTotalLength(), 500, "Unexpected path length");
|
|
|
|
// Test a path that's been shortened via the DOM.
|
|
for (var i = 0; i < 2; i++) {
|
|
path.pathSegList.removeItem(path.pathSegList.numberOfItems - 1);
|
|
}
|
|
is(path.getTotalLength(), 150, "Unexpected path length");
|
|
|
|
// Test a path that's been shortened to be empty, via the DOM.
|
|
while (path.pathSegList.numberOfItems > 0) {
|
|
path.pathSegList.removeItem(0);
|
|
}
|
|
is(path.getTotalLength(), 0, "Unexpected path length");
|
|
|
|
// Test a path with a curve command ("C") that is really a straight line.
|
|
path = document.getElementById("path_straight_curve");
|
|
is(path.getTotalLength(), 200, "Unexpected path length, for straight line " +
|
|
"generated by 'C' command");
|
|
|
|
SimpleTest.finish();
|
|
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|