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

Side by Side Diff: Source/core/animation/TimedItemCalculationsTest.cpp

Issue 149363002: Web Animations API: Implement step-middle and steps(x, middle) timing functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove class in BisonCSSParserTest and change to new license text 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013, Google Inc. All rights reserved. 2 * Copyright (c) 2013, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 // calculateTransformedTime(currentIteration, iterationDuration, iterationTi me, timing) 190 // calculateTransformedTime(currentIteration, iterationDuration, iterationTi me, timing)
191 191
192 // Iteration time is null 192 // Iteration time is null
193 EXPECT_TRUE(isNull(calculateTransformedTime(1, 2, nullValue(), timing))); 193 EXPECT_TRUE(isNull(calculateTransformedTime(1, 2, nullValue(), timing)));
194 194
195 // PlaybackDirectionForwards 195 // PlaybackDirectionForwards
196 EXPECT_EQ(12, calculateTransformedTime(0, 20, 12, timing)); 196 EXPECT_EQ(12, calculateTransformedTime(0, 20, 12, timing));
197 EXPECT_EQ(12, calculateTransformedTime(1, 20, 12, timing)); 197 EXPECT_EQ(12, calculateTransformedTime(1, 20, 12, timing));
198 198
199 // PlaybackDirectionForwards with timing function 199 // PlaybackDirectionForwards with timing function
200 timing.timingFunction = StepsTimingFunction::create(4, false /* stepAtStart */); 200 timing.timingFunction = StepsTimingFunction::create(4, StepsTimingFunction:: StepAtEnd);
201 EXPECT_EQ(10, calculateTransformedTime(0, 20, 12, timing)); 201 EXPECT_EQ(10, calculateTransformedTime(0, 20, 12, timing));
202 EXPECT_EQ(10, calculateTransformedTime(1, 20, 12, timing)); 202 EXPECT_EQ(10, calculateTransformedTime(1, 20, 12, timing));
203 203
204 // PlaybackDirectionReverse 204 // PlaybackDirectionReverse
205 timing.timingFunction = 0; 205 timing.timingFunction = 0;
206 timing.direction = Timing::PlaybackDirectionReverse; 206 timing.direction = Timing::PlaybackDirectionReverse;
207 EXPECT_EQ(8, calculateTransformedTime(0, 20, 12, timing)); 207 EXPECT_EQ(8, calculateTransformedTime(0, 20, 12, timing));
208 EXPECT_EQ(8, calculateTransformedTime(1, 20, 12, timing)); 208 EXPECT_EQ(8, calculateTransformedTime(1, 20, 12, timing));
209 209
210 // PlaybackDirectionReverse with timing function 210 // PlaybackDirectionReverse with timing function
211 timing.timingFunction = StepsTimingFunction::create(4, false /* stepAtStart */); 211 timing.timingFunction = StepsTimingFunction::create(4, StepsTimingFunction:: StepAtEnd);
212 EXPECT_EQ(5, calculateTransformedTime(0, 20, 12, timing)); 212 EXPECT_EQ(5, calculateTransformedTime(0, 20, 12, timing));
213 EXPECT_EQ(5, calculateTransformedTime(1, 20, 12, timing)); 213 EXPECT_EQ(5, calculateTransformedTime(1, 20, 12, timing));
214 214
215 // Timing function when directed time is null. 215 // Timing function when directed time is null.
216 EXPECT_TRUE(isNull(calculateTransformedTime(1, 2, nullValue(), timing))); 216 EXPECT_TRUE(isNull(calculateTransformedTime(1, 2, nullValue(), timing)));
217 217
218 // Timing function when iterationDuration is infinity 218 // Timing function when iterationDuration is infinity
219 timing.direction = Timing::PlaybackDirectionNormal; 219 timing.direction = Timing::PlaybackDirectionNormal;
220 EXPECT_EQ(0, calculateTransformedTime(0, std::numeric_limits<double>::infini ty(), 0, timing)); 220 EXPECT_EQ(0, calculateTransformedTime(0, std::numeric_limits<double>::infini ty(), 0, timing));
221 EXPECT_EQ(1, calculateTransformedTime(0, std::numeric_limits<double>::infini ty(), 1, timing)); 221 EXPECT_EQ(1, calculateTransformedTime(0, std::numeric_limits<double>::infini ty(), 1, timing));
222 timing.direction = Timing::PlaybackDirectionReverse; 222 timing.direction = Timing::PlaybackDirectionReverse;
223 EXPECT_EQ(std::numeric_limits<double>::infinity(), calculateTransformedTime( 0, std::numeric_limits<double>::infinity(), 0, timing)); 223 EXPECT_EQ(std::numeric_limits<double>::infinity(), calculateTransformedTime( 0, std::numeric_limits<double>::infinity(), 0, timing));
224 EXPECT_EQ(std::numeric_limits<double>::infinity(), calculateTransformedTime( 0, std::numeric_limits<double>::infinity(), 1, timing)); 224 EXPECT_EQ(std::numeric_limits<double>::infinity(), calculateTransformedTime( 0, std::numeric_limits<double>::infinity(), 1, timing));
225 } 225 }
226 226
227 } 227 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698