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 |
| 17 <!DOCTYPE html><meta charset="UTF-8"> |
| 18 <style> |
| 19 div.anim { |
| 20 position: relative; |
| 21 left: 0px; |
| 22 } |
| 23 </style> |
| 24 |
| 25 <div id="anim" class="anim"></div> |
| 26 |
| 27 <script src="../bootstrap.js"></script> |
| 28 <script> |
| 29 "use strict"; |
| 30 |
| 31 var effect = [{left: "100px"}, {left: "200px"}]; |
| 32 |
| 33 var testPauseUnpause = function(name, player) { |
| 34 player.currentTime = 5.0; |
| 35 player.paused = true; |
| 36 test(function() {assert_equals(player.currentTime, 5.0)}, |
| 37 name + " Player.currentTime should be unaffected by pausing"); |
| 38 player.paused = false; |
| 39 test(function() {assert_equals(player.currentTime, 5.0)}, |
| 40 name + " Player.currentTime should be unaffected by unpausing"); |
| 41 }; |
| 42 |
| 43 // Test that a Player's currentTime is correct after pausing and unpausing, |
| 44 // with a zero startTime. |
| 45 addEventListener("load", function() { |
| 46 testPauseUnpause("zero starttime,", document.timeline.play(new Animation( |
| 47 document.getElementById("anim"), effect, 1.0))); |
| 48 |
| 49 }); |
| 50 |
| 51 // Test that a Player's currentTime is correct after pausing and unpausing, with |
| 52 // a non-zero startTime. |
| 53 addEventListener("load", function() { |
| 54 var player = document.timeline.play(new Animation( |
| 55 document.getElementById("anim"), effect, 1.0)); |
| 56 test(function() {assert_equals(player.startTime > 0, true)}, |
| 57 "Player has started"); |
| 58 testPauseUnpause("non-zero starttime,", player); |
| 59 }); |
| 60 |
| 61 // TODO: Test pausing and unpausing with a forced currentTime while the |
| 62 // Timeline is not started. See |
| 63 // https://github.com/web-animations/web-animations-js/issues/167 |
| 64 |
| 65 // FIXME! - Make this actually test something... |
| 66 test(function() { assert_true(true); }, "Dummy test"); |
| 67 |
| 68 </script> |
OLD | NEW |