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 "sky/engine/config.h" | 5 #include "sky/engine/config.h" |
6 #include "sky/engine/core/animation/AnimationStack.h" | 6 #include "sky/engine/core/animation/AnimationStack.h" |
7 | 7 |
8 #include <gtest/gtest.h> | 8 #include <gtest/gtest.h> |
9 #include "sky/engine/core/animation/ActiveAnimations.h" | 9 #include "sky/engine/core/animation/ActiveAnimations.h" |
10 #include "sky/engine/core/animation/AnimationClock.h" | 10 #include "sky/engine/core/animation/AnimationClock.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 HashMap<CSSPropertyID, RefPtr<Interpolation> > result = AnimationStack::acti
veInterpolations(&element->activeAnimations()->defaultStack(), 0, &cancelledAnim
ationPlayers, Animation::DefaultPriority, 0); | 115 HashMap<CSSPropertyID, RefPtr<Interpolation> > result = AnimationStack::acti
veInterpolations(&element->activeAnimations()->defaultStack(), 0, &cancelledAnim
ationPlayers, Animation::DefaultPriority, 0); |
116 EXPECT_EQ(1u, result.size()); | 116 EXPECT_EQ(1u, result.size()); |
117 EXPECT_TRUE(interpolationValue(result.get(CSSPropertyZIndex))->equals(Animat
ableDouble::create(2).get())); | 117 EXPECT_TRUE(interpolationValue(result.get(CSSPropertyZIndex))->equals(Animat
ableDouble::create(2).get())); |
118 } | 118 } |
119 | 119 |
120 TEST_F(AnimationAnimationStackTest, ForwardsFillDiscarding) | 120 TEST_F(AnimationAnimationStackTest, ForwardsFillDiscarding) |
121 { | 121 { |
122 play(makeAnimation(makeAnimationEffect(CSSPropertyFontSize, AnimatableDouble
::create(1))).get(), 2); | 122 play(makeAnimation(makeAnimationEffect(CSSPropertyFontSize, AnimatableDouble
::create(1))).get(), 2); |
123 play(makeAnimation(makeAnimationEffect(CSSPropertyFontSize, AnimatableDouble
::create(2))).get(), 6); | 123 play(makeAnimation(makeAnimationEffect(CSSPropertyFontSize, AnimatableDouble
::create(2))).get(), 6); |
124 play(makeAnimation(makeAnimationEffect(CSSPropertyFontSize, AnimatableDouble
::create(3))).get(), 4); | 124 play(makeAnimation(makeAnimationEffect(CSSPropertyFontSize, AnimatableDouble
::create(3))).get(), 4); |
125 document->compositorPendingAnimations().update(); | 125 document->pendingAnimations().update(); |
126 HashMap<CSSPropertyID, RefPtr<Interpolation> > interpolations; | 126 HashMap<CSSPropertyID, RefPtr<Interpolation> > interpolations; |
127 | 127 |
128 updateTimeline(11); | 128 updateTimeline(11); |
129 interpolations = AnimationStack::activeInterpolations(&element->activeAnimat
ions()->defaultStack(), 0, 0, Animation::DefaultPriority, 0); | 129 interpolations = AnimationStack::activeInterpolations(&element->activeAnimat
ions()->defaultStack(), 0, 0, Animation::DefaultPriority, 0); |
130 EXPECT_TRUE(interpolationValue(interpolations.get(CSSPropertyFontSize))->equ
als(AnimatableDouble::create(3).get())); | 130 EXPECT_TRUE(interpolationValue(interpolations.get(CSSPropertyFontSize))->equ
als(AnimatableDouble::create(3).get())); |
131 EXPECT_EQ(3u, effects().size()); | 131 EXPECT_EQ(3u, effects().size()); |
132 EXPECT_EQ(1u, interpolations.size()); | 132 EXPECT_EQ(1u, interpolations.size()); |
133 | 133 |
134 updateTimeline(13); | 134 updateTimeline(13); |
135 interpolations = AnimationStack::activeInterpolations(&element->activeAnimat
ions()->defaultStack(), 0, 0, Animation::DefaultPriority, 0); | 135 interpolations = AnimationStack::activeInterpolations(&element->activeAnimat
ions()->defaultStack(), 0, 0, Animation::DefaultPriority, 0); |
136 EXPECT_TRUE(interpolationValue(interpolations.get(CSSPropertyFontSize))->equ
als(AnimatableDouble::create(3).get())); | 136 EXPECT_TRUE(interpolationValue(interpolations.get(CSSPropertyFontSize))->equ
als(AnimatableDouble::create(3).get())); |
137 EXPECT_EQ(3u, effects().size()); | 137 EXPECT_EQ(3u, effects().size()); |
138 | 138 |
139 updateTimeline(15); | 139 updateTimeline(15); |
140 interpolations = AnimationStack::activeInterpolations(&element->activeAnimat
ions()->defaultStack(), 0, 0, Animation::DefaultPriority, 0); | 140 interpolations = AnimationStack::activeInterpolations(&element->activeAnimat
ions()->defaultStack(), 0, 0, Animation::DefaultPriority, 0); |
141 EXPECT_TRUE(interpolationValue(interpolations.get(CSSPropertyFontSize))->equ
als(AnimatableDouble::create(3).get())); | 141 EXPECT_TRUE(interpolationValue(interpolations.get(CSSPropertyFontSize))->equ
als(AnimatableDouble::create(3).get())); |
142 EXPECT_EQ(2u, effects().size()); | 142 EXPECT_EQ(2u, effects().size()); |
143 | 143 |
144 updateTimeline(17); | 144 updateTimeline(17); |
145 interpolations = AnimationStack::activeInterpolations(&element->activeAnimat
ions()->defaultStack(), 0, 0, Animation::DefaultPriority, 0); | 145 interpolations = AnimationStack::activeInterpolations(&element->activeAnimat
ions()->defaultStack(), 0, 0, Animation::DefaultPriority, 0); |
146 EXPECT_TRUE(interpolationValue(interpolations.get(CSSPropertyFontSize))->equ
als(AnimatableDouble::create(3).get())); | 146 EXPECT_TRUE(interpolationValue(interpolations.get(CSSPropertyFontSize))->equ
als(AnimatableDouble::create(3).get())); |
147 EXPECT_EQ(1u, effects().size()); | 147 EXPECT_EQ(1u, effects().size()); |
148 } | 148 } |
149 | 149 |
150 } | 150 } |
OLD | NEW |