summaryrefslogtreecommitdiffstats
path: root/dom/smil/test/test_smilKeyTimesPacedMode.xhtml
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/smil/test/test_smilKeyTimesPacedMode.xhtml
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/smil/test/test_smilKeyTimesPacedMode.xhtml')
-rw-r--r--dom/smil/test/test_smilKeyTimesPacedMode.xhtml123
1 files changed, 123 insertions, 0 deletions
diff --git a/dom/smil/test/test_smilKeyTimesPacedMode.xhtml b/dom/smil/test/test_smilKeyTimesPacedMode.xhtml
new file mode 100644
index 000000000..eff537cfd
--- /dev/null
+++ b/dom/smil/test/test_smilKeyTimesPacedMode.xhtml
@@ -0,0 +1,123 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title>Tests updated intervals</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=555026">Mozilla Bug 555026</a>
+<p id="display"></p>
+<div id="content">
+<svg id="svg" xmlns="http://www.w3.org/2000/svg" width="120px" height="120px"
+ onload="this.pauseAnimations()">
+ <circle r="10" id="circle"/>
+</svg>
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+<![CDATA[
+/** Test that we ignore keyTimes attr when calcMode="paced" **/
+
+/* Global Variables */
+const SVGNS = "http://www.w3.org/2000/svg";
+const ANIM_DUR = "2s";
+const HALF_TIME = "1";
+const ATTR_NAME = "cx"
+const KEYTIMES_TO_TEST = [
+ // potentially-valid values (depending on number of values in animation)
+ "0; 0.2; 1",
+ "0; 0.5",
+ "0; 1",
+ // invalid values:
+ "", "abc", "-0.5", "0; 0.5; 1.01", "5"
+];
+const gSvg = document.getElementById("svg");
+const gCircle = document.getElementById("circle");
+
+SimpleTest.waitForExplicitFinish();
+
+
+// MAIN FUNCTIONS
+function main() {
+ ok(gSvg.animationsPaused(), "should be paused by <svg> load handler");
+ is(gSvg.getCurrentTime(), 0, "should be paused at 0 in <svg> load handler");
+
+ testByAnimation();
+ testToAnimation();
+ testValuesAnimation();
+ SimpleTest.finish();
+}
+
+function testByAnimation() {
+ for (var i = 0; i < KEYTIMES_TO_TEST.length; i++) {
+ setupTest();
+ var anim = createAnim();
+ anim.setAttribute("by", "200");
+ var curKeyTimes = KEYTIMES_TO_TEST[i];
+ anim.setAttribute("keyTimes", curKeyTimes);
+
+ gSvg.setCurrentTime(HALF_TIME);
+ is(gCircle.cx.animVal.value, 100,
+ "Checking animVal with 'by' and keyTimes='" + curKeyTimes + "'");
+
+ anim.parentNode.removeChild(anim); // clean up
+ }
+}
+
+function testToAnimation() {
+ for (var i = 0; i < KEYTIMES_TO_TEST.length; i++) {
+ setupTest();
+ var anim = createAnim();
+ anim.setAttribute("to", "200");
+ var curKeyTimes = KEYTIMES_TO_TEST[i];
+ anim.setAttribute("keyTimes", curKeyTimes);
+
+ gSvg.setCurrentTime(HALF_TIME);
+ is(gCircle.cx.animVal.value, 100,
+ "Checking animVal with 'to' and keyTimes='" + curKeyTimes + "'");
+
+ anim.parentNode.removeChild(anim); // clean up
+ }
+}
+
+function testValuesAnimation() {
+ for (var i = 0; i < KEYTIMES_TO_TEST.length; i++) {
+ setupTest();
+ var anim = createAnim();
+ anim.setAttribute("values", "100; 110; 200");
+ var curKeyTimes = KEYTIMES_TO_TEST[i];
+ anim.setAttribute("keyTimes", curKeyTimes);
+
+ gSvg.setCurrentTime(HALF_TIME);
+ is(gCircle.cx.animVal.value, 150,
+ "Checking animVal with 'values' and keyTimes='" + curKeyTimes + "'");
+
+ anim.parentNode.removeChild(anim); // clean up
+ }
+}
+
+// HELPER FUNCTIONS
+// Common setup code for each test function: seek to 0, and make sure
+// the previous test cleaned up its animations.
+function setupTest() {
+ gSvg.setCurrentTime(0);
+ if (gCircle.firstChild) {
+ ok(false, "Previous test didn't clean up after itself.");
+ }
+}
+
+function createAnim() {
+ var anim = document.createElementNS(SVGNS,"animate");
+ anim.setAttribute("attributeName", ATTR_NAME);
+ anim.setAttribute("dur", ANIM_DUR);
+ anim.setAttribute("begin", "0s");
+ anim.setAttribute("calcMode", "paced");
+ return gCircle.appendChild(anim);
+}
+
+window.addEventListener("load", main, false);
+]]>
+</script>
+</pre>
+</body>
+</html>