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 "config.h" | 5 #include "config.h" |
6 #include "core/animation/Animation.h" | 6 #include "core/animation/Animation.h" |
7 | 7 |
8 #include "bindings/v8/Dictionary.h" | 8 #include "bindings/v8/Dictionary.h" |
9 #include "core/animation/AnimatableLength.h" | 9 #include "core/animation/AnimatableLength.h" |
10 #include "core/animation/AnimationClock.h" | 10 #include "core/animation/AnimationClock.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 RefPtr<Animation> animation = createAnimation(element.get(), jsKeyframes, 0,
exceptionState); | 86 RefPtr<Animation> animation = createAnimation(element.get(), jsKeyframes, 0,
exceptionState); |
87 | 87 |
88 Element* target = animation->target(); | 88 Element* target = animation->target(); |
89 EXPECT_EQ(*element.get(), *target); | 89 EXPECT_EQ(*element.get(), *target); |
90 | 90 |
91 const KeyframeVector keyframes = toKeyframeEffectModelBase(animation->effect
())->getFrames(); | 91 const KeyframeVector keyframes = toKeyframeEffectModelBase(animation->effect
())->getFrames(); |
92 | 92 |
93 EXPECT_EQ(0, keyframes[0]->offset()); | 93 EXPECT_EQ(0, keyframes[0]->offset()); |
94 EXPECT_EQ(1, keyframes[1]->offset()); | 94 EXPECT_EQ(1, keyframes[1]->offset()); |
95 | 95 |
96 const AnimatableValue* keyframe1Width = toAnimatableValueKeyframe(keyframes[
0].get())->propertyValue(CSSPropertyWidth); | 96 const CSSValue* keyframe1Width = toStringKeyframe(keyframes[0].get())->prope
rtyValue(CSSPropertyWidth); |
97 const AnimatableValue* keyframe2Width = toAnimatableValueKeyframe(keyframes[
1].get())->propertyValue(CSSPropertyWidth); | 97 const CSSValue* keyframe2Width = toStringKeyframe(keyframes[1].get())->prope
rtyValue(CSSPropertyWidth); |
98 ASSERT(keyframe1Width); | 98 ASSERT(keyframe1Width); |
99 ASSERT(keyframe2Width); | 99 ASSERT(keyframe2Width); |
100 | 100 |
101 EXPECT_TRUE(keyframe1Width->isLength()); | 101 EXPECT_EQ("100px", keyframe1Width->cssText()); |
102 EXPECT_TRUE(keyframe2Width->isLength()); | 102 EXPECT_EQ("0px", keyframe2Width->cssText()); |
103 | |
104 EXPECT_EQ("100px", toAnimatableLength(keyframe1Width)->toCSSValue()->cssText
()); | |
105 EXPECT_EQ("0px", toAnimatableLength(keyframe2Width)->toCSSValue()->cssText()
); | |
106 | 103 |
107 EXPECT_EQ(*(CubicBezierTimingFunction::preset(CubicBezierTimingFunction::Eas
eInOut)), *keyframes[0]->easing()); | 104 EXPECT_EQ(*(CubicBezierTimingFunction::preset(CubicBezierTimingFunction::Eas
eInOut)), *keyframes[0]->easing()); |
108 EXPECT_EQ(*(CubicBezierTimingFunction::create(1, 1, 0.3, 0.3).get()), *keyfr
ames[1]->easing()); | 105 EXPECT_EQ(*(CubicBezierTimingFunction::create(1, 1, 0.3, 0.3).get()), *keyfr
ames[1]->easing()); |
109 } | 106 } |
110 | 107 |
111 TEST_F(AnimationAnimationV8Test, CanSetDuration) | 108 TEST_F(AnimationAnimationV8Test, CanSetDuration) |
112 { | 109 { |
113 Vector<Dictionary, 0> jsKeyframes; | 110 Vector<Dictionary, 0> jsKeyframes; |
114 double duration = 2; | 111 double duration = 2; |
115 | 112 |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 player->setCurrentTime(150); | 443 player->setCurrentTime(150); |
447 EXPECT_EQ(inf, animation->timeToForwardsEffectChange()); | 444 EXPECT_EQ(inf, animation->timeToForwardsEffectChange()); |
448 EXPECT_EQ(0, animation->timeToReverseEffectChange()); | 445 EXPECT_EQ(0, animation->timeToReverseEffectChange()); |
449 | 446 |
450 player->setCurrentTime(200); | 447 player->setCurrentTime(200); |
451 EXPECT_EQ(inf, animation->timeToForwardsEffectChange()); | 448 EXPECT_EQ(inf, animation->timeToForwardsEffectChange()); |
452 EXPECT_EQ(50, animation->timeToReverseEffectChange()); | 449 EXPECT_EQ(50, animation->timeToReverseEffectChange()); |
453 } | 450 } |
454 | 451 |
455 } // namespace WebCore | 452 } // namespace WebCore |
OLD | NEW |