| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "core/animation/ShadowStyleInterpolation.h" | 6 #include "core/animation/ShadowStyleInterpolation.h" |
| 7 | 7 |
| 8 #include "core/css/CSSPrimitiveValue.h" | 8 #include "core/css/CSSPrimitiveValue.h" |
| 9 #include "core/css/CSSShadowValue.h" | 9 #include "core/css/CSSShadowValue.h" |
| 10 #include "core/css/CSSValue.h" | 10 #include "core/css/CSSValue.h" |
| 11 #include "core/css/resolver/StyleBuilder.h" | 11 #include "core/css/resolver/StyleBuilder.h" |
| 12 #include "platform/graphics/Color.h" | 12 #include "platform/graphics/Color.h" |
| 13 | 13 |
| 14 #include <gtest/gtest.h> | 14 #include <gtest/gtest.h> |
| 15 | 15 |
| 16 namespace blink { | 16 namespace blink { |
| 17 | 17 |
| 18 class AnimationShadowStyleInterpolationTest : public ::testing::Test { | 18 class AnimationShadowStyleInterpolationTest : public ::testing::Test { |
| 19 | 19 |
| 20 protected: | 20 protected: |
| 21 | 21 |
| 22 static PassOwnPtrWillBeRawPtr<InterpolableValue> shadowToInterpolableValue(c
onst CSSValue& value, bool styleFlag) |
| 23 { |
| 24 return ShadowStyleInterpolation::shadowToInterpolableValue(value, styleF
lag); |
| 25 } |
| 26 |
| 27 static PassRefPtrWillBeRawPtr<CSSValue> interpolableValueToShadow(Interpolab
leValue* value, bool styleFlag) |
| 28 { |
| 29 return ShadowStyleInterpolation::interpolableValueToShadow(*value, style
Flag); |
| 30 } |
| 31 |
| 22 static PassRefPtrWillBeRawPtr<CSSValue> roundTrip(PassRefPtrWillBeRawPtr<CSS
Value> value, bool styleFlag) | 32 static PassRefPtrWillBeRawPtr<CSSValue> roundTrip(PassRefPtrWillBeRawPtr<CSS
Value> value, bool styleFlag) |
| 23 { | 33 { |
| 24 return ShadowStyleInterpolation::interpolableValueToShadow(ShadowStyleIn
terpolation::shadowToInterpolableValue(*value).get(), styleFlag); | 34 return interpolableValueToShadow(shadowToInterpolableValue(*value, style
Flag).get(), styleFlag); |
| 25 } | 35 } |
| 26 | 36 |
| 27 static void testPrimitiveValues(RefPtrWillBeRawPtr<CSSValue> value, double x
Expected, double yExpected, double blurExpected, double spreadExpected, | 37 static void testPrimitiveValues(RefPtrWillBeRawPtr<CSSValue> value, double x
Expected, double yExpected, double blurExpected, double spreadExpected, |
| 28 RGBA32 colorExpected, RefPtrWillBeRawPtr<CSSPrimitiveValue> idExpected,
CSSPrimitiveValue::UnitType unitType) | 38 RGBA32 colorExpected, RefPtrWillBeRawPtr<CSSPrimitiveValue> idExpected,
CSSPrimitiveValue::UnitType unitType) |
| 29 { | 39 { |
| 30 EXPECT_TRUE(value->isShadowValue()); | 40 EXPECT_TRUE(value->isShadowValue()); |
| 31 | 41 |
| 32 CSSShadowValue& shadowValue = toCSSShadowValue(*value); | 42 CSSShadowValue& shadowValue = toCSSShadowValue(*value); |
| 33 | 43 |
| 34 EXPECT_EQ(xExpected, shadowValue.x->getDoubleValue()); | 44 EXPECT_EQ(xExpected, shadowValue.x->getDoubleValue()); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 RefPtrWillBeRawPtr<CSSPrimitiveValue> spread = CSSPrimitiveValue::create(40,
CSSPrimitiveValue::CSS_PX); | 96 RefPtrWillBeRawPtr<CSSPrimitiveValue> spread = CSSPrimitiveValue::create(40,
CSSPrimitiveValue::CSS_PX); |
| 87 | 97 |
| 88 RefPtrWillBeRawPtr<CSSShadowValue> shadowValue = CSSShadowValue::create(x, y
, blur, spread, CSSPrimitiveValue::createIdentifier(CSSValueInset), color); | 98 RefPtrWillBeRawPtr<CSSShadowValue> shadowValue = CSSShadowValue::create(x, y
, blur, spread, CSSPrimitiveValue::createIdentifier(CSSValueInset), color); |
| 89 | 99 |
| 90 RefPtrWillBeRawPtr<CSSValue> value = roundTrip(shadowValue.release(), true); | 100 RefPtrWillBeRawPtr<CSSValue> value = roundTrip(shadowValue.release(), true); |
| 91 | 101 |
| 92 testPrimitiveValues(value, 10, 20, 30, 40, makeRGBA(54, 48, 214, 64), CSSPri
mitiveValue::createIdentifier(CSSValueInset), CSSPrimitiveValue::CSS_PX); | 102 testPrimitiveValues(value, 10, 20, 30, 40, makeRGBA(54, 48, 214, 64), CSSPri
mitiveValue::createIdentifier(CSSValueInset), CSSPrimitiveValue::CSS_PX); |
| 93 } | 103 } |
| 94 | 104 |
| 95 } | 105 } |
| OLD | NEW |