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

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

Issue 273903002: Web Animations API: Length properties responsive to style changes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 years, 7 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/interpolation/LengthStyleInterpolation.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/animation/interpolation/LengthStyleInterpolationTest.cpp
diff --git a/Source/core/animation/interpolation/LengthStyleInterpolationTest.cpp b/Source/core/animation/interpolation/LengthStyleInterpolationTest.cpp
index 228782a2ba4dacd919bcb845e8b843dd500a76f2..bdbf9ec8360b95b20fa22916ec64f49331f6214e 100644
--- a/Source/core/animation/interpolation/LengthStyleInterpolationTest.cpp
+++ b/Source/core/animation/interpolation/LengthStyleInterpolationTest.cpp
@@ -19,14 +19,14 @@ protected:
return LengthStyleInterpolation::lengthToInterpolableValue(value);
}
- static PassRefPtrWillBeRawPtr<CSSValue> interpolableValueToLength(InterpolableValue* value)
+ static PassRefPtrWillBeRawPtr<CSSValue> interpolableValueToLength(InterpolableValue* value, ValueRange range)
{
- return LengthStyleInterpolation::interpolableValueToLength(value);
+ return LengthStyleInterpolation::interpolableValueToLength(value, range);
}
static PassRefPtrWillBeRawPtr<CSSValue> roundTrip(PassRefPtrWillBeRawPtr<CSSValue> value)
{
- return interpolableValueToLength(lengthToInterpolableValue(value.get()).get());
+ return interpolableValueToLength(lengthToInterpolableValue(value.get()).get(), ValueRangeAll);
}
static void testPrimitiveValue(RefPtrWillBeRawPtr<CSSValue> value, double doubleValue, CSSPrimitiveValue::UnitTypes unitType)
@@ -95,6 +95,16 @@ TEST_F(AnimationLengthStyleInterpolationTest, SingleUnit)
value = roundTrip(CSSPrimitiveValue::create(30, CSSPrimitiveValue::CSS_PERCENTAGE));
testPrimitiveValue(value, 30, CSSPrimitiveValue::CSS_PERCENTAGE);
+
+ value = roundTrip(CSSPrimitiveValue::create(-10, CSSPrimitiveValue::CSS_EMS));
+ testPrimitiveValue(value, -10, CSSPrimitiveValue::CSS_EMS);
+}
+
+TEST_F(AnimationLengthStyleInterpolationTest, SingleClampedUnit)
+{
+ RefPtrWillBeRawPtr<CSSValue> value = CSSPrimitiveValue::create(-10, CSSPrimitiveValue::CSS_EMS);
+ value = interpolableValueToLength(lengthToInterpolableValue(value.get()).get(), ValueRangeNonNegative);
+ testPrimitiveValue(value, 0, CSSPrimitiveValue::CSS_EMS);
}
TEST_F(AnimationLengthStyleInterpolationTest, MultipleUnits)
@@ -102,7 +112,7 @@ TEST_F(AnimationLengthStyleInterpolationTest, MultipleUnits)
CSSLengthArray actual, expectation;
initLengthArray(expectation);
OwnPtrWillBeRawPtr<InterpolableList> list = createInterpolableLength(0, 10, 0, 10, 0, 10, 0, 10, 0, 10);
- toCSSPrimitiveValue(interpolableValueToLength(list.get()).get())->accumulateLengthArray(expectation);
+ toCSSPrimitiveValue(interpolableValueToLength(list.get(), ValueRangeAll).get())->accumulateLengthArray(expectation);
EXPECT_TRUE(lengthArraysEqual(expectation, setLengthArray(actual, "calc(10%% + 10ex + 10ch + 10vh + 10vmax)")));
}
« no previous file with comments | « Source/core/animation/interpolation/LengthStyleInterpolation.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698