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

Unified Diff: third_party/WebKit/Source/core/animation/animatable/AnimatableLengthTest.cpp

Issue 2750293003: Delete unused AnimatableValue code (Closed)
Patch Set: Fix unit tests Created 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/animation/animatable/AnimatableLengthTest.cpp
diff --git a/third_party/WebKit/Source/core/animation/animatable/AnimatableLengthTest.cpp b/third_party/WebKit/Source/core/animation/animatable/AnimatableLengthTest.cpp
deleted file mode 100644
index 84b2c06d9d8647a55dee134d8277483c36d39087..0000000000000000000000000000000000000000
--- a/third_party/WebKit/Source/core/animation/animatable/AnimatableLengthTest.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright 2014 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 "core/animation/animatable/AnimatableLength.h"
-
-#include "platform/CalculationValue.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace blink {
-
-namespace {
-
-PassRefPtr<AnimatableLength> create(const Length& length, double zoom = 1) {
- return AnimatableLength::create(length, zoom);
-}
-
-} // anonymous namespace
-
-TEST(AnimationAnimatableLengthTest, RoundTripConversion) {
- EXPECT_EQ(Length(0, Fixed),
- create(Length(0, Fixed))->getLength(1, ValueRangeAll));
- EXPECT_EQ(Length(0, Percent),
- create(Length(0, Percent))->getLength(1, ValueRangeAll));
- EXPECT_EQ(Length(10, Fixed),
- create(Length(10, Fixed))->getLength(1, ValueRangeAll));
- EXPECT_EQ(Length(10, Percent),
- create(Length(10, Percent))->getLength(1, ValueRangeAll));
- EXPECT_EQ(Length(-10, Fixed),
- create(Length(-10, Fixed))->getLength(1, ValueRangeAll));
- EXPECT_EQ(Length(-10, Percent),
- create(Length(-10, Percent))->getLength(1, ValueRangeAll));
- Length calc =
- Length(CalculationValue::create(PixelsAndPercent(5, 10), ValueRangeAll));
- EXPECT_EQ(calc, create(calc)->getLength(1, ValueRangeAll));
-}
-
-TEST(AnimationAnimatableLengthTest, ValueRangeNonNegative) {
- EXPECT_EQ(Length(10, Fixed),
- create(Length(10, Fixed))->getLength(1, ValueRangeNonNegative));
- EXPECT_EQ(Length(10, Percent),
- create(Length(10, Percent))->getLength(1, ValueRangeNonNegative));
- EXPECT_EQ(Length(0, Fixed),
- create(Length(-10, Fixed))->getLength(1, ValueRangeNonNegative));
- EXPECT_EQ(Length(0, Percent),
- create(Length(-10, Percent))->getLength(1, ValueRangeNonNegative));
- Length calc = Length(CalculationValue::create(PixelsAndPercent(-5, -10),
- ValueRangeNonNegative));
- EXPECT_TRUE(calc == create(calc)->getLength(1, ValueRangeNonNegative));
-}
-
-TEST(AnimationAnimatableLengthTest, Zoom) {
- EXPECT_EQ(Length(4, Fixed),
- create(Length(10, Fixed), 5)->getLength(2, ValueRangeAll));
- EXPECT_EQ(Length(10, Percent),
- create(Length(10, Percent), 5)->getLength(2, ValueRangeAll));
- Length calc =
- Length(CalculationValue::create(PixelsAndPercent(5, 10), ValueRangeAll));
- Length result =
- Length(CalculationValue::create(PixelsAndPercent(2, 10), ValueRangeAll));
- EXPECT_TRUE(result == create(calc, 5)->getLength(2, ValueRangeAll));
-}
-
-TEST(AnimationAnimatableLengthTest, Equals) {
- EXPECT_TRUE(
- create(Length(10, Fixed))->equals(create(Length(10, Fixed)).get()));
- EXPECT_TRUE(
- create(Length(20, Percent))->equals(create(Length(20, Percent)).get()));
- EXPECT_FALSE(
- create(Length(10, Fixed))->equals(create(Length(10, Percent)).get()));
- EXPECT_FALSE(
- create(Length(0, Percent))->equals(create(Length(0, Fixed)).get()));
- Length calc =
- Length(CalculationValue::create(PixelsAndPercent(5, 10), ValueRangeAll));
- EXPECT_TRUE(create(calc)->equals(create(calc).get()));
- EXPECT_FALSE(create(calc)->equals(create(Length(10, Percent)).get()));
-}
-
-TEST(AnimationAnimatableLengthTest, Interpolate) {
- EXPECT_TRUE(AnimatableValue::interpolate(create(Length(10, Fixed)).get(),
- create(Length(0, Fixed)).get(), 0.2)
- ->equals(create(Length(8, Fixed)).get()));
- EXPECT_TRUE(AnimatableValue::interpolate(create(Length(4, Percent)).get(),
- create(Length(12, Percent)).get(),
- 0.25)
- ->equals(create(Length(6, Percent)).get()));
- Length calc =
- Length(CalculationValue::create(PixelsAndPercent(12, 4), ValueRangeAll));
- EXPECT_TRUE(AnimatableValue::interpolate(create(Length(20, Fixed)).get(),
- create(Length(10, Percent)).get(),
- 0.4)
- ->equals(create(calc).get()));
-}
-
-} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698