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

Unified Diff: Source/core/animation/AnimatableLengthTest.cpp

Issue 64293008: Wrap CSS length conversion arguments in an object (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: don't make it noncopyable ; clang doesn't do the RVO stuffs? Created 7 years, 1 month 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
« no previous file with comments | « Source/core/animation/AnimatableLength.cpp ('k') | Source/core/core.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/animation/AnimatableLengthTest.cpp
diff --git a/Source/core/animation/AnimatableLengthTest.cpp b/Source/core/animation/AnimatableLengthTest.cpp
index b8772ab80559a68b3ba650c54b45ed02619477d6..3574a66279b6128244620900760e73119db0d249 100644
--- a/Source/core/animation/AnimatableLengthTest.cpp
+++ b/Source/core/animation/AnimatableLengthTest.cpp
@@ -35,6 +35,7 @@
#include "core/animation/AnimatableValueTestHelper.h"
#include "core/css/CSSCalculationValue.h"
#include "core/css/CSSPrimitiveValue.h"
+#include "core/css/CSSToLengthConversionData.h"
#include "core/rendering/style/RenderStyle.h"
#include "core/rendering/style/StyleInheritedData.h"
#include "platform/CalculationValue.h"
@@ -48,9 +49,11 @@ namespace WebCore {
class AnimationAnimatableLengthTest : public ::testing::Test {
protected:
- virtual void SetUp()
+ AnimationAnimatableLengthTest()
+ : style(RenderStyle::createDefaultStyle())
+ , conversionDataZoom1(style.get(), style.get(), 1.0f)
+ , conversionDataZoom3(style.get(), style.get(), 3.0f)
{
- style = RenderStyle::createDefaultStyle();
}
PassRefPtr<AnimatableLength> create(double value, CSSPrimitiveValue::UnitTypes type)
@@ -88,6 +91,8 @@ protected:
}
RefPtr<RenderStyle> style;
+ CSSToLengthConversionData conversionDataZoom1;
+ CSSToLengthConversionData conversionDataZoom3;
};
TEST_F(AnimationAnimatableLengthTest, CanCreateFrom)
@@ -164,15 +169,15 @@ TEST_F(AnimationAnimatableLengthTest, ToCSSValue)
TEST_F(AnimationAnimatableLengthTest, ToLength)
{
- EXPECT_EQ(Length(-5, WebCore::Fixed), create(-5, CSSPrimitiveValue::CSS_PX)->toLength(style.get(), style.get(), 1));
- EXPECT_EQ(Length(-15, WebCore::Fixed), create(-5, CSSPrimitiveValue::CSS_PX)->toLength(style.get(), style.get(), 3));
- EXPECT_EQ(Length(0, WebCore::Fixed), create(-5, CSSPrimitiveValue::CSS_PX)->toLength(style.get(), style.get(), 1, NonNegativeValues));
- EXPECT_EQ(Length(0, WebCore::Fixed), create(-5, CSSPrimitiveValue::CSS_PX)->toLength(style.get(), style.get(), 3, NonNegativeValues));
+ EXPECT_EQ(Length(-5, WebCore::Fixed), create(-5, CSSPrimitiveValue::CSS_PX)->toLength(conversionDataZoom1));
+ EXPECT_EQ(Length(-15, WebCore::Fixed), create(-5, CSSPrimitiveValue::CSS_PX)->toLength(conversionDataZoom3));
+ EXPECT_EQ(Length(0, WebCore::Fixed), create(-5, CSSPrimitiveValue::CSS_PX)->toLength(conversionDataZoom1, NonNegativeValues));
+ EXPECT_EQ(Length(0, WebCore::Fixed), create(-5, CSSPrimitiveValue::CSS_PX)->toLength(conversionDataZoom3, NonNegativeValues));
- EXPECT_EQ(Length(-5, Percent), create(-5, CSSPrimitiveValue::CSS_PERCENTAGE)->toLength(style.get(), style.get(), 1));
- EXPECT_EQ(Length(-5, Percent), create(-5, CSSPrimitiveValue::CSS_PERCENTAGE)->toLength(style.get(), style.get(), 3));
- EXPECT_EQ(Length(0, Percent), create(-5, CSSPrimitiveValue::CSS_PERCENTAGE)->toLength(style.get(), style.get(), 1, NonNegativeValues));
- EXPECT_EQ(Length(0, Percent), create(-5, CSSPrimitiveValue::CSS_PERCENTAGE)->toLength(style.get(), style.get(), 3, NonNegativeValues));
+ EXPECT_EQ(Length(-5, Percent), create(-5, CSSPrimitiveValue::CSS_PERCENTAGE)->toLength(conversionDataZoom1));
+ EXPECT_EQ(Length(-5, Percent), create(-5, CSSPrimitiveValue::CSS_PERCENTAGE)->toLength(conversionDataZoom3));
+ EXPECT_EQ(Length(0, Percent), create(-5, CSSPrimitiveValue::CSS_PERCENTAGE)->toLength(conversionDataZoom1, NonNegativeValues));
+ EXPECT_EQ(Length(0, Percent), create(-5, CSSPrimitiveValue::CSS_PERCENTAGE)->toLength(conversionDataZoom3, NonNegativeValues));
EXPECT_EQ(
Length(CalculationValue::create(
@@ -181,7 +186,7 @@ TEST_F(AnimationAnimatableLengthTest, ToLength)
adoptPtr(new CalcExpressionLength(Length(-5, Percent))),
CalcAdd)),
ValueRangeAll)),
- create(-5, CSSPrimitiveValue::CSS_PX, -5, CSSPrimitiveValue::CSS_PERCENTAGE)->toLength(style.get(), style.get(), 1));
+ create(-5, CSSPrimitiveValue::CSS_PX, -5, CSSPrimitiveValue::CSS_PERCENTAGE)->toLength(conversionDataZoom1));
EXPECT_EQ(
Length(CalculationValue::create(
adoptPtr(new CalcExpressionBinaryOperation(
@@ -189,7 +194,7 @@ TEST_F(AnimationAnimatableLengthTest, ToLength)
adoptPtr(new CalcExpressionLength(Length(-5, Percent))),
CalcAdd)),
ValueRangeAll)),
- create(-5, CSSPrimitiveValue::CSS_PX, -5, CSSPrimitiveValue::CSS_PERCENTAGE)->toLength(style.get(), style.get(), 3));
+ create(-5, CSSPrimitiveValue::CSS_PX, -5, CSSPrimitiveValue::CSS_PERCENTAGE)->toLength(conversionDataZoom3));
EXPECT_EQ(
Length(CalculationValue::create(
adoptPtr(new CalcExpressionBinaryOperation(
@@ -197,7 +202,7 @@ TEST_F(AnimationAnimatableLengthTest, ToLength)
adoptPtr(new CalcExpressionLength(Length(-5, Percent))),
CalcAdd)),
ValueRangeNonNegative)),
- create(-5, CSSPrimitiveValue::CSS_PX, -5, CSSPrimitiveValue::CSS_PERCENTAGE)->toLength(style.get(), style.get(), 1, NonNegativeValues));
+ create(-5, CSSPrimitiveValue::CSS_PX, -5, CSSPrimitiveValue::CSS_PERCENTAGE)->toLength(conversionDataZoom1, NonNegativeValues));
EXPECT_EQ(
Length(CalculationValue::create(
adoptPtr(new CalcExpressionBinaryOperation(
@@ -205,7 +210,7 @@ TEST_F(AnimationAnimatableLengthTest, ToLength)
adoptPtr(new CalcExpressionLength(Length(-5, Percent))),
CalcAdd)),
ValueRangeNonNegative)),
- create(-5, CSSPrimitiveValue::CSS_PX, -5, CSSPrimitiveValue::CSS_PERCENTAGE)->toLength(style.get(), style.get(), 3, NonNegativeValues));
+ create(-5, CSSPrimitiveValue::CSS_PX, -5, CSSPrimitiveValue::CSS_PERCENTAGE)->toLength(conversionDataZoom3, NonNegativeValues));
}
TEST_F(AnimationAnimatableLengthTest, Interpolate)
« no previous file with comments | « Source/core/animation/AnimatableLength.cpp ('k') | Source/core/core.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698