TEST_F(AnimationLengthStyleInterpolationTest, SingleClampedUnit)
{
    RefPtrWillBeRawPtr<CSSValue> value1 = CSSPrimitiveValue::create(-10, CSSPrimitiveValue::UnitType::Pixels);
    value1 = interpolableValueToLength(lengthToInterpolableValue(*value1).get(), RangeNonNegative);
    TEST_PRIMITIVE_VALUE(value1, 0, CSSPrimitiveValue::UnitType::Pixels);

    RefPtrWillBeRawPtr<CSSValue> value2 = CSSPrimitiveValue::create(-10, CSSPrimitiveValue::UnitType::Ems);
    value2 = interpolableValueToLength(lengthToInterpolableValue(*value2).get(), RangeNonNegative);
    TEST_PRIMITIVE_VALUE(value2, 0, CSSPrimitiveValue::UnitType::Ems);
}
TEST_F(AnimationLengthStyleInterpolationTest, MultipleUnits)
{
    CSSLengthArray actual, expectation;
    initLengthArray(expectation);
    OwnPtr<InterpolableList> list = createInterpolableLength(0, 10, 0, 10, 0, 10, 0, 10, 0, 10);
    toCSSPrimitiveValue(interpolableValueToLength(list.get(), ValueRangeAll).get())->accumulateLengthArray(expectation);
    EXPECT_TRUE(lengthArraysEqual(expectation, setLengthArray(actual, "calc(10%% + 10ex + 10ch + 10vh + 10vmax)")));
}
TEST_F(AnimationLengthStyleInterpolationTest, MultipleUnitsWithZeroValues)
{
    CSSLengthArray expectation, actual;
    initLengthArray(expectation);
    OwnPtr<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);
    setLengthArray(actual, "calc(0px + 10% + 0em + 10ex + 10ch + 10vh + 0vmin + 10vmax)");
    EXPECT_CSS_LENGTH_ARRAY_ELEMENTS_EQUAL(expectation, actual);
}
 static PassRefPtr<CSSValue> roundTrip(PassRefPtr<CSSValue> value)
 {
     return interpolableValueToLength(lengthToInterpolableValue(value.get()).get(), ValueRangeAll);
 }
TEST_F(AnimationLengthStyleInterpolationTest, SingleClampedUnit)
{
    RefPtr<CSSValue> value = CSSPrimitiveValue::create(-10, CSSPrimitiveValue::CSS_EMS);
    value = interpolableValueToLength(lengthToInterpolableValue(value.get()).get(), ValueRangeNonNegative);
    testPrimitiveValue(value, 0, CSSPrimitiveValue::CSS_EMS);
}
void LengthStyleInterpolation::apply(StyleResolverState& state) const
{
    StyleBuilder::applyProperty(m_id, state, interpolableValueToLength(m_cachedValue.get(), m_range).get());
}
 static PassRefPtrWillBeRawPtr<CSSValue> roundTrip(PassRefPtrWillBeRawPtr<CSSValue> value)
 {
     return interpolableValueToLength(lengthToInterpolableValue(*value).get(), RangeAll);
 }