OLD | NEW |
| (Empty) |
1 <!-- | |
2 Copyright 2013 Google Inc. All Rights Reserved. | |
3 | |
4 Licensed under the Apache License, Version 2.0 (the "License"); | |
5 you may not use this file except in compliance with the License. | |
6 You may obtain a copy of the License at | |
7 | |
8 http://www.apache.org/licenses/LICENSE-2.0 | |
9 | |
10 Unless required by applicable law or agreed to in writing, software | |
11 distributed under the License is distributed on an "AS IS" BASIS, | |
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 See the License for the specific language governing permissions and | |
14 limitations under the License. | |
15 --> | |
16 <!DOCTYPE html><meta charset="UTF-8"> | |
17 <div id='anim'></div> | |
18 <script> | |
19 var expected_failures = [ | |
20 { | |
21 browser_configurations: [{ msie: true }], | |
22 tests: ['t=(3|5)s'], | |
23 message: 'IE returns rgba.', | |
24 } | |
25 ]; | |
26 </script> | |
27 <script src="../bootstrap.js"></script> | |
28 <script> | |
29 "use strict"; | |
30 | |
31 | |
32 document.timeline.play(new Animation(null, {}, | |
33 {duration: 1, fill: 'forwards'})); | |
34 document.timeline.play(new Animation(null, {}, | |
35 {duration: 1, fill: 'none'})); | |
36 var player = document.timeline.play(new Animation(anim, | |
37 [{backgroundColor: 'red'}, {backgroundColor: 'white'}], | |
38 {duration: 1, fill: 'none'})); | |
39 | |
40 timing_test(function() { | |
41 at(0.5, function() { | |
42 assert_equals(document.timeline.getCurrentPlayers().length, 3, | |
43 "All animations current"); | |
44 assert_equals(_WebAnimationsTestingUtilities._knownPlayers.lengt
h, 3, | |
45 "All animations known"); | |
46 }); | |
47 at(2, function() { | |
48 assert_equals(document.timeline.getCurrentPlayers().length, 0, | |
49 "No animations current"); | |
50 assert_equals(_WebAnimationsTestingUtilities._knownPlayers.lengt
h, 1, | |
51 "Only animations with forward fill known"); | |
52 }); | |
53 at(3, function() { | |
54 player.currentTime = 0; | |
55 assert_equals(document.timeline.getCurrentPlayers().length, 1, | |
56 "Only restarted animation current"); | |
57 assert_equals(_WebAnimationsTestingUtilities._knownPlayers.lengt
h, 2, | |
58 "Restarted and forward filling animations known"); | |
59 assert_styles('#anim', [{"backgroundColor": 'rgb(255, 0, 0)'}], | |
60 "takes effect immediately"); | |
61 }); | |
62 at(3.5, function() { | |
63 assert_equals(document.timeline.getCurrentPlayers().length, 1, | |
64 "Only restarted animation current"); | |
65 assert_equals(_WebAnimationsTestingUtilities._knownPlayers.lengt
h, 2, | |
66 "Restarted and forward filling animations known"); | |
67 }) | |
68 | |
69 at(5, function() { | |
70 player.source.timing.duration = 4; | |
71 assert_equals(document.timeline.getCurrentPlayers().length, 1, | |
72 "Only restarted animation current"); | |
73 assert_equals(_WebAnimationsTestingUtilities._knownPlayers.lengt
h, 2, | |
74 "Restarted and forward filling animations known"); | |
75 assert_styles('#anim', [{"backgroundColor": 'rgb(255, 64, 64)'}]
, | |
76 "takes effect immediately"); | |
77 }); | |
78 }); | |
79 </script> | |
OLD | NEW |