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

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

Issue 19744002: Web Animations: Add CSSAnimatableValueFactory API (partial implementation) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Move folders and add const to param Created 7 years, 4 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 | Annotate | Revision Log
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 13 matching lines...) Expand all
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "core/animation/KeyframeAnimationEffect.h" 32 #include "core/animation/KeyframeAnimationEffect.h"
33 33
34 #include "core/animation/AnimatableNumber.h"
35 #include "core/animation/AnimatableUnknown.h"
34 #include "core/css/CSSPrimitiveValue.h" 36 #include "core/css/CSSPrimitiveValue.h"
35 #include <gtest/gtest.h> 37 #include <gtest/gtest.h>
36 38
37 using namespace WebCore; 39 using namespace WebCore;
38 40
39 namespace { 41 namespace {
40 42
41 AnimatableValue* unknownAnimatableValue(double n) 43 AnimatableValue* unknownAnimatableValue(double n)
42 { 44 {
43 return AnimatableValue::create(CSSPrimitiveValue::create(n, CSSPrimitiveValu e::CSS_UNKNOWN).get()).leakRef(); 45 return AnimatableUnknown::create(CSSPrimitiveValue::create(n, CSSPrimitiveVa lue::CSS_UNKNOWN).get()).leakRef();
44 } 46 }
45 47
46 AnimatableValue* pixelAnimatableValue(double n) 48 AnimatableValue* pixelAnimatableValue(double n)
47 { 49 {
48 return AnimatableValue::create(CSSPrimitiveValue::create(n, CSSPrimitiveValu e::CSS_PX).get()).leakRef(); 50 return AnimatableNumber::create(CSSPrimitiveValue::create(n, CSSPrimitiveVal ue::CSS_PX).get()).leakRef();
49 } 51 }
50 52
51 KeyframeAnimationEffect::KeyframeVector keyframesAtZeroAndOne(AnimatableValue* z eroValue, AnimatableValue* oneValue) 53 KeyframeAnimationEffect::KeyframeVector keyframesAtZeroAndOne(AnimatableValue* z eroValue, AnimatableValue* oneValue)
52 { 54 {
53 KeyframeAnimationEffect::KeyframeVector keyframes(2); 55 KeyframeAnimationEffect::KeyframeVector keyframes(2);
54 keyframes[0] = Keyframe::create(); 56 keyframes[0] = Keyframe::create();
55 keyframes[0]->setOffset(0.0); 57 keyframes[0]->setOffset(0.0);
56 keyframes[0]->setPropertyValue(CSSPropertyLeft, zeroValue); 58 keyframes[0]->setPropertyValue(CSSPropertyLeft, zeroValue);
57 keyframes[1] = Keyframe::create(); 59 keyframes[1] = Keyframe::create();
58 keyframes[1]->setOffset(1.0); 60 keyframes[1]->setOffset(1.0);
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 TEST(KeyframeAnimationEffect, MultipleIterations) 327 TEST(KeyframeAnimationEffect, MultipleIterations)
326 { 328 {
327 KeyframeAnimationEffect::KeyframeVector keyframes = keyframesAtZeroAndOne(pi xelAnimatableValue(1.0), pixelAnimatableValue(3.0)); 329 KeyframeAnimationEffect::KeyframeVector keyframes = keyframesAtZeroAndOne(pi xelAnimatableValue(1.0), pixelAnimatableValue(3.0));
328 RefPtr<KeyframeAnimationEffect> effect = KeyframeAnimationEffect::create(key frames); 330 RefPtr<KeyframeAnimationEffect> effect = KeyframeAnimationEffect::create(key frames);
329 expectDoubleValue(2.0, effect->sample(0, 0.5)->begin()->value->compositeOnto (unknownAnimatableValue(0.0))); 331 expectDoubleValue(2.0, effect->sample(0, 0.5)->begin()->value->compositeOnto (unknownAnimatableValue(0.0)));
330 expectDoubleValue(2.0, effect->sample(1, 0.5)->begin()->value->compositeOnto (unknownAnimatableValue(0.0))); 332 expectDoubleValue(2.0, effect->sample(1, 0.5)->begin()->value->compositeOnto (unknownAnimatableValue(0.0)));
331 expectDoubleValue(2.0, effect->sample(2, 0.5)->begin()->value->compositeOnto (unknownAnimatableValue(0.0))); 333 expectDoubleValue(2.0, effect->sample(2, 0.5)->begin()->value->compositeOnto (unknownAnimatableValue(0.0)));
332 } 334 }
333 335
334 } // namespace 336 } // namespace
OLDNEW
« no previous file with comments | « Source/core/animation/AnimatableValue.cpp ('k') | Source/core/animation/css/CSSAnimatableValueFactory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698