Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(764)

Unified Diff: pkg/polymer/lib/elements/web-animations-js/test/testcases/impl-test-paced-timing-function.html

Issue 175443005: [polymer] import all elements (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: updated from bower Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/polymer/lib/elements/web-animations-js/test/testcases/impl-test-paced-timing-function.html
diff --git a/pkg/polymer/lib/elements/web-animations-js/test/testcases/impl-test-paced-timing-function.html b/pkg/polymer/lib/elements/web-animations-js/test/testcases/impl-test-paced-timing-function.html
new file mode 100644
index 0000000000000000000000000000000000000000..0e8aa15bf3e5ee8106ab2e669914dbbfa5bf2a94
--- /dev/null
+++ b/pkg/polymer/lib/elements/web-animations-js/test/testcases/impl-test-paced-timing-function.html
@@ -0,0 +1,83 @@
+<!--
+Copyright 2013 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">
+
+<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
+ <path d="M0,0 L10,0 L30,0 L60,0 L100,0 L150,0" id="path" stroke="black"
+ stroke-width="1" fill="none" />
+</svg>
+
+<script src="../bootstrap.js"></script>
+<script>
+"use strict";
+
+var PacedTimingFunction = _WebAnimationsTestingUtilities._pacedTimingFunction;
+
+var effect =
+ new MotionPathEffect(document.querySelector('#path').pathSegList);
+
+// Line has 5 segments of lengths 10, 20, 30, 40 and 50, giving a total length
+// of 150.
+var fullRangeTimingFunction = new PacedTimingFunction(effect);
+fullRangeTimingFunction.setRange({min: 0, max: 1});
+
+// Partial range runs from midpoint of first segment ot midpoint of last
+// segment, giving total length of 5 + 20 + 30 + 40 + 25 = 120.
+var partialRangeTimingFunction = new PacedTimingFunction(effect);
+partialRangeTimingFunction.setRange({min: 0.1, max: 0.9});
+
+test(function() {
+ assert_equals(fullRangeTimingFunction.scaleTime(0.5), (3 + 15/40) / 5);
+}, 'Full range between bounds');
+
+test(function() {
+ assert_equals(fullRangeTimingFunction.scaleTime(0), 0);
+}, 'Full range lower bound');
+
+test(function() {
+ assert_equals(fullRangeTimingFunction.scaleTime(1), 1);
+}, 'Full range upper bound');
+
+test(function() {
+ assert_equals(fullRangeTimingFunction.scaleTime(-0.5), 0);
+}, 'Full range below lower bound');
+
+test(function() {
+ assert_equals(fullRangeTimingFunction.scaleTime(1.5), 1);
+}, 'Full range above upper bound');
+
+test(function() {
+ assert_equals(partialRangeTimingFunction.scaleTime(0.5), (3 + 5/40) / 5);
+}, 'Partial range between bounds');
+
+test(function() {
+ assert_equals(partialRangeTimingFunction.scaleTime(0), 0.1);
+}, 'Partial range lower bound');
+
+test(function() {
+ assert_equals(partialRangeTimingFunction.scaleTime(1), 0.9);
+}, 'Partial range upper bound');
+
+test(function() {
+ assert_equals(partialRangeTimingFunction.scaleTime(-0.5), 0.1);
+}, 'Partial range below lower bound');
+
+test(function() {
+ assert_equals(partialRangeTimingFunction.scaleTime(1.5), 0.9);
+}, 'Partial range above upper bound');
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698