OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <meta charset=utf-8> | 2 <meta charset=utf-8> |
3 <title>Tests for phases and states</title> | 3 <title>Tests for phases and states</title> |
4 <link rel="help" href="https://w3c.github.io/web-animations/#animation-effect-ph
ases-and-states"> | 4 <link rel="help" href="https://w3c.github.io/web-animations/#animation-effect-ph
ases-and-states"> |
5 <script src="/resources/testharness.js"></script> | 5 <script src="/resources/testharness.js"></script> |
6 <script src="/resources/testharnessreport.js"></script> | 6 <script src="/resources/testharnessreport.js"></script> |
7 <script src="../../testcommon.js"></script> | 7 <script src="../../testcommon.js"></script> |
8 <body> | 8 <body> |
9 <div id="log"></div> | 9 <div id="log"></div> |
10 <script> | 10 <script> |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 { currentTime: 2, phase: 'after' } ] | 66 { currentTime: 2, phase: 'after' } ] |
67 .forEach(function(test) { | 67 .forEach(function(test) { |
68 assert_phase_at_time(animation, test.phase, test.currentTime); | 68 assert_phase_at_time(animation, test.phase, test.currentTime); |
69 }); | 69 }); |
70 }, 'Phase calculation for an animation effect with a positive start delay'); | 70 }, 'Phase calculation for an animation effect with a positive start delay'); |
71 | 71 |
72 test(function(t) { | 72 test(function(t) { |
73 var animation = createDiv(t).animate(null, { duration: 1, delay: -1 }); | 73 var animation = createDiv(t).animate(null, { duration: 1, delay: -1 }); |
74 | 74 |
75 [ { currentTime: -2, phase: 'before' }, | 75 [ { currentTime: -2, phase: 'before' }, |
76 { currentTime: -1, phase: 'active' }, | 76 { currentTime: -1, phase: 'before' }, |
77 { currentTime: 0, phase: 'after' } ] | 77 { currentTime: 0, phase: 'after' } ] |
78 .forEach(function(test) { | 78 .forEach(function(test) { |
79 assert_phase_at_time(animation, test.phase, test.currentTime); | 79 assert_phase_at_time(animation, test.phase, test.currentTime); |
80 }); | 80 }); |
81 }, 'Phase calculation for an animation effect with a negative start delay'); | 81 }, 'Phase calculation for an animation effect with a negative start delay'); |
82 | 82 |
83 test(function(t) { | 83 test(function(t) { |
84 var animation = createDiv(t).animate(null, { duration: 1, endDelay: 1 }); | 84 var animation = createDiv(t).animate(null, { duration: 1, endDelay: 1 }); |
85 | 85 |
86 [ { currentTime: -1, phase: 'before' }, | 86 [ { currentTime: -1, phase: 'before' }, |
(...skipping 27 matching lines...) Expand all Loading... |
114 .forEach(function(test) { | 114 .forEach(function(test) { |
115 assert_phase_at_time(animation, test.phase, test.currentTime); | 115 assert_phase_at_time(animation, test.phase, test.currentTime); |
116 }); | 116 }); |
117 }, 'Phase calculation for an animation effect with a negative end delay equal' | 117 }, 'Phase calculation for an animation effect with a negative end delay equal' |
118 + ' in magnitude to the active duration'); | 118 + ' in magnitude to the active duration'); |
119 | 119 |
120 test(function(t) { | 120 test(function(t) { |
121 var animation = createDiv(t).animate(null, { duration: 1, endDelay: -2 }); | 121 var animation = createDiv(t).animate(null, { duration: 1, endDelay: -2 }); |
122 | 122 |
123 [ { currentTime: -2, phase: 'before' }, | 123 [ { currentTime: -2, phase: 'before' }, |
124 { currentTime: -1, phase: 'after' } ] | 124 { currentTime: -1, phase: 'before' }, |
| 125 { currentTime: 0, phase: 'after' } ] |
125 .forEach(function(test) { | 126 .forEach(function(test) { |
126 assert_phase_at_time(animation, test.phase, test.currentTime); | 127 assert_phase_at_time(animation, test.phase, test.currentTime); |
127 }); | 128 }); |
128 }, 'Phase calculation for an animation effect with a negative end delay' | 129 }, 'Phase calculation for an animation effect with a negative end delay' |
129 + ' greater in magnitude than the active duration'); | 130 + ' greater in magnitude than the active duration'); |
130 | 131 |
131 test(function(t) { | 132 test(function(t) { |
132 var animation = createDiv(t).animate(null, { duration: 2, | 133 var animation = createDiv(t).animate(null, { duration: 2, |
133 delay: 1, | 134 delay: 1, |
134 endDelay: -1 }); | 135 endDelay: -1 }); |
135 | 136 |
136 [ { currentTime: 0, phase: 'before' }, | 137 [ { currentTime: 0, phase: 'before' }, |
137 { currentTime: 1, phase: 'active' }, | 138 { currentTime: 1, phase: 'active' }, |
138 { currentTime: 2, phase: 'after' } ] | 139 { currentTime: 2, phase: 'after' } ] |
139 .forEach(function(test) { | 140 .forEach(function(test) { |
140 assert_phase_at_time(animation, test.phase, test.currentTime); | 141 assert_phase_at_time(animation, test.phase, test.currentTime); |
141 }); | 142 }); |
142 }, 'Phase calculation for an animation effect with a positive start delay' | 143 }, 'Phase calculation for an animation effect with a positive start delay' |
143 + ' and a negative end delay lesser in magnitude than the active duration'); | 144 + ' and a negative end delay lesser in magnitude than the active duration'); |
144 | 145 |
145 test(function(t) { | 146 test(function(t) { |
146 var animation = createDiv(t).animate(null, { duration: 1, | 147 var animation = createDiv(t).animate(null, { duration: 1, |
147 delay: -1, | 148 delay: -1, |
148 endDelay: -1 }); | 149 endDelay: -1 }); |
149 | 150 |
150 [ { currentTime: -2, phase: 'before' }, | 151 [ { currentTime: -2, phase: 'before' }, |
151 { currentTime: -1, phase: 'after' } ] | 152 { currentTime: -1, phase: 'before' }, |
| 153 { currentTime: 0, phase: 'after' } ] |
152 .forEach(function(test) { | 154 .forEach(function(test) { |
153 assert_phase_at_time(animation, test.phase, test.currentTime); | 155 assert_phase_at_time(animation, test.phase, test.currentTime); |
154 }); | 156 }); |
155 }, 'Phase calculation for an animation effect with a negative start delay' | 157 }, 'Phase calculation for an animation effect with a negative start delay' |
156 + ' and a negative end delay equal in magnitude to the active duration'); | 158 + ' and a negative end delay equal in magnitude to the active duration'); |
157 | 159 |
158 test(function(t) { | 160 test(function(t) { |
159 var animation = createDiv(t).animate(null, { duration: 1, | 161 var animation = createDiv(t).animate(null, { duration: 1, |
160 delay: -1, | 162 delay: -1, |
161 endDelay: -2 }); | 163 endDelay: -2 }); |
162 | 164 |
163 [ { currentTime: -3, phase: 'before' }, | 165 [ { currentTime: -3, phase: 'before' }, |
164 { currentTime: -2, phase: 'after' } ] | 166 { currentTime: -2, phase: 'before' }, |
| 167 { currentTime: -1, phase: 'before' }, |
| 168 { currentTime: 0, phase: 'after' } ] |
165 .forEach(function(test) { | 169 .forEach(function(test) { |
166 assert_phase_at_time(animation, test.phase, test.currentTime); | 170 assert_phase_at_time(animation, test.phase, test.currentTime); |
167 }); | 171 }); |
168 }, 'Phase calculation for an animation effect with a negative start delay' | 172 }, 'Phase calculation for an animation effect with a negative start delay' |
169 + ' and a negative end delay equal greater in magnitude than the active' | 173 + ' and a negative end delay equal greater in magnitude than the active' |
170 + ' duration'); | 174 + ' duration'); |
171 | 175 |
172 test(function(t) { | 176 test(function(t) { |
173 var animation = createDiv(t).animate(null, 1); | 177 var animation = createDiv(t).animate(null, 1); |
174 animation.playbackRate = -1; | 178 animation.playbackRate = -1; |
175 | 179 |
176 [ { currentTime: -1, phase: 'before' }, | 180 [ { currentTime: -1, phase: 'before' }, |
177 { currentTime: 0, phase: 'before' }, | 181 { currentTime: 0, phase: 'before' }, |
178 { currentTime: 1, phase: 'active' }, | 182 { currentTime: 1, phase: 'active' }, |
179 { currentTime: 2, phase: 'after' } ] | 183 { currentTime: 2, phase: 'after' } ] |
180 .forEach(function(test) { | 184 .forEach(function(test) { |
181 assert_phase_at_time(animation, test.phase, test.currentTime); | 185 assert_phase_at_time(animation, test.phase, test.currentTime); |
182 }); | 186 }); |
183 }, 'Phase calculation for a simple animation effect with negative playback' | 187 }, 'Phase calculation for a simple animation effect with negative playback' |
184 + ' rate'); | 188 + ' rate'); |
185 | 189 |
186 </script> | 190 </script> |
187 </body> | 191 </body> |
OLD | NEW |