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 '/.* t=(3|5)s/': { |
| 21 msie: true, |
| 22 message: "IE returns rgba not rga." |
| 23 } |
| 24 }; |
| 25 </script> |
| 26 <script src="../bootstrap.js"></script> |
| 27 <script> |
| 28 "use strict"; |
| 29 |
| 30 |
| 31 document.timeline.play(new Animation(null, {}, |
| 32 {duration: 1, fill: 'forwards'})); |
| 33 document.timeline.play(new Animation(null, {}, |
| 34 {duration: 1, fill: 'none'})); |
| 35 var player = document.timeline.play(new Animation(anim, |
| 36 [{backgroundColor: 'red'}, {backgroundColor: 'white'}], |
| 37 {duration: 1, fill: 'none'})); |
| 38 |
| 39 timing_test(function() { |
| 40 at(0.5, function() { |
| 41 assert_equals(document.timeline.getCurrentPlayers().length, 3, |
| 42 "All animations current"); |
| 43 assert_equals(_WebAnimationsTestingUtilities._knownPlayers.lengt
h, 3, |
| 44 "All animations known"); |
| 45 }); |
| 46 at(2, function() { |
| 47 assert_equals(document.timeline.getCurrentPlayers().length, 0, |
| 48 "No animations current"); |
| 49 assert_equals(_WebAnimationsTestingUtilities._knownPlayers.lengt
h, 1, |
| 50 "Only animations with forward fill known"); |
| 51 }); |
| 52 at(3, function() { |
| 53 player.currentTime = 0; |
| 54 assert_equals(document.timeline.getCurrentPlayers().length, 1, |
| 55 "Only restarted animation current"); |
| 56 assert_equals(_WebAnimationsTestingUtilities._knownPlayers.lengt
h, 2, |
| 57 "Restarted and forward filling animations known"); |
| 58 assert_styles('#anim', [{"backgroundColor": 'rgb(255, 0, 0)'}], |
| 59 "takes effect immediately"); |
| 60 }); |
| 61 at(3.5, function() { |
| 62 assert_equals(document.timeline.getCurrentPlayers().length, 1, |
| 63 "Only restarted animation current"); |
| 64 assert_equals(_WebAnimationsTestingUtilities._knownPlayers.lengt
h, 2, |
| 65 "Restarted and forward filling animations known"); |
| 66 }) |
| 67 |
| 68 at(5, function() { |
| 69 player.source.specified.duration = 4; |
| 70 assert_equals(document.timeline.getCurrentPlayers().length, 1, |
| 71 "Only restarted animation current"); |
| 72 assert_equals(_WebAnimationsTestingUtilities._knownPlayers.lengt
h, 2, |
| 73 "Restarted and forward filling animations known"); |
| 74 assert_styles('#anim', [{"backgroundColor": 'rgb(255, 64, 64)'}]
, |
| 75 "takes effect immediately"); |
| 76 }); |
| 77 }); |
| 78 </script> |
OLD | NEW |