dom/smil/test/test_smilFillMode.xhtml

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 <html xmlns="http://www.w3.org/1999/xhtml">
michael@0 2 <head>
michael@0 3 <title>Test for SMIL fill modes</title>
michael@0 4 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 5 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
michael@0 6 </head>
michael@0 7 <body>
michael@0 8 <p id="display"></p>
michael@0 9 <div id="content" style="display: none">
michael@0 10 <svg id="svg" xmlns="http://www.w3.org/2000/svg" width="120px" height="120px"
michael@0 11 onload="this.pauseAnimations()">
michael@0 12 <circle cx="-100" cy="20" r="15" fill="blue" id="circle"/>
michael@0 13 </svg>
michael@0 14 </div>
michael@0 15 <pre id="test">
michael@0 16 <script class="testbody" type="text/javascript">
michael@0 17 <![CDATA[
michael@0 18 /** Test for SMIL fill modes **/
michael@0 19
michael@0 20 /* Global Variables */
michael@0 21 const svgns="http://www.w3.org/2000/svg";
michael@0 22 var svg = document.getElementById("svg");
michael@0 23 var circle = document.getElementById('circle');
michael@0 24
michael@0 25 SimpleTest.waitForExplicitFinish();
michael@0 26
michael@0 27 function createAnim() {
michael@0 28 var anim = document.createElementNS(svgns,'animate');
michael@0 29 anim.setAttribute('attributeName','cx');
michael@0 30 anim.setAttribute('dur','4s');
michael@0 31 anim.setAttribute('begin','0s');
michael@0 32 anim.setAttribute('values', '10; 20');
michael@0 33 return circle.appendChild(anim);
michael@0 34 }
michael@0 35
michael@0 36 function main() {
michael@0 37 ok(svg.animationsPaused(), "should be paused by <svg> load handler");
michael@0 38 is(svg.getCurrentTime(), 0, "should be paused at 0 in <svg> load handler");
michael@0 39
michael@0 40 var tests =
michael@0 41 [ testSetLaterA,
michael@0 42 testSetLaterB,
michael@0 43 testRemoveLater ];
michael@0 44 for (var i = 0; i < tests.length; i++) {
michael@0 45 var anim = createAnim();
michael@0 46 svg.setCurrentTime(0);
michael@0 47 tests[i](anim);
michael@0 48 anim.parentNode.removeChild(anim);
michael@0 49 }
michael@0 50 SimpleTest.finish();
michael@0 51 }
michael@0 52
michael@0 53 function checkSample(time, expectedValue) {
michael@0 54 svg.setCurrentTime(time);
michael@0 55 is(circle.cx.animVal.value, expectedValue,
michael@0 56 "Updated fill mode not applied to animation");
michael@0 57 }
michael@0 58
michael@0 59 // Test that we can update the fill mode after an interval has played and it
michael@0 60 // will be updated correctly.
michael@0 61 function testSetLaterA(anim) {
michael@0 62 checkSample(5, -100);
michael@0 63 anim.setAttribute('fill', 'freeze');
michael@0 64 is(circle.cx.animVal.value, 20,
michael@0 65 "Fill not applied for retrospectively set fill mode");
michael@0 66 }
michael@0 67
michael@0 68 function testSetLaterB(anim) {
michael@0 69 anim.setAttribute('fill', 'freeze');
michael@0 70 checkSample(5, 20);
michael@0 71 }
michael@0 72
michael@0 73 function testRemoveLater(anim) {
michael@0 74 anim.setAttribute('fill', 'freeze');
michael@0 75 checkSample(5, 20);
michael@0 76 anim.setAttribute('fill', 'remove');
michael@0 77 is(circle.cx.animVal.value, -100,
michael@0 78 "Fill not removed for retrospectively set fill mode");
michael@0 79 }
michael@0 80
michael@0 81 window.addEventListener("load", main, false);
michael@0 82 ]]>
michael@0 83 </script>
michael@0 84 </pre>
michael@0 85 </body>
michael@0 86 </html>

mercurial