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

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

Issue 984153002: Fix template angle bracket syntax in animation (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 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 // 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/AnimationStack.h" 6 #include "core/animation/AnimationStack.h"
7 7
8 #include "core/animation/AnimationClock.h" 8 #include "core/animation/AnimationClock.h"
9 #include "core/animation/AnimationTimeline.h" 9 #include "core/animation/AnimationTimeline.h"
10 #include "core/animation/ElementAnimations.h" 10 #include "core/animation/ElementAnimations.h"
(...skipping 21 matching lines...) Expand all
32 player->update(TimingUpdateOnDemand); 32 player->update(TimingUpdateOnDemand);
33 return player; 33 return player;
34 } 34 }
35 35
36 void updateTimeline(double time) 36 void updateTimeline(double time)
37 { 37 {
38 document->animationClock().updateTime(time); 38 document->animationClock().updateTime(time);
39 timeline->serviceAnimations(TimingUpdateForAnimationFrame); 39 timeline->serviceAnimations(TimingUpdateForAnimationFrame);
40 } 40 }
41 41
42 const WillBeHeapVector<OwnPtrWillBeMember<SampledEffect> >& effects() 42 const WillBeHeapVector<OwnPtrWillBeMember<SampledEffect>>& effects()
43 { 43 {
44 return element->ensureElementAnimations().defaultStack().m_effects; 44 return element->ensureElementAnimations().defaultStack().m_effects;
45 } 45 }
46 46
47 PassRefPtrWillBeRawPtr<AnimationEffect> makeAnimationEffect(CSSPropertyID id , PassRefPtrWillBeRawPtr<AnimatableValue> value) 47 PassRefPtrWillBeRawPtr<AnimationEffect> makeAnimationEffect(CSSPropertyID id , PassRefPtrWillBeRawPtr<AnimatableValue> value)
48 { 48 {
49 AnimatableValueKeyframeVector keyframes(2); 49 AnimatableValueKeyframeVector keyframes(2);
50 keyframes[0] = AnimatableValueKeyframe::create(); 50 keyframes[0] = AnimatableValueKeyframe::create();
51 keyframes[0]->setOffset(0.0); 51 keyframes[0]->setOffset(0.0);
52 keyframes[0]->setPropertyValue(id, value.get()); 52 keyframes[0]->setPropertyValue(id, value.get());
(...skipping 26 matching lines...) Expand all
79 RefPtrWillBePersistent<Document> document; 79 RefPtrWillBePersistent<Document> document;
80 RefPtrWillBePersistent<AnimationTimeline> timeline; 80 RefPtrWillBePersistent<AnimationTimeline> timeline;
81 RefPtrWillBePersistent<Element> element; 81 RefPtrWillBePersistent<Element> element;
82 }; 82 };
83 83
84 TEST_F(AnimationAnimationStackTest, ElementAnimationsSorted) 84 TEST_F(AnimationAnimationStackTest, ElementAnimationsSorted)
85 { 85 {
86 play(makeAnimation(makeAnimationEffect(CSSPropertyFontSize, AnimatableDouble ::create(1))).get(), 10); 86 play(makeAnimation(makeAnimationEffect(CSSPropertyFontSize, AnimatableDouble ::create(1))).get(), 10);
87 play(makeAnimation(makeAnimationEffect(CSSPropertyFontSize, AnimatableDouble ::create(2))).get(), 15); 87 play(makeAnimation(makeAnimationEffect(CSSPropertyFontSize, AnimatableDouble ::create(2))).get(), 15);
88 play(makeAnimation(makeAnimationEffect(CSSPropertyFontSize, AnimatableDouble ::create(3))).get(), 5); 88 play(makeAnimation(makeAnimationEffect(CSSPropertyFontSize, AnimatableDouble ::create(3))).get(), 5);
89 WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> > result = AnimationStack::activeInterpolations(&element->elementAnimations()->defaultSta ck(), 0, 0, Animation::DefaultPriority, 0); 89 WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation>> result = AnimationStack::activeInterpolations(&element->elementAnimations()->defaultStac k(), 0, 0, Animation::DefaultPriority, 0);
90 EXPECT_EQ(1u, result.size()); 90 EXPECT_EQ(1u, result.size());
91 EXPECT_TRUE(interpolationValue(result.get(CSSPropertyFontSize))->equals(Anim atableDouble::create(3).get())); 91 EXPECT_TRUE(interpolationValue(result.get(CSSPropertyFontSize))->equals(Anim atableDouble::create(3).get()));
92 } 92 }
93 93
94 TEST_F(AnimationAnimationStackTest, NewAnimations) 94 TEST_F(AnimationAnimationStackTest, NewAnimations)
95 { 95 {
96 play(makeAnimation(makeAnimationEffect(CSSPropertyFontSize, AnimatableDouble ::create(1))).get(), 15); 96 play(makeAnimation(makeAnimationEffect(CSSPropertyFontSize, AnimatableDouble ::create(1))).get(), 15);
97 play(makeAnimation(makeAnimationEffect(CSSPropertyZIndex, AnimatableDouble:: create(2))).get(), 10); 97 play(makeAnimation(makeAnimationEffect(CSSPropertyZIndex, AnimatableDouble:: create(2))).get(), 10);
98 WillBeHeapVector<RawPtrWillBeMember<InertAnimation> > newAnimations; 98 WillBeHeapVector<RawPtrWillBeMember<InertAnimation>> newAnimations;
99 RefPtrWillBeRawPtr<InertAnimation> inert1 = makeInertAnimation(makeAnimation Effect(CSSPropertyFontSize, AnimatableDouble::create(3))); 99 RefPtrWillBeRawPtr<InertAnimation> inert1 = makeInertAnimation(makeAnimation Effect(CSSPropertyFontSize, AnimatableDouble::create(3)));
100 RefPtrWillBeRawPtr<InertAnimation> inert2 = makeInertAnimation(makeAnimation Effect(CSSPropertyZIndex, AnimatableDouble::create(4))); 100 RefPtrWillBeRawPtr<InertAnimation> inert2 = makeInertAnimation(makeAnimation Effect(CSSPropertyZIndex, AnimatableDouble::create(4)));
101 newAnimations.append(inert1.get()); 101 newAnimations.append(inert1.get());
102 newAnimations.append(inert2.get()); 102 newAnimations.append(inert2.get());
103 WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> > result = AnimationStack::activeInterpolations(&element->elementAnimations()->defaultSta ck(), &newAnimations, 0, Animation::DefaultPriority, 10); 103 WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation>> result = AnimationStack::activeInterpolations(&element->elementAnimations()->defaultStac k(), &newAnimations, 0, Animation::DefaultPriority, 10);
104 EXPECT_EQ(2u, result.size()); 104 EXPECT_EQ(2u, result.size());
105 EXPECT_TRUE(interpolationValue(result.get(CSSPropertyFontSize))->equals(Anim atableDouble::create(3).get())); 105 EXPECT_TRUE(interpolationValue(result.get(CSSPropertyFontSize))->equals(Anim atableDouble::create(3).get()));
106 EXPECT_TRUE(interpolationValue(result.get(CSSPropertyZIndex))->equals(Animat ableDouble::create(4).get())); 106 EXPECT_TRUE(interpolationValue(result.get(CSSPropertyZIndex))->equals(Animat ableDouble::create(4).get()));
107 } 107 }
108 108
109 TEST_F(AnimationAnimationStackTest, CancelledAnimationPlayers) 109 TEST_F(AnimationAnimationStackTest, CancelledAnimationPlayers)
110 { 110 {
111 WillBeHeapHashSet<RawPtrWillBeMember<const AnimationPlayer> > cancelledAnima tionPlayers; 111 WillBeHeapHashSet<RawPtrWillBeMember<const AnimationPlayer>> cancelledAnimat ionPlayers;
112 RefPtrWillBeRawPtr<AnimationPlayer> player = play(makeAnimation(makeAnimatio nEffect(CSSPropertyFontSize, AnimatableDouble::create(1))).get(), 0); 112 RefPtrWillBeRawPtr<AnimationPlayer> player = play(makeAnimation(makeAnimatio nEffect(CSSPropertyFontSize, AnimatableDouble::create(1))).get(), 0);
113 cancelledAnimationPlayers.add(player.get()); 113 cancelledAnimationPlayers.add(player.get());
114 play(makeAnimation(makeAnimationEffect(CSSPropertyZIndex, AnimatableDouble:: create(2))).get(), 0); 114 play(makeAnimation(makeAnimationEffect(CSSPropertyZIndex, AnimatableDouble:: create(2))).get(), 0);
115 WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> > result = AnimationStack::activeInterpolations(&element->elementAnimations()->defaultSta ck(), 0, &cancelledAnimationPlayers, Animation::DefaultPriority, 0); 115 WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation>> result = AnimationStack::activeInterpolations(&element->elementAnimations()->defaultStac k(), 0, &cancelledAnimationPlayers, 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 } 120 }
OLDNEW
« no previous file with comments | « Source/core/animation/AnimationStack.cpp ('k') | Source/core/animation/CompositorAnimations.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698