OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/animation/KeyframeEffect.h" | 5 #include "core/animation/KeyframeEffect.h" |
6 | 6 |
7 #include "bindings/core/v8/Dictionary.h" | 7 #include "bindings/core/v8/Dictionary.h" |
8 #include "bindings/core/v8/EffectModelOrDictionarySequenceOrDictionary.h" | 8 #include "bindings/core/v8/EffectModelOrDictionarySequenceOrDictionary.h" |
9 #include "bindings/core/v8/V8BindingForTesting.h" | 9 #include "bindings/core/v8/V8BindingForTesting.h" |
10 #include "bindings/core/v8/V8KeyframeEffectOptions.h" | 10 #include "bindings/core/v8/V8KeyframeEffectOptions.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 KeyframeEffect* animation = createAnimation(element.get(), jsKeyframes, 0, e
xceptionState); | 82 KeyframeEffect* animation = createAnimation(element.get(), jsKeyframes, 0, e
xceptionState); |
83 | 83 |
84 Element* target = animation->target(); | 84 Element* target = animation->target(); |
85 EXPECT_EQ(*element.get(), *target); | 85 EXPECT_EQ(*element.get(), *target); |
86 | 86 |
87 const KeyframeVector keyframes = toKeyframeEffectModelBase(animation->model(
))->getFrames(); | 87 const KeyframeVector keyframes = toKeyframeEffectModelBase(animation->model(
))->getFrames(); |
88 | 88 |
89 EXPECT_EQ(0, keyframes[0]->offset()); | 89 EXPECT_EQ(0, keyframes[0]->offset()); |
90 EXPECT_EQ(1, keyframes[1]->offset()); | 90 EXPECT_EQ(1, keyframes[1]->offset()); |
91 | 91 |
92 const CSSValue* keyframe1Width = toStringKeyframe(keyframes[0].get())->cssPr
opertyValue(CSSPropertyWidth); | 92 const CSSValue& keyframe1Width = toStringKeyframe(keyframes[0].get())->cssPr
opertyValue(CSSPropertyWidth); |
93 const CSSValue* keyframe2Width = toStringKeyframe(keyframes[1].get())->cssPr
opertyValue(CSSPropertyWidth); | 93 const CSSValue& keyframe2Width = toStringKeyframe(keyframes[1].get())->cssPr
opertyValue(CSSPropertyWidth); |
94 ASSERT(keyframe1Width); | |
95 ASSERT(keyframe2Width); | |
96 | 94 |
97 EXPECT_EQ("100px", keyframe1Width->cssText()); | 95 EXPECT_EQ("100px", keyframe1Width.cssText()); |
98 EXPECT_EQ("0px", keyframe2Width->cssText()); | 96 EXPECT_EQ("0px", keyframe2Width.cssText()); |
99 | 97 |
100 EXPECT_EQ(*(CubicBezierTimingFunction::preset(CubicBezierTimingFunction::Eas
eType::EASE_IN_OUT)), keyframes[0]->easing()); | 98 EXPECT_EQ(*(CubicBezierTimingFunction::preset(CubicBezierTimingFunction::Eas
eType::EASE_IN_OUT)), keyframes[0]->easing()); |
101 EXPECT_EQ(*(CubicBezierTimingFunction::create(1, 1, 0.3, 0.3).get()), keyfra
mes[1]->easing()); | 99 EXPECT_EQ(*(CubicBezierTimingFunction::create(1, 1, 0.3, 0.3).get()), keyfra
mes[1]->easing()); |
102 } | 100 } |
103 | 101 |
104 TEST_F(AnimationKeyframeEffectV8Test, CanSetDuration) | 102 TEST_F(AnimationKeyframeEffectV8Test, CanSetDuration) |
105 { | 103 { |
106 Vector<Dictionary, 0> jsKeyframes; | 104 Vector<Dictionary, 0> jsKeyframes; |
107 double duration = 2000; | 105 double duration = 2000; |
108 | 106 |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 Timing timing; | 359 Timing timing; |
362 timing.iterationDuration = 5; | 360 timing.iterationDuration = 5; |
363 KeyframeEffect* animation = KeyframeEffect::create(element.get(), nullptr, t
iming); | 361 KeyframeEffect* animation = KeyframeEffect::create(element.get(), nullptr, t
iming); |
364 EXPECT_EQ(element.get(), animation->target()); | 362 EXPECT_EQ(element.get(), animation->target()); |
365 document().timeline().play(animation); | 363 document().timeline().play(animation); |
366 pageHolder.reset(); | 364 pageHolder.reset(); |
367 element.clear(); | 365 element.clear(); |
368 } | 366 } |
369 | 367 |
370 } // namespace blink | 368 } // namespace blink |
OLD | NEW |