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

Side by Side Diff: Source/core/animation/ShadowStyleInterpolationTest.cpp

Issue 1226123008: CSSValue Immediates: Replace CSSPrimitiveValue usage with const references (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@cssvalue_patch_4_attempt_2
Patch Set: Rebase Created 5 years, 4 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 unified diff | Download patch
OLDNEW
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"
(...skipping 23 matching lines...) Expand all
34 return interpolableValueToShadow(shadowToInterpolableValue(value, styleF lag).get(), styleFlag); 34 return interpolableValueToShadow(shadowToInterpolableValue(value, styleF lag).get(), styleFlag);
35 } 35 }
36 36
37 static void testPrimitiveValues(CSSValue value, double xExpected, double yEx pected, double blurExpected, double spreadExpected, 37 static void testPrimitiveValues(CSSValue value, double xExpected, double yEx pected, double blurExpected, double spreadExpected,
38 RGBA32 colorExpected, CSSPrimitiveValue idExpected, CSSPrimitiveValue::U nitType unitType) 38 RGBA32 colorExpected, CSSPrimitiveValue idExpected, CSSPrimitiveValue::U nitType unitType)
39 { 39 {
40 EXPECT_TRUE(value.isShadowValue()); 40 EXPECT_TRUE(value.isShadowValue());
41 41
42 CSSShadowValue& shadowValue = toCSSShadowValue(value); 42 CSSShadowValue& shadowValue = toCSSShadowValue(value);
43 43
44 EXPECT_EQ(xExpected, toCSSPrimitiveValue(*shadowValue.x).getDoubleValue( )); 44 EXPECT_EQ(xExpected, toCSSPrimitiveValue(shadowValue.x).getDoubleValue() );
45 EXPECT_EQ(yExpected, toCSSPrimitiveValue(*shadowValue.y).getDoubleValue( )); 45 EXPECT_EQ(yExpected, toCSSPrimitiveValue(shadowValue.y).getDoubleValue() );
46 EXPECT_EQ(blurExpected, toCSSPrimitiveValue(*shadowValue.blur).getDouble Value()); 46 EXPECT_EQ(blurExpected, toCSSPrimitiveValue(shadowValue.blur).getDoubleV alue());
47 EXPECT_EQ(spreadExpected, toCSSPrimitiveValue(*shadowValue.spread).getDo ubleValue()); 47 EXPECT_EQ(spreadExpected, toCSSPrimitiveValue(shadowValue.spread).getDou bleValue());
48 EXPECT_EQ(colorExpected, toCSSPrimitiveValue(*shadowValue.color).getRGBA 32Value()); 48 EXPECT_EQ(colorExpected, toCSSPrimitiveValue(shadowValue.color).getRGBA3 2Value());
49 49
50 EXPECT_EQ(idExpected.getValueID(), toCSSPrimitiveValue(*shadowValue.styl e).getValueID()); 50 EXPECT_EQ(idExpected.getValueID(), toCSSPrimitiveValue(shadowValue.style ).getValueID());
51 51
52 EXPECT_EQ(toCSSPrimitiveValue(*shadowValue.x).primitiveType(), unitType) ; 52 EXPECT_EQ(toCSSPrimitiveValue(shadowValue.x).primitiveType(), unitType);
53 EXPECT_EQ(toCSSPrimitiveValue(*shadowValue.y).primitiveType(), unitType) ; 53 EXPECT_EQ(toCSSPrimitiveValue(shadowValue.y).primitiveType(), unitType);
54 EXPECT_EQ(toCSSPrimitiveValue(*shadowValue.blur).primitiveType(), unitTy pe); 54 EXPECT_EQ(toCSSPrimitiveValue(shadowValue.blur).primitiveType(), unitTyp e);
55 EXPECT_EQ(toCSSPrimitiveValue(*shadowValue.spread).primitiveType(), unit Type); 55 EXPECT_EQ(toCSSPrimitiveValue(shadowValue.spread).primitiveType(), unitT ype);
56 } 56 }
57 57
58 }; 58 };
59 59
60 TEST_F(AnimationShadowStyleInterpolationTest, ZeroTest) 60 TEST_F(AnimationShadowStyleInterpolationTest, ZeroTest)
61 { 61 {
62 CSSPrimitiveValue color = CSSPrimitiveValue::createColor(makeRGBA(0, 0, 0, 0 )); 62 CSSPrimitiveValue color = CSSPrimitiveValue::createColor(makeRGBA(0, 0, 0, 0 ));
63 CSSPrimitiveValue x = CSSPrimitiveValue::create(0, CSSPrimitiveValue::CSS_PX ); 63 CSSPrimitiveValue x = CSSPrimitiveValue::create(0, CSSPrimitiveValue::CSS_PX );
64 CSSPrimitiveValue y = CSSPrimitiveValue::create(0, CSSPrimitiveValue::CSS_PX ); 64 CSSPrimitiveValue y = CSSPrimitiveValue::create(0, CSSPrimitiveValue::CSS_PX );
65 CSSPrimitiveValue blur = CSSPrimitiveValue::create(0, CSSPrimitiveValue::CSS _PX); 65 CSSPrimitiveValue blur = CSSPrimitiveValue::create(0, CSSPrimitiveValue::CSS _PX);
(...skipping 30 matching lines...) Expand all
96 CSSPrimitiveValue spread = CSSPrimitiveValue::create(40, CSSPrimitiveValue:: CSS_PX); 96 CSSPrimitiveValue spread = CSSPrimitiveValue::create(40, CSSPrimitiveValue:: CSS_PX);
97 97
98 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);
99 99
100 CSSValue value = roundTrip(shadowValue.release(), true); 100 CSSValue value = roundTrip(shadowValue.release(), true);
101 101
102 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);
103 } 103 }
104 104
105 } 105 }
OLDNEW
« no previous file with comments | « Source/core/animation/ShadowStyleInterpolation.cpp ('k') | Source/core/animation/StringKeyframe.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698