2008-11-20 Simon Fraser <simon.fraser@apple.com>
[WebKit-https.git] / LayoutTests / animations / computed-style.html
1 <html>
2 <head>
3 <link rel="stylesheet" href="../fast/js/resources/js-test-style.css">
4 <style type="text/css" media="screen">
5     #test1 {
6         width: 20px;
7         height: 20px;
8         background-color: blue;
9         position: relative;
10         -webkit-animation-name: anim1;
11         -webkit-animation-duration: 10s;
12         -webkit-animation-iteration-count: 10;
13         -webkit-animation-play-state: paused;
14         -webkit-animation-timing-function: linear;
15         -webkit-animation-direction: normal;
16     }
17     #test2 {
18         width: 20px;
19         height: 20px;
20         background-color: blue;
21         position: relative;
22         -webkit-animation-name: anim2, anim3;
23         -webkit-animation-duration: 5s, 2500ms;
24         -webkit-animation-iteration-count: 10, infinite;
25         -webkit-animation-play-state: paused, running;
26         -webkit-animation-timing-function: linear, ease-in-out;
27         -webkit-animation-direction: normal, alternate;
28     }
29     @-webkit-keyframes anim1 {
30         from { left: 10px; }
31         to { left: 20px; }
32     }
33     @-webkit-keyframes anim2 {
34         from { width: 20px; }
35         to { width: 25px; }
36     }
37     @-webkit-keyframes anim3 {
38         from { left: 10px; }
39         to { left: 20px; }
40     }
41 </style>
42 <script src="../fast/js/resources/js-test-pre.js"></script>
43 </head>
44 <body>
45 <p id="test1"></p>
46 <p id="test2"></p>
47 <p id="description"></p>
48 <div id="console"></div>
49 <script>
50
51 description("This tests computed style values from animation properties.");
52
53 var test1 = document.getElementById("test1");
54 var test2 = document.getElementById("test2");
55
56 var test1Style = window.getComputedStyle(test1);
57 var test2Style = window.getComputedStyle(test2);
58
59 shouldBe("test1Style.webkitAnimationName", "'anim1'");
60 shouldBe("test2Style.webkitAnimationName", "'anim2, anim3'");
61
62 shouldBe("test1Style.webkitAnimationDuration", "'10s'");
63 shouldBe("test2Style.webkitAnimationDuration", "'5s, 2.5s'");
64
65 shouldBe("test1Style.webkitAnimationIterationCount", "'10'");
66 shouldBe("test2Style.webkitAnimationIterationCount", "'10, infinite'");
67
68 shouldBe("test1Style.webkitAnimationPlayState", "'paused'");
69 shouldBe("test2Style.webkitAnimationPlayState", "'paused, running'");
70
71 shouldBe("test1Style.webkitAnimationTimingFunction", "'cubic-bezier(0, 0, 1, 1)'");
72 shouldBe("test2Style.webkitAnimationTimingFunction", "'cubic-bezier(0, 0, 1, 1), cubic-bezier(0.42, 0, 0.58, 1)'");
73
74 shouldBe("test1Style.webkitAnimationDirection", "'normal'");
75 shouldBe("test2Style.webkitAnimationDirection", "'normal, alternate'");
76
77 debug("");
78 successfullyParsed = true;
79
80 </script>
81 <script src="../fast/js/resources/js-test-post.js"></script>
82 </body>
83 </html>