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 <div id="anim"></div> |
| 19 |
| 20 <script src="../bootstrap.js"></script> |
| 21 <script> |
| 22 "use strict"; |
| 23 |
| 24 var anim = new Animation(document.getElementById("anim"), {left: "100px"}, |
| 25 {iterations: 3.0}); |
| 26 var parGroup = new ParGroup(); |
| 27 var seqGroup = new SeqGroup(); |
| 28 |
| 29 // Should use intrinsic duration if Timing.duration is undefined. |
| 30 // Animation |
| 31 test(function() {assert_equals(anim.duration, 0.0)}, |
| 32 "Animation duration should use intrinsic value"); |
| 33 anim.specified.duration = 1.0; |
| 34 test(function() {assert_equals(anim.duration, 1.0)}, |
| 35 "Animation duration should use specified value"); |
| 36 // ParGroup |
| 37 test(function() {assert_equals(parGroup.duration, 0.0)}, |
| 38 "ParGroup duration should use intrinsic value"); |
| 39 parGroup.append(anim); |
| 40 test(function() {assert_equals(parGroup.duration, 3.0)}, |
| 41 "ParGroup duration should be derived from child"); |
| 42 parGroup.specified.duration = 2.0; |
| 43 test(function() {assert_equals(parGroup.duration, 2.0)}, |
| 44 "ParGroup duration should use specified value"); |
| 45 // SeqGroup |
| 46 test(function() {assert_equals(seqGroup.duration, 0.0)}, |
| 47 "SeqGroup duration should use intrinsic value"); |
| 48 seqGroup.append(anim); |
| 49 test(function() {assert_equals(seqGroup.duration, 3.0)}, |
| 50 "SeqGroup duration should be derived from child"); |
| 51 seqGroup.specified.duration = 4.0; |
| 52 test(function() {assert_equals(seqGroup.duration, 4.0)}, |
| 53 "SeqGroup duration should use specified value"); |
| 54 |
| 55 test(function() { |
| 56 assert_throws(new TypeError(), function() { |
| 57 anim.duration = 5.0; |
| 58 }); |
| 59 assert_equals(anim.duration, 1.0); |
| 60 }, "Animation.duration should be read-only"); |
| 61 |
| 62 anim.specified.duration = 14.0; |
| 63 test(function() {assert_equals(anim.activeDuration, 42.0)}, |
| 64 "activeDuration should always reflect TimedItem.duration"); |
| 65 |
| 66 </script> |
OLD | NEW |