1 <!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN"
2 "http://www.w3.org/TR/html4/loose.dtd">
6 <meta http-equiv=
"Content-Type" content=
"text/html; charset=utf-8">
7 <title>Keyframes test
</title>
8 <style type=
"text/css" media=
"screen">
15 background-color: blue;
16 -webkit-animation-duration:
1s;
17 -webkit-animation-timing-function: linear;
18 -webkit-animation-name:
"anim";
20 @-webkit-keyframes
"anim" {
29 <script type=
"text/javascript" charset=
"utf-8">
30 if (window.layoutTestController) {
31 layoutTestController.dumpAsText();
32 layoutTestController.waitUntilDone();
36 const defaultTolerance =
0.2;
38 function isEqual(actual, desired, tolerance)
40 if (tolerance == undefined || tolerance ==
0)
41 tolerance = defaultTolerance;
42 var diff = Math.abs(actual - desired);
43 return diff < tolerance;
46 function snapshot(which)
51 var left = parseInt(window.getComputedStyle(document.getElementById('box')).left);
52 var expected = which ?
200 :
100;
53 if (!isEqual(left, expected))
54 result =
"FAIL(was:"+left+
", expected:"+expected+
")";
59 setTimeout(
"snapshot(0)",
300);
60 setTimeout(
"snapshot(1)",
700);
62 window.setTimeout(function() {
63 document.getElementById('result').innerHTML = result;
64 if (window.layoutTestController)
65 layoutTestController.notifyDone();
69 document.addEventListener('webkitAnimationStart', start, false);
74 This test performs an animation of the left property. It should stop for
100ms at
100px and
200px
75 We test for those values
50ms after it has stopped at each position.