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 | |
18 <script> | |
19 var expected_failures = [ | |
20 { | |
21 browser_configurations: [{ firefox: true }], | |
22 tests: ['Updated style should be visible despite unrelated errors at t=5ms']
, | |
23 message: 'Issue with window sizing cause value to be zero rather then 500px.
', | |
24 }, { | |
25 browser_configurations: [{ msie: true }], | |
26 tests: ['Changing the start time of a new player to before the current time
should cause it to take effect at t=3ms'], | |
27 message: 'IE returns rgba.', | |
28 } | |
29 ]; | |
30 </script> | |
31 <script src="../bootstrap.js"></script> | |
32 <script> | |
33 "use strict"; | |
34 | |
35 var element = document.createElement('span'); | |
36 document.body.appendChild(element); | |
37 | |
38 test(function() { | |
39 element.animate([{marginLeft: '1px'}, {marginLeft: '1px'}], 1); | |
40 assert_styles(element, {marginLeft: '0px'}); | |
41 }, 'New animation should not apply within script before timeline has started.') | |
42 | |
43 timing_test(function() { | |
44 at(0, function() { | |
45 element.animate([{marginTop: '1px'}, {marginTop: '1px'}], 1); | |
46 assert_styles(element, {marginTop: '1px'}); | |
47 }); | |
48 }, 'New animation should apply within script after timeline has started.') | |
49 | |
50 timing_test(function() { | |
51 var player = element.animate([{left: '0px'}, {left: '1000px'}], 10); | |
52 at(1, function() { | |
53 assert_styles(element, {left: '100px'}); | |
54 | |
55 player.currentTime += 1; | |
56 assert_styles(element, {left: '200px'}); | |
57 }); | |
58 }, 'Updated style should be visible after player seek'); | |
59 | |
60 timing_test(function() { | |
61 var player = element.animate([{top: '0px'}, {top: '1000px'}], 10); | |
62 at(1, function() { | |
63 assert_styles(element, {top: '100px'}); | |
64 | |
65 player.source.timing.delay = -1; | |
66 assert_styles(element, {top: '200px'}); | |
67 }); | |
68 }, 'Updated style should be visible after change to specified timing'); | |
69 | |
70 var group = new AnimationSequence([ | |
71 new Animation(element, {}, 1), | |
72 new Animation(element, [{right: '0px'}, {right: '1000px'}], 10), | |
73 ]); | |
74 document.timeline.play(group); | |
75 timing_test(function() { | |
76 at(2, function() { | |
77 assert_styles(element, {right: '100px'}); | |
78 | |
79 group.children[0].timing.duration = 0.5; | |
80 assert_styles(element, {right: '150px'}); | |
81 | |
82 group.children[0].remove(); | |
83 assert_styles(element, {right: '200px'}); | |
84 }); | |
85 }, 'Updated style should be visible after change to animation tree'); | |
86 | |
87 timing_test(function() { | |
88 at(3, function() { | |
89 var player = element.animate([{color: 'red'}, {color: 'green'}, {color: 'red
'}], 1); | |
90 assert_equals(player.startTime, 3); | |
91 assert_styles(element, {color: 'red'}); | |
92 | |
93 player.startTime -= 0.5; | |
94 assert_styles(element, {color: 'green'}); | |
95 }); | |
96 }, 'Changing the start time of a new player to before the current time should ca
use it to take effect'); | |
97 | |
98 var player2 = element.animate([{bottom: '0px'}, {bottom: '1000px'}], 10); | |
99 // Run this last, since if it fails it's likely to corrupt the other tests. | |
100 timing_test(function() { | |
101 at(5, function() { | |
102 assert_styles(element, {bottom: '500px'}); | |
103 | |
104 try { | |
105 var group = new AnimationGroup(); | |
106 group.append(group); | |
107 } catch (e) { | |
108 } | |
109 player2.source.timing.delay = -1; | |
110 assert_styles(element, {bottom: '600px'}); | |
111 }); | |
112 }, 'Updated style should be visible despite unrelated errors'); | |
113 </script> | |
OLD | NEW |