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

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

Issue 863863004: Implemented additive animations for length (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: More comprehensive non-negative length layout tests Created 5 years, 10 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
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "config.h"
6 #include "core/animation/InterpolationPipeline.h"
7
8 #include "core/animation/ConstantStyleInterpolation.h"
9
10 #include <gtest/gtest.h>
11
12 namespace blink {
13
14 class AnimationInterpolationPipelineTest : public ::testing::Test {
15 };
16
17 TEST_F(AnimationInterpolationPipelineTest, AddPipeline)
18 {
19 RefPtrWillBeRawPtr<InterpolationPipeline> pipeline = InterpolationPipeline:: create();
20
21 EXPECT_TRUE(pipeline->isEmpty());
22 EXPECT_EQ(pipeline->first(), nullptr);
23 EXPECT_EQ(pipeline->last(), nullptr);
24
25 RefPtrWillBeRawPtr<Interpolation> interpolation1 = ConstantStyleInterpolatio n::create(0, CSSPropertyInvalid, AnimationEffect::CompositeAdd, AnimationEffect: :CompositeAdd);
26 RefPtrWillBeRawPtr<Interpolation> interpolation2 = ConstantStyleInterpolatio n::create(0, CSSPropertyInvalid, AnimationEffect::CompositeAdd, AnimationEffect: :CompositeAdd);
27 RefPtrWillBeRawPtr<Interpolation> interpolation3 = ConstantStyleInterpolatio n::create(0, CSSPropertyInvalid, AnimationEffect::CompositeAdd, AnimationEffect: :CompositeAdd);
28
29 RefPtrWillBeRawPtr<InterpolationPipelineStage> stage1 = InterpolationPipelin eStage::create(interpolation1);
30 RefPtrWillBeRawPtr<InterpolationPipelineStage> stage2 = InterpolationPipelin eStage::create(interpolation2);
31 RefPtrWillBeRawPtr<InterpolationPipelineStage> stage3 = InterpolationPipelin eStage::create(interpolation3);
32
33 pipeline->append(stage1);
34
35 EXPECT_FALSE(pipeline->isEmpty());
36 EXPECT_EQ(pipeline->first().get(), stage1.get());
37 EXPECT_EQ(pipeline->first()->next(), nullptr);
38 EXPECT_EQ(pipeline->last().get(), stage1.get());
39
40 pipeline->append(stage2);
41
42 EXPECT_FALSE(pipeline->isEmpty());
43 EXPECT_EQ(pipeline->first().get(), stage1.get());
44 EXPECT_EQ(pipeline->first()->next().get(), stage2.get());
45 EXPECT_EQ(pipeline->first()->next()->next(), nullptr);
46 EXPECT_EQ(pipeline->last().get(), stage2.get());
47
48 pipeline->append(stage3);
49
50 EXPECT_FALSE(pipeline->isEmpty());
51 EXPECT_EQ(pipeline->first().get(), stage1.get());
52 EXPECT_EQ(pipeline->first()->next().get(), stage2.get());
53 EXPECT_EQ(pipeline->first()->next()->next().get(), stage3.get());
54 EXPECT_EQ(pipeline->first()->next()->next()->next(), nullptr);
55 EXPECT_EQ(pipeline->last().get(), stage3.get());
56 }
57
58 TEST_F(AnimationInterpolationPipelineTest, ReplacePipeline)
59 {
60 RefPtrWillBeRawPtr<InterpolationPipeline> pipeline = InterpolationPipeline:: create();
61
62 EXPECT_TRUE(pipeline->isEmpty());
63 EXPECT_EQ(pipeline->first(), nullptr);
64 EXPECT_EQ(pipeline->last(), nullptr);
65
66 RefPtrWillBeRawPtr<Interpolation> interpolation1 = ConstantStyleInterpolatio n::create(0, CSSPropertyInvalid, AnimationEffect::CompositeAdd, AnimationEffect: :CompositeAdd);
67 RefPtrWillBeRawPtr<Interpolation> interpolation2 = ConstantStyleInterpolatio n::create(0, CSSPropertyInvalid, AnimationEffect::CompositeReplace, AnimationEff ect::CompositeReplace);
68 RefPtrWillBeRawPtr<Interpolation> interpolation3 = ConstantStyleInterpolatio n::create(0, CSSPropertyInvalid, AnimationEffect::CompositeReplace, AnimationEff ect::CompositeReplace);
69 RefPtrWillBeRawPtr<Interpolation> interpolation4 = ConstantStyleInterpolatio n::create(0, CSSPropertyInvalid, AnimationEffect::CompositeAdd, AnimationEffect: :CompositeAdd);
70
71 RefPtrWillBeRawPtr<InterpolationPipelineStage> stage1 = InterpolationPipelin eStage::create(interpolation1);
72 RefPtrWillBeRawPtr<InterpolationPipelineStage> stage2 = InterpolationPipelin eStage::create(interpolation2);
73 RefPtrWillBeRawPtr<InterpolationPipelineStage> stage3 = InterpolationPipelin eStage::create(interpolation3);
74 RefPtrWillBeRawPtr<InterpolationPipelineStage> stage4 = InterpolationPipelin eStage::create(interpolation4);
75
76 pipeline->append(stage1);
77
78 EXPECT_FALSE(pipeline->isEmpty());
79 EXPECT_EQ(pipeline->first().get(), stage1.get());
80 EXPECT_EQ(pipeline->first()->next(), nullptr);
81 EXPECT_EQ(pipeline->last().get(), stage1.get());
82
83 pipeline->append(stage2);
84
85 EXPECT_FALSE(pipeline->isEmpty());
86 EXPECT_EQ(pipeline->first().get(), stage2.get());
87 EXPECT_EQ(pipeline->first()->next(), nullptr);
88 EXPECT_EQ(pipeline->last().get(), stage2.get());
89
90 pipeline->append(stage3);
91
92 EXPECT_FALSE(pipeline->isEmpty());
93 EXPECT_EQ(pipeline->first().get(), stage3.get());
94 EXPECT_EQ(pipeline->first()->next(), nullptr);
95 EXPECT_EQ(pipeline->last().get(), stage3.get());
96
97 pipeline->append(stage4);
98
99 EXPECT_FALSE(pipeline->isEmpty());
100 EXPECT_EQ(pipeline->first().get(), stage3.get());
101 EXPECT_EQ(pipeline->first()->next().get(), stage4.get());
102 EXPECT_EQ(pipeline->first()->next()->next(), nullptr);
103 EXPECT_EQ(pipeline->last().get(), stage4.get());
104 }
105
106 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698