2013-12-13 08:41:52 +04:00
|
|
|
<!doctype html>
|
|
|
|
<html>
|
|
|
|
<!--
|
|
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=948245
|
|
|
|
-->
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
|
|
|
<title>Test for Bug 948245</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=948245">Mozilla Bug 948245</a>
|
|
|
|
<p id="display"></p>
|
2016-05-23 04:45:10 +03:00
|
|
|
<div id="content">
|
2013-12-13 08:41:52 +04:00
|
|
|
<svg id="svg" onload="this.pauseAnimations()">
|
|
|
|
<rect fill="red" id="rect" x="0">
|
|
|
|
<animate attributeName="x" to="100" id="animation" dur="100s" min="200s"/>
|
|
|
|
</rect>
|
|
|
|
</svg>
|
|
|
|
</div>
|
|
|
|
<pre id="test">
|
|
|
|
<script class="testbody" type="text/javascript">
|
|
|
|
// The 'min' attribute introduces a kind of additional state into the SMIL
|
|
|
|
// model. If the 'min' attribute extends the active duration, the additional
|
|
|
|
// time between the amount of time the animation normally runs for (called the
|
|
|
|
// 'repeat duration') and the extended active duration is filled using the
|
|
|
|
// fill mode.
|
|
|
|
//
|
|
|
|
// Below we refer to this period of time between the end of the repeat
|
|
|
|
// duration and the end of the active duration as the 'extended period'.
|
|
|
|
//
|
|
|
|
// This test verifies that as we jump in and out of these states we produce
|
|
|
|
// the correct values.
|
|
|
|
//
|
|
|
|
// The test animation above produces an active interval that is longer than
|
|
|
|
// the 'repeating duration' of the animation.
|
|
|
|
var rect = $('rect'),
|
|
|
|
animation = $('animation');
|
|
|
|
|
|
|
|
// Animation doesn't start until onload
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
2017-01-17 13:50:25 +03:00
|
|
|
window.addEventListener("load", runTests);
|
2013-12-13 08:41:52 +04:00
|
|
|
|
|
|
|
function runTests() {
|
|
|
|
ok($('svg').animationsPaused(), "should be paused by <svg> load handler");
|
|
|
|
|
|
|
|
// In the extended period (t=150s) we should not be animating or filling
|
|
|
|
// since the default fill mode is "none".
|
|
|
|
animation.ownerSVGElement.setCurrentTime(150);
|
2015-05-13 02:52:01 +03:00
|
|
|
is(rect.x.animVal.value, 0,
|
|
|
|
"Shouldn't fill in extended period with fill='none'");
|
2013-12-13 08:41:52 +04:00
|
|
|
|
|
|
|
// If we set the fill mode we should start filling.
|
|
|
|
animation.setAttribute("fill", "freeze");
|
2015-05-13 02:52:01 +03:00
|
|
|
is(rect.x.animVal.value, 100,
|
|
|
|
"Should fill in extended period with fill='freeze'");
|
2013-12-13 08:41:52 +04:00
|
|
|
|
|
|
|
// If we unset the fill attribute we should stop filling.
|
|
|
|
animation.removeAttribute("fill");
|
2015-05-13 02:52:01 +03:00
|
|
|
is(rect.x.animVal.value, 0, "Shouldn't fill after unsetting fill");
|
2013-12-13 08:41:52 +04:00
|
|
|
|
|
|
|
// If we jump back into the repeated interval (at t=50s) we should be
|
|
|
|
// animating.
|
|
|
|
animation.ownerSVGElement.setCurrentTime(50);
|
2015-05-13 02:52:01 +03:00
|
|
|
is(rect.x.animVal.value, 50, "Should be active in repeating interval");
|
2013-12-13 08:41:52 +04:00
|
|
|
|
|
|
|
// If we jump to the boundary at the start of the extended period we should
|
|
|
|
// not be filling (since we removed the fill attribute above).
|
|
|
|
animation.ownerSVGElement.setCurrentTime(100);
|
2015-05-13 02:52:01 +03:00
|
|
|
is(rect.x.animVal.value, 0,
|
|
|
|
"Shouldn't fill after seeking to boundary of extended period");
|
2013-12-13 08:41:52 +04:00
|
|
|
|
|
|
|
// If we apply a fill mode at this boundary point we should do regular fill
|
|
|
|
// behavior of using the last value in the interpolation range.
|
|
|
|
animation.setAttribute("fill", "freeze");
|
2015-05-13 02:52:01 +03:00
|
|
|
is(rect.x.animVal.value, 100,
|
|
|
|
"Should fill at boundary to extended period");
|
2013-12-13 08:41:52 +04:00
|
|
|
|
|
|
|
// Check that if we seek past the interval we fill with the value at the end
|
|
|
|
// of the _repeat_duration_ not the value at the end of the
|
|
|
|
// _active_duration_.
|
|
|
|
animation.setAttribute("repeatCount", "1.5");
|
|
|
|
animation.ownerSVGElement.setCurrentTime(225);
|
2015-05-13 02:52:01 +03:00
|
|
|
is(rect.x.animVal.value, 50,
|
|
|
|
"Should fill with the end of the repeat duration value");
|
2013-12-13 08:41:52 +04:00
|
|
|
|
|
|
|
SimpleTest.finish();
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|