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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/animation/InterpolationPipelineTest.cpp
diff --git a/Source/core/animation/InterpolationPipelineTest.cpp b/Source/core/animation/InterpolationPipelineTest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..52f74c2fe965f92bb3d6ef7a8a763f91d83c8be0
--- /dev/null
+++ b/Source/core/animation/InterpolationPipelineTest.cpp
@@ -0,0 +1,106 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "core/animation/InterpolationPipeline.h"
+
+#include "core/animation/ConstantStyleInterpolation.h"
+
+#include <gtest/gtest.h>
+
+namespace blink {
+
+class AnimationInterpolationPipelineTest : public ::testing::Test {
+};
+
+TEST_F(AnimationInterpolationPipelineTest, AddPipeline)
+{
+ RefPtrWillBeRawPtr<InterpolationPipeline> pipeline = InterpolationPipeline::create();
+
+ EXPECT_TRUE(pipeline->isEmpty());
+ EXPECT_EQ(pipeline->first(), nullptr);
+ EXPECT_EQ(pipeline->last(), nullptr);
+
+ RefPtrWillBeRawPtr<Interpolation> interpolation1 = ConstantStyleInterpolation::create(0, CSSPropertyInvalid, AnimationEffect::CompositeAdd, AnimationEffect::CompositeAdd);
+ RefPtrWillBeRawPtr<Interpolation> interpolation2 = ConstantStyleInterpolation::create(0, CSSPropertyInvalid, AnimationEffect::CompositeAdd, AnimationEffect::CompositeAdd);
+ RefPtrWillBeRawPtr<Interpolation> interpolation3 = ConstantStyleInterpolation::create(0, CSSPropertyInvalid, AnimationEffect::CompositeAdd, AnimationEffect::CompositeAdd);
+
+ RefPtrWillBeRawPtr<InterpolationPipelineStage> stage1 = InterpolationPipelineStage::create(interpolation1);
+ RefPtrWillBeRawPtr<InterpolationPipelineStage> stage2 = InterpolationPipelineStage::create(interpolation2);
+ RefPtrWillBeRawPtr<InterpolationPipelineStage> stage3 = InterpolationPipelineStage::create(interpolation3);
+
+ pipeline->append(stage1);
+
+ EXPECT_FALSE(pipeline->isEmpty());
+ EXPECT_EQ(pipeline->first().get(), stage1.get());
+ EXPECT_EQ(pipeline->first()->next(), nullptr);
+ EXPECT_EQ(pipeline->last().get(), stage1.get());
+
+ pipeline->append(stage2);
+
+ EXPECT_FALSE(pipeline->isEmpty());
+ EXPECT_EQ(pipeline->first().get(), stage1.get());
+ EXPECT_EQ(pipeline->first()->next().get(), stage2.get());
+ EXPECT_EQ(pipeline->first()->next()->next(), nullptr);
+ EXPECT_EQ(pipeline->last().get(), stage2.get());
+
+ pipeline->append(stage3);
+
+ EXPECT_FALSE(pipeline->isEmpty());
+ EXPECT_EQ(pipeline->first().get(), stage1.get());
+ EXPECT_EQ(pipeline->first()->next().get(), stage2.get());
+ EXPECT_EQ(pipeline->first()->next()->next().get(), stage3.get());
+ EXPECT_EQ(pipeline->first()->next()->next()->next(), nullptr);
+ EXPECT_EQ(pipeline->last().get(), stage3.get());
+}
+
+TEST_F(AnimationInterpolationPipelineTest, ReplacePipeline)
+{
+ RefPtrWillBeRawPtr<InterpolationPipeline> pipeline = InterpolationPipeline::create();
+
+ EXPECT_TRUE(pipeline->isEmpty());
+ EXPECT_EQ(pipeline->first(), nullptr);
+ EXPECT_EQ(pipeline->last(), nullptr);
+
+ RefPtrWillBeRawPtr<Interpolation> interpolation1 = ConstantStyleInterpolation::create(0, CSSPropertyInvalid, AnimationEffect::CompositeAdd, AnimationEffect::CompositeAdd);
+ RefPtrWillBeRawPtr<Interpolation> interpolation2 = ConstantStyleInterpolation::create(0, CSSPropertyInvalid, AnimationEffect::CompositeReplace, AnimationEffect::CompositeReplace);
+ RefPtrWillBeRawPtr<Interpolation> interpolation3 = ConstantStyleInterpolation::create(0, CSSPropertyInvalid, AnimationEffect::CompositeReplace, AnimationEffect::CompositeReplace);
+ RefPtrWillBeRawPtr<Interpolation> interpolation4 = ConstantStyleInterpolation::create(0, CSSPropertyInvalid, AnimationEffect::CompositeAdd, AnimationEffect::CompositeAdd);
+
+ RefPtrWillBeRawPtr<InterpolationPipelineStage> stage1 = InterpolationPipelineStage::create(interpolation1);
+ RefPtrWillBeRawPtr<InterpolationPipelineStage> stage2 = InterpolationPipelineStage::create(interpolation2);
+ RefPtrWillBeRawPtr<InterpolationPipelineStage> stage3 = InterpolationPipelineStage::create(interpolation3);
+ RefPtrWillBeRawPtr<InterpolationPipelineStage> stage4 = InterpolationPipelineStage::create(interpolation4);
+
+ pipeline->append(stage1);
+
+ EXPECT_FALSE(pipeline->isEmpty());
+ EXPECT_EQ(pipeline->first().get(), stage1.get());
+ EXPECT_EQ(pipeline->first()->next(), nullptr);
+ EXPECT_EQ(pipeline->last().get(), stage1.get());
+
+ pipeline->append(stage2);
+
+ EXPECT_FALSE(pipeline->isEmpty());
+ EXPECT_EQ(pipeline->first().get(), stage2.get());
+ EXPECT_EQ(pipeline->first()->next(), nullptr);
+ EXPECT_EQ(pipeline->last().get(), stage2.get());
+
+ pipeline->append(stage3);
+
+ EXPECT_FALSE(pipeline->isEmpty());
+ EXPECT_EQ(pipeline->first().get(), stage3.get());
+ EXPECT_EQ(pipeline->first()->next(), nullptr);
+ EXPECT_EQ(pipeline->last().get(), stage3.get());
+
+ pipeline->append(stage4);
+
+ EXPECT_FALSE(pipeline->isEmpty());
+ EXPECT_EQ(pipeline->first().get(), stage3.get());
+ EXPECT_EQ(pipeline->first()->next().get(), stage4.get());
+ EXPECT_EQ(pipeline->first()->next()->next(), nullptr);
+ EXPECT_EQ(pipeline->last().get(), stage4.get());
+}
+
+}

Powered by Google App Engine
This is Rietveld 408576698