/** * @brief getCachedValue Retrieve attribute value from the cache returning a * default value if the cache was empty. * @param errorValue The value to return if the value could not be found in * the cache. * @return The value of the attribute or errorValue. */ valueptr_t getCachedValue(const value_t &errorValue) { valueptr_t result = getCachedValue(); if (!result) result = std::make_shared<const value_t>(errorValue); return result; }
TEST_F(AnimationDoubleStyleInterpolationTest, Clamping) { RefPtrWillBeRawPtr<Interpolation> interpolableDouble = DoubleStyleInterpolation::create( *CSSPrimitiveValue::create(0, CSSPrimitiveValue::CSS_NUMBER), *CSSPrimitiveValue::create(0.6, CSSPrimitiveValue::CSS_NUMBER), CSSPropertyLineHeight, CSSPrimitiveValue::CSS_NUMBER, RangeAll); interpolableDouble->interpolate(0, 0.4); // progVal = start*(1-prog) + end*prog EXPECT_EQ(0.24, toInterpolableNumber(getCachedValue(*interpolableDouble))->value()); }