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

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

Issue 1164573002: CSSValue Immediates: Change CSSValue to an object instead of a pointer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 5 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
« no previous file with comments | « Source/core/animation/LengthStyleInterpolation.cpp ('k') | Source/core/animation/ListStyleInterpolation.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/animation/LengthStyleInterpolationTest.cpp
diff --git a/Source/core/animation/LengthStyleInterpolationTest.cpp b/Source/core/animation/LengthStyleInterpolationTest.cpp
index ad87898e2a9767a1792d31b38661883ef945da00..c5bee494f234a3f71c4322a2662ef0ebb544d7a7 100644
--- a/Source/core/animation/LengthStyleInterpolationTest.cpp
+++ b/Source/core/animation/LengthStyleInterpolationTest.cpp
@@ -19,14 +19,14 @@ protected:
return LengthStyleInterpolation::toInterpolableValue(value);
}
- static PassRefPtrWillBeRawPtr<CSSValue> interpolableValueToLength(InterpolableValue* value, InterpolationRange range)
+ static CSSValue interpolableValueToLength(InterpolableValue* value, InterpolationRange range)
{
return LengthStyleInterpolation::fromInterpolableValue(*value, range);
}
- static PassRefPtrWillBeRawPtr<CSSValue> roundTrip(PassRefPtrWillBeRawPtr<CSSValue> value)
+ static CSSValue roundTrip(CSSValue value)
{
- return interpolableValueToLength(lengthToInterpolableValue(*value).get(), RangeAll);
+ return interpolableValueToLength(lengthToInterpolableValue(value).get(), RangeAll);
}
static PassOwnPtrWillBeRawPtr<InterpolableList> createInterpolableLength(double a, double b, double c, double d, double e, double f, double g, double h, double i, double j)
@@ -59,35 +59,35 @@ protected:
initLengthArray(lengthArray);
RefPtrWillBeRawPtr<MutableStylePropertySet> propertySet = MutableStylePropertySet::create();
propertySet->setProperty(CSSPropertyLeft, text);
- toCSSPrimitiveValue(propertySet->getPropertyCSSValue(CSSPropertyLeft).get())->accumulateLengthArray(lengthArray);
+ toCSSPrimitiveValue(propertySet->getPropertyCSSValue(CSSPropertyLeft))->accumulateLengthArray(lengthArray);
return lengthArray;
}
};
-#define TEST_PRIMITIVE_VALUE(ACTUAL_VALUE, EXPECTED_DOUBLE_VALUE, EXPECTED_UNIT_TYPE) \
- EXPECT_TRUE((ACTUAL_VALUE)->isPrimitiveValue()); \
- EXPECT_EQ((EXPECTED_DOUBLE_VALUE), toCSSPrimitiveValue((ACTUAL_VALUE).get())->getDoubleValue()); \
- EXPECT_EQ((EXPECTED_UNIT_TYPE), toCSSPrimitiveValue((ACTUAL_VALUE).get())->primitiveType());
+#define TEST_PRIMITIVE_VALUE(ACTUAL_VALUE, EXPECTED_DOUBLE_VALUE, EXPECTED_UNIT_TYPE) \
+EXPECT_TRUE((ACTUAL_VALUE).isPrimitiveValue()); \
+EXPECT_EQ((EXPECTED_DOUBLE_VALUE), toCSSPrimitiveValue((ACTUAL_VALUE)).getDoubleValue()); \
+EXPECT_EQ((EXPECTED_UNIT_TYPE), toCSSPrimitiveValue((ACTUAL_VALUE)).primitiveType());
-#define EXPECT_CSS_LENGTH_ARRAY_ELEMENTS_EQUAL(EXPECTED, ACTUAL) \
- for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; ++i) \
- EXPECT_EQ((EXPECTED).at(i), (ACTUAL).at(i))
+#define EXPECT_CSS_LENGTH_ARRAY_ELEMENTS_EQUAL(EXPECTED, ACTUAL) \
+for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; ++i) \
+ EXPECT_EQ((EXPECTED).at(i), (ACTUAL).at(i));
TEST_F(AnimationLengthStyleInterpolationTest, ZeroLength)
{
- RefPtrWillBeRawPtr<CSSValue> value1 = roundTrip(CSSPrimitiveValue::create(0, CSSPrimitiveValue::CSS_PX));
+ CSSValue value1 = roundTrip(CSSPrimitiveValue::create(0, CSSPrimitiveValue::CSS_PX));
TEST_PRIMITIVE_VALUE(value1, 0, CSSPrimitiveValue::CSS_PX);
- RefPtrWillBeRawPtr<CSSValue> value2 = roundTrip(CSSPrimitiveValue::create(0, CSSPrimitiveValue::CSS_PERCENTAGE));
+ CSSValue value2 = roundTrip(CSSPrimitiveValue::create(0, CSSPrimitiveValue::CSS_PERCENTAGE));
TEST_PRIMITIVE_VALUE(value2, 0, CSSPrimitiveValue::CSS_PERCENTAGE);
- RefPtrWillBeRawPtr<CSSValue> value3 = roundTrip(CSSPrimitiveValue::create(0, CSSPrimitiveValue::CSS_EMS));
+ CSSValue value3 = roundTrip(CSSPrimitiveValue::create(0, CSSPrimitiveValue::CSS_EMS));
TEST_PRIMITIVE_VALUE(value3, 0, CSSPrimitiveValue::CSS_EMS);
}
TEST_F(AnimationLengthStyleInterpolationTest, SingleUnit)
{
- RefPtrWillBeRawPtr<CSSValue> value = roundTrip(CSSPrimitiveValue::create(10, CSSPrimitiveValue::CSS_PX));
+ CSSValue value = roundTrip(CSSPrimitiveValue::create(10, CSSPrimitiveValue::CSS_PX));
TEST_PRIMITIVE_VALUE(value, 10, CSSPrimitiveValue::CSS_PX);
value = roundTrip(CSSPrimitiveValue::create(30, CSSPrimitiveValue::CSS_PERCENTAGE));
@@ -99,12 +99,12 @@ TEST_F(AnimationLengthStyleInterpolationTest, SingleUnit)
TEST_F(AnimationLengthStyleInterpolationTest, SingleClampedUnit)
{
- RefPtrWillBeRawPtr<CSSValue> value1 = CSSPrimitiveValue::create(-10, CSSPrimitiveValue::CSS_PX);
- value1 = interpolableValueToLength(lengthToInterpolableValue(*value1).get(), RangeNonNegative);
+ CSSValue value1 = CSSPrimitiveValue::create(-10, CSSPrimitiveValue::CSS_PX);
+ value1 = interpolableValueToLength(lengthToInterpolableValue(value1).get(), RangeNonNegative);
TEST_PRIMITIVE_VALUE(value1, 0, CSSPrimitiveValue::CSS_PX);
- RefPtrWillBeRawPtr<CSSValue> value2 = CSSPrimitiveValue::create(-10, CSSPrimitiveValue::CSS_EMS);
- value2 = interpolableValueToLength(lengthToInterpolableValue(*value2).get(), RangeNonNegative);
+ CSSValue value2 = CSSPrimitiveValue::create(-10, CSSPrimitiveValue::CSS_EMS);
+ value2 = interpolableValueToLength(lengthToInterpolableValue(value2).get(), RangeNonNegative);
TEST_PRIMITIVE_VALUE(value2, 0, CSSPrimitiveValue::CSS_EMS);
}
@@ -115,8 +115,9 @@ TEST_F(AnimationLengthStyleInterpolationTest, MultipleUnits)
OwnPtrWillBeRawPtr<InterpolableList> result = InterpolableList::create(2);
result->set(0, createInterpolableLength(0, 10, 0, 10, 0, 10, 0, 10, 0, 10));
result->set(1, createInterpolableLength(0, 1, 0, 1, 0, 1, 0, 1, 0, 1));
- toCSSPrimitiveValue(interpolableValueToLength(result.get(), RangeAll).get())->accumulateLengthArray(expectation);
+ toCSSPrimitiveValue(interpolableValueToLength(result.get(), RangeAll)).accumulateLengthArray(expectation);
setLengthArray(actual, "calc(10% + 10ex + 10ch + 10vh + 10vmax)");
+
EXPECT_CSS_LENGTH_ARRAY_ELEMENTS_EQUAL(expectation, actual);
}
@@ -127,7 +128,7 @@ TEST_F(AnimationLengthStyleInterpolationTest, MultipleUnitsWithSingleValues)
OwnPtrWillBeRawPtr<InterpolableList> result = InterpolableList::create(2);
result->set(0, createInterpolableLength(0, 10, 0, 10, 0, 10, 0, 10, 0, 10));
result->set(1, createInterpolableLength(0, 1, 0, 1, 0, 1, 0, 1, 0, 1));
- toCSSPrimitiveValue(interpolableValueToLength(result.get(), RangeAll).get())->accumulateLengthArray(expectation);
+ toCSSPrimitiveValue(interpolableValueToLength(result.get(), RangeAll)).accumulateLengthArray(expectation);
setLengthArray(actual, "calc(10% + 10ex + 10ch + 10vh + 10vmax)");
EXPECT_CSS_LENGTH_ARRAY_ELEMENTS_EQUAL(expectation, actual);
}
@@ -139,7 +140,7 @@ TEST_F(AnimationLengthStyleInterpolationTest, MultipleUnitsWithMultipleValues)
OwnPtrWillBeRawPtr<InterpolableList> result = InterpolableList::create(2);
result->set(0, createInterpolableLength(0, 20, 0, 30, 0, 8, 0, 10, 0, 7));
result->set(1, createInterpolableLength(0, 1, 0, 1, 0, 1, 0, 1, 0, 1));
- toCSSPrimitiveValue(interpolableValueToLength(result.get(), RangeAll).get())->accumulateLengthArray(expectation);
+ toCSSPrimitiveValue(interpolableValueToLength(result.get(), RangeAll)).accumulateLengthArray(expectation);
setLengthArray(actual, "calc(20% + 30ex + 8ch + 10vh + 7vmax)");
EXPECT_CSS_LENGTH_ARRAY_ELEMENTS_EQUAL(expectation, actual);
}
@@ -151,7 +152,7 @@ TEST_F(AnimationLengthStyleInterpolationTest, MultipleUnitsWithZeroValue)
OwnPtrWillBeRawPtr<InterpolableList> result = InterpolableList::create(2);
result->set(0, createInterpolableLength(0, 10, 0, 10, 0, 10, 0, 10, 0, 10));
result->set(1, createInterpolableLength(1, 1, 0, 1, 0, 1, 0, 1, 0, 1));
- toCSSPrimitiveValue(interpolableValueToLength(result.get(), RangeAll).get())->accumulateLengthArray(expectation);
+ toCSSPrimitiveValue(interpolableValueToLength(result.get(), RangeAll)).accumulateLengthArray(expectation);
setLengthArray(actual, "calc(0px + 10% + 10ex + 10ch + 10vh + 10vmax)");
EXPECT_CSS_LENGTH_ARRAY_ELEMENTS_EQUAL(expectation, actual);
}
@@ -163,7 +164,7 @@ TEST_F(AnimationLengthStyleInterpolationTest, MultipleUnitsWithZeroValues)
OwnPtrWillBeRawPtr<InterpolableList> result = InterpolableList::create(2);
result->set(0, createInterpolableLength(0, 10, 0, 10, 0, 10, 0, 10, 0, 10));
result->set(1, createInterpolableLength(1, 1, 1, 1, 0, 1, 0, 1, 1, 1));
- toCSSPrimitiveValue(interpolableValueToLength(result.get(), RangeAll).get())->accumulateLengthArray(expectation);
+ toCSSPrimitiveValue(interpolableValueToLength(result.get(), RangeAll)).accumulateLengthArray(expectation);
setLengthArray(actual, "calc(0px + 10% + 0em + 10ex + 10ch + 10vh + 0vmin + 10vmax)");
EXPECT_CSS_LENGTH_ARRAY_ELEMENTS_EQUAL(expectation, actual);
}
« no previous file with comments | « Source/core/animation/LengthStyleInterpolation.cpp ('k') | Source/core/animation/ListStyleInterpolation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698