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

Side by Side Diff: bower_components/web-animations-js/test/testcases/impl-test-paced-timing-function.html

Issue 786953007: npm_modules: Fork bower_components into Polymer 0.4.0 and 0.5.0 versions (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Created 5 years, 11 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 unified diff | Download patch
OLDNEW
(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
19 <svg xmlns="http://www.w3.org/2000/svg" version="1.1">
20 <path d="M0,0 L10,0 L30,0 L60,0 L100,0 L150,0" id="path" stroke="black"
21 stroke-width="1" fill="none" />
22 </svg>
23
24 <script src="../bootstrap.js"></script>
25 <script>
26 "use strict";
27
28 var PacedTimingFunction = _WebAnimationsTestingUtilities._pacedTimingFunction;
29
30 var effect =
31 new MotionPathEffect(document.querySelector('#path').pathSegList);
32
33 // Line has 5 segments of lengths 10, 20, 30, 40 and 50, giving a total length
34 // of 150.
35 var fullRangeTimingFunction = new PacedTimingFunction(effect);
36 fullRangeTimingFunction.setRange({min: 0, max: 1});
37
38 // Partial range runs from midpoint of first segment ot midpoint of last
39 // segment, giving total length of 5 + 20 + 30 + 40 + 25 = 120.
40 var partialRangeTimingFunction = new PacedTimingFunction(effect);
41 partialRangeTimingFunction.setRange({min: 0.1, max: 0.9});
42
43 test(function() {
44 assert_equals(fullRangeTimingFunction.scaleTime(0.5), (3 + 15/40) / 5);
45 }, 'Full range between bounds');
46
47 test(function() {
48 assert_equals(fullRangeTimingFunction.scaleTime(0), 0);
49 }, 'Full range lower bound');
50
51 test(function() {
52 assert_equals(fullRangeTimingFunction.scaleTime(1), 1);
53 }, 'Full range upper bound');
54
55 test(function() {
56 assert_equals(fullRangeTimingFunction.scaleTime(-0.5), 0);
57 }, 'Full range below lower bound');
58
59 test(function() {
60 assert_equals(fullRangeTimingFunction.scaleTime(1.5), 1);
61 }, 'Full range above upper bound');
62
63 test(function() {
64 assert_equals(partialRangeTimingFunction.scaleTime(0.5), (3 + 5/40) / 5);
65 }, 'Partial range between bounds');
66
67 test(function() {
68 assert_equals(partialRangeTimingFunction.scaleTime(0), 0.1);
69 }, 'Partial range lower bound');
70
71 test(function() {
72 assert_equals(partialRangeTimingFunction.scaleTime(1), 0.9);
73 }, 'Partial range upper bound');
74
75 test(function() {
76 assert_equals(partialRangeTimingFunction.scaleTime(-0.5), 0.1);
77 }, 'Partial range below lower bound');
78
79 test(function() {
80 assert_equals(partialRangeTimingFunction.scaleTime(1.5), 0.9);
81 }, 'Partial range above upper bound');
82
83 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698