layout/style/test/test_transitions_step_functions.html

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <!--
michael@0 4 https://bugzilla.mozilla.org/show_bug.cgi?id=435441
michael@0 5 -->
michael@0 6 <head>
michael@0 7 <title>Test for Bug 435441</title>
michael@0 8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 9 <script type="application/javascript" src="animation_utils.js"></script>
michael@0 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
michael@0 11 <style type="text/css">
michael@0 12
michael@0 13 p.transition {
michael@0 14 transition: margin-top 100s linear;
michael@0 15 }
michael@0 16
michael@0 17 </style>
michael@0 18 </head>
michael@0 19 <body>
michael@0 20 <div id="display">
michael@0 21
michael@0 22 </div>
michael@0 23 <pre id="test">
michael@0 24 <script type="application/javascript">
michael@0 25
michael@0 26 /** Test for transition step functions **/
michael@0 27
michael@0 28 var display = document.getElementById("display");
michael@0 29
michael@0 30 function run_test(tf, percent, value)
michael@0 31 {
michael@0 32 var p = document.createElement("p");
michael@0 33 p.className = "transition";
michael@0 34 p.style.marginTop = "0px";
michael@0 35 // be this percent of the way through a 100s transition
michael@0 36 p.style.transitionDelay = (percent * -100) + "s";
michael@0 37 p.style.transitionTimingFunction = tf;
michael@0 38 display.appendChild(p);
michael@0 39 var cs = getComputedStyle(p, "");
michael@0 40 var flush1 = cs.marginTop;
michael@0 41
michael@0 42 p.style.marginTop = "1000px";
michael@0 43 var result = px_to_num(cs.marginTop) / 1000
michael@0 44
michael@0 45 is(result, value, 100 * percent + "% of the way through " + tf);
michael@0 46
michael@0 47 display.removeChild(p);
michael@0 48 }
michael@0 49
michael@0 50 run_test("step-start", 0, 0);
michael@0 51 run_test("step-start", 0.001, 1);
michael@0 52 run_test("step-start", 0.999, 1);
michael@0 53 run_test("step-start", 1, 1);
michael@0 54 run_test("step-end", 0, 0);
michael@0 55 run_test("step-end", 0.001, 0);
michael@0 56 run_test("step-end", 0.999, 0);
michael@0 57 run_test("step-end", 1, 1);
michael@0 58
michael@0 59 run_test("steps(2)", 0.00, 0.0);
michael@0 60 run_test("steps(2)", 0.49, 0.0);
michael@0 61 run_test("steps(2)", 0.50, 0.5);
michael@0 62 run_test("steps(2)", 0.99, 0.5);
michael@0 63 run_test("steps(2)", 1.00, 1.0);
michael@0 64
michael@0 65 run_test("steps(2, end)", 0.00, 0.0);
michael@0 66 run_test("steps(2, end)", 0.49, 0.0);
michael@0 67 run_test("steps(2, end)", 0.50, 0.5);
michael@0 68 run_test("steps(2, end)", 0.99, 0.5);
michael@0 69 run_test("steps(2, end)", 1.00, 1.0);
michael@0 70
michael@0 71 run_test("steps(2, start)", 0.00, 0.0);
michael@0 72 run_test("steps(2, start)", 0.01, 0.5);
michael@0 73 run_test("steps(2, start)", 0.50, 0.5);
michael@0 74 run_test("steps(2, start)", 0.51, 1.0);
michael@0 75 run_test("steps(2, start)", 1.00, 1.0);
michael@0 76
michael@0 77 run_test("steps(8,end)", 0.00, 0.0);
michael@0 78 run_test("steps(8,end)", 0.10, 0.0);
michael@0 79 run_test("steps(8,end)", 0.20, 0.125);
michael@0 80 run_test("steps(8,end)", 0.30, 0.25);
michael@0 81 run_test("steps(8,end)", 0.40, 0.375);
michael@0 82 run_test("steps(8,end)", 0.49, 0.375);
michael@0 83 run_test("steps(8,end)", 0.50, 0.5);
michael@0 84 run_test("steps(8,end)", 0.60, 0.5);
michael@0 85 run_test("steps(8,end)", 0.70, 0.625);
michael@0 86 run_test("steps(8,end)", 0.80, 0.75);
michael@0 87 run_test("steps(8,end)", 0.90, 0.875);
michael@0 88 run_test("steps(8,end)", 1.00, 1.0);
michael@0 89
michael@0 90 </script>
michael@0 91 </pre>
michael@0 92 </body>
michael@0 93 </html>

mercurial