OLD | NEW |
1 <!doctype html> | 1 <!DOCTYPE html> |
2 <html> | 2 <script src="../resources/testharness.js"></script> |
3 <head> | 3 <script src="../resources/testharnessreport.js"></script> |
4 <title>Test of animation-direction reverse on non-composited elements</title> | 4 <style> |
5 <style> | |
6 body { | |
7 margin: 0; | |
8 } | |
9 | |
10 .box { | 5 .box { |
| 6 animation-duration: 2s; |
| 7 animation-iteration-count: 8; |
| 8 animation-timing-function: linear; |
| 9 height: 50px; |
| 10 left: 20px; |
| 11 margin-bottom: 10px; |
11 position: relative; | 12 position: relative; |
12 left: 20px; | |
13 top: 10px; | 13 top: 10px; |
14 height: 50px; | |
15 width: 250px; | 14 width: 250px; |
16 margin-bottom: 10px; | |
17 animation-duration: 2s; | |
18 animation-timing-function: linear; | |
19 animation-iteration-count: 8; | |
20 } | 15 } |
21 | 16 |
22 .move1 { | 17 .move1 { |
23 animation-name: move1; | 18 animation-name: move1; |
24 background-color: blue; | 19 background-color: blue; |
25 color: white; | 20 color: white; |
26 } | 21 } |
27 | 22 |
28 .move2 { | 23 .move2 { |
29 animation-name: move2; | 24 animation-name: move2; |
(...skipping 20 matching lines...) Expand all Loading... |
50 from { left: 0px; } | 45 from { left: 0px; } |
51 to { left: 200px; } | 46 to { left: 200px; } |
52 } | 47 } |
53 | 48 |
54 @keyframes move2 { | 49 @keyframes move2 { |
55 0% { left: 0px; } | 50 0% { left: 0px; } |
56 40% { left: 160px; } | 51 40% { left: 160px; } |
57 60% { left: 120px; } | 52 60% { left: 120px; } |
58 100% { left: 200px; } | 53 100% { left: 200px; } |
59 } | 54 } |
60 </style> | 55 </style> |
61 <script src="resources/animation-test-helpers.js"></script> | |
62 <script> | |
63 const expectedValues = [ | |
64 // [time, element-id, property, expected-value, tolerance] | |
65 [0.2, "box1", "left", 20, 20], | |
66 [0.2, "box2", "left", 20, 20], | |
67 [0.2, "box3", "left", 180, 20], | |
68 [0.2, "box4", "left", 180, 20], | |
69 [2.2, "box1", "left", 20, 20], | |
70 [2.2, "box2", "left", 180, 20], | |
71 [2.2, "box3", "left", 180, 20], | |
72 [2.2, "box4", "left", 20, 20], | |
73 [0.2, "box5", "left", 40, 20], | |
74 [0.2, "box6", "left", 40, 20], | |
75 [0.2, "box7", "left", 180, 20], | |
76 [0.2, "box8", "left", 180, 20], | |
77 [2.2, "box5", "left", 40, 20], | |
78 [2.2, "box6", "left", 180, 20], | |
79 [2.2, "box7", "left", 180, 20], | |
80 [2.2, "box8", "left", 40, 20], | |
81 ]; | |
82 | |
83 runAnimationTest(expectedValues); | |
84 | |
85 </script> | |
86 </head> | |
87 <body> | |
88 <div id="box1" class="box move1 normal">2 keyframes: normal</div> | 56 <div id="box1" class="box move1 normal">2 keyframes: normal</div> |
89 <div id="box2" class="box move1 alternate">2 keyframes: alternate</div> | 57 <div id="box2" class="box move1 alternate">2 keyframes: alternate</div> |
90 <div id="box3" class="box move1 reverse">2 keyframes: reverse</div> | 58 <div id="box3" class="box move1 reverse">2 keyframes: reverse</div> |
91 <div id="box4" class="box move1 alternate-reverse">2 keyframes: alternate-revers
e</div> | 59 <div id="box4" class="box move1 alternate-reverse">2 keyframes: alternate-revers
e</div> |
92 <div id="box5" class="box move2 normal">4 keyframes: normal</div> | 60 <div id="box5" class="box move2 normal">4 keyframes: normal</div> |
93 <div id="box6" class="box move2 alternate">4 keyframes: alternate</div> | 61 <div id="box6" class="box move2 alternate">4 keyframes: alternate</div> |
94 <div id="box7" class="box move2 reverse">4 keyframes: reverse</div> | 62 <div id="box7" class="box move2 reverse">4 keyframes: reverse</div> |
95 <div id="box8" class="box move2 alternate-reverse">4 keyframes: alternate-revers
e</div> | 63 <div id="box8" class="box move2 alternate-reverse">4 keyframes: alternate-revers
e</div> |
96 <div id="result"></div> | 64 <script> |
97 </div> | 65 'use strict'; |
98 </body> | 66 test(function() { |
99 </html> | 67 box1.style.animationDelay = '-0.2s'; |
| 68 assert_equals(getComputedStyle(box1).left, '20px'); |
| 69 |
| 70 box2.style.animationDelay = '-0.2s'; |
| 71 assert_equals(getComputedStyle(box2).left, '20px'); |
| 72 |
| 73 box3.style.animationDelay = '-0.2s'; |
| 74 assert_equals(getComputedStyle(box3).left, '180px'); |
| 75 |
| 76 box4.style.animationDelay = '-0.2s'; |
| 77 assert_equals(getComputedStyle(box4).left, '180px'); |
| 78 |
| 79 |
| 80 box1.style.animationDelay = '-2.2s'; |
| 81 assert_equals(getComputedStyle(box1).left, '20px'); |
| 82 |
| 83 box2.style.animationDelay = '-2.2s'; |
| 84 assert_equals(getComputedStyle(box2).left, '180px'); |
| 85 |
| 86 box3.style.animationDelay = '-2.2s'; |
| 87 assert_equals(getComputedStyle(box3).left, '180px'); |
| 88 |
| 89 box4.style.animationDelay = '-2.2s'; |
| 90 assert_equals(getComputedStyle(box4).left, '20px'); |
| 91 |
| 92 |
| 93 box5.style.animationDelay = '-0.2s'; |
| 94 assert_equals(getComputedStyle(box5).left, '40px'); |
| 95 |
| 96 box6.style.animationDelay = '-0.2s'; |
| 97 assert_equals(getComputedStyle(box6).left, '40px'); |
| 98 |
| 99 box7.style.animationDelay = '-0.2s'; |
| 100 assert_equals(getComputedStyle(box7).left, '180px'); |
| 101 |
| 102 box8.style.animationDelay = '-0.2s'; |
| 103 assert_equals(getComputedStyle(box8).left, '180px'); |
| 104 |
| 105 |
| 106 box5.style.animationDelay = '-2.2s'; |
| 107 assert_equals(getComputedStyle(box5).left, '40px'); |
| 108 |
| 109 box6.style.animationDelay = '-2.2s'; |
| 110 assert_equals(getComputedStyle(box6).left, '180px'); |
| 111 |
| 112 box7.style.animationDelay = '-2.2s'; |
| 113 assert_equals(getComputedStyle(box7).left, '180px'); |
| 114 |
| 115 box8.style.animationDelay = '-2.2s'; |
| 116 assert_equals(getComputedStyle(box8).left, '40px'); |
| 117 }, "animation-direction works with multiple keyframes"); |
| 118 </script> |
OLD | NEW |