Index: pkg/polymer/lib/elements/web-animations-js/test/testcases/auto-test-playback-rate.html |
diff --git a/pkg/polymer/lib/elements/web-animations-js/test/testcases/auto-test-playback-rate.html b/pkg/polymer/lib/elements/web-animations-js/test/testcases/auto-test-playback-rate.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..57de8bf519db2c15b91432e2266cf3060c035d5d |
--- /dev/null |
+++ b/pkg/polymer/lib/elements/web-animations-js/test/testcases/auto-test-playback-rate.html |
@@ -0,0 +1,128 @@ |
+<!-- |
+Copyright 2012 Google Inc. All Rights Reserved. |
+ |
+Licensed under the Apache License, Version 2.0 (the "License"); |
+you may not use this file except in compliance with the License. |
+You may obtain a copy of the License at |
+ |
+ http://www.apache.org/licenses/LICENSE-2.0 |
+ |
+Unless required by applicable law or agreed to in writing, software |
+distributed under the License is distributed on an "AS IS" BASIS, |
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
+See the License for the specific language governing permissions and |
+limitations under the License. |
+--> |
+ |
+<!DOCTYPE html><meta charset="UTF-8"> |
+<style> |
+.animContainer { |
+ position: absolute; |
+ left: 0px; |
+} |
+ |
+.anim { |
+ left: 0px; |
+ width: 100px; |
+ height: 25px; |
+ background-color: lightsteelblue; |
+ position: relative; |
+} |
+ |
+#ca { |
+ top: 50px; |
+} |
+ |
+#cb { |
+ top: 250px; |
+} |
+ |
+.expectation { |
+ position: absolute; |
+ width: 100px; |
+ background: red; |
+} |
+#expectation1 { |
+ top: 50px; |
+ left: 300px; |
+ height: 175px; |
+} |
+#expectation2 { |
+ top: 250px; |
+ left: 100px; |
+ height: 150px; |
+} |
+#expectation3 { |
+ top: 400px; |
+ left: 300px; |
+ height: 25px; |
+} |
+</style> |
+ |
+<div>All movement should be at the same speed.</div> |
+ |
+<div class="expectation" id="expectation1"></div> |
+<div class="expectation" id="expectation2"></div> |
+<div class="expectation" id="expectation3"></div> |
+ |
+<div class="animContainer" id="ca"> |
+ <div class="anim a" id="a"></div> |
+ <div class="anim b" id="b"></div> |
+ <div class="anim c" id="c"></div> |
+ <div class="anim d" id="d"></div> |
+ <div class="anim e" id="e"></div> |
+ <div class="anim f" id="f"></div> |
+ <div class="anim g" id="g"></div> |
+</div> |
+ |
+<div class="animContainer" id="cb"> |
+ <div class="anim a" id="h"></div> |
+ <div class="anim b" id="i"></div> |
+ <div class="anim c" id="j"></div> |
+ <div class="anim d" id="k"></div> |
+ <div class="anim e" id="l"></div> |
+ <div class="anim f" id="m"></div> |
+ <div class="anim g" id="n"></div> |
+</div> |
+ |
+<div style="height: 450px"></div> |
+ |
+<script src="../bootstrap.js"></script> |
+<script> |
+"use strict"; |
+ |
+var containers = ["ca", "cb"]; |
+ |
+var directions = ["normal", "reverse"]; |
+var groups = []; |
+ |
+var effect100To300 = [{left: "100px"}, {left: "300px"}]; |
+var effect300To100 = [{left: "300px"}, {left: "100px"}]; |
+ |
+for (var i = 0; i < directions.length; i++) { |
+ var dir = directions[i]; |
+ groups.push(new ParGroup([], {direction: dir, duration: 3})); |
+} |
+ |
+for (var i = 0; i < containers.length; i++) { |
+ var container = document.getElementById(containers[i]); |
+ // Test basic use. |
+ groups[i].append(new Animation(container.getElementsByClassName("a")[0], |
+ effect100To300, {duration: 1.0, fill: 'forwards'})); |
+ groups[i].append(new Animation(container.getElementsByClassName("b")[0], |
+ effect100To300, {duration: 0.5, playbackRate: 0.5, fill: 'forwards'})); |
+ groups[i].append(new Animation(container.getElementsByClassName("c")[0], |
+ effect100To300, {duration: 2.0, playbackRate: 2.0, fill: 'forwards'})); |
+ // Test negative values. |
+ groups[i].append(new Animation(container.getElementsByClassName("d")[0], |
+ effect300To100, {duration: 1.0, playbackRate: -1.0, fill: 'forwards'})); |
+ groups[i].append(new Animation(container.getElementsByClassName("e")[0], |
+ effect300To100, {duration: 0.5, playbackRate: -0.5, fill: 'forwards'})); |
+ groups[i].append(new Animation(container.getElementsByClassName("f")[0], |
+ effect300To100, {duration: 2.0, playbackRate: -2.0, fill: 'forwards'})); |
+ // Test zero. |
+ groups[i].append(new Animation(container.getElementsByClassName("g")[0], |
+ effect300To100, {duration: 1.0, playbackRate: 0.0, fill: 'forwards'})); |
+ document.timeline.play(groups[i]); |
+} |
+</script> |