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

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

Issue 1376573004: Split out Color from CSSPrimitiveValue (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@split_property
Patch Set: Rebase and review feedback Created 5 years, 2 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/CSSColorValue.h"
8 #include "core/css/CSSPrimitiveValue.h" 9 #include "core/css/CSSPrimitiveValue.h"
9 #include "core/css/CSSShadowValue.h" 10 #include "core/css/CSSShadowValue.h"
10 #include "core/css/CSSValue.h" 11 #include "core/css/CSSValue.h"
11 #include "core/css/resolver/StyleBuilder.h" 12 #include "core/css/resolver/StyleBuilder.h"
12 #include "platform/graphics/Color.h" 13 #include "platform/graphics/Color.h"
13 14
14 #include <gtest/gtest.h> 15 #include <gtest/gtest.h>
15 16
16 namespace blink { 17 namespace blink {
17 18
(...skipping 20 matching lines...) Expand all
38 RGBA32 colorExpected, RefPtrWillBeRawPtr<CSSPrimitiveValue> idExpected, CSSPrimitiveValue::UnitType unitType) 39 RGBA32 colorExpected, RefPtrWillBeRawPtr<CSSPrimitiveValue> idExpected, CSSPrimitiveValue::UnitType unitType)
39 { 40 {
40 EXPECT_TRUE(value->isShadowValue()); 41 EXPECT_TRUE(value->isShadowValue());
41 42
42 CSSShadowValue& shadowValue = toCSSShadowValue(*value); 43 CSSShadowValue& shadowValue = toCSSShadowValue(*value);
43 44
44 EXPECT_EQ(xExpected, shadowValue.x->getDoubleValue()); 45 EXPECT_EQ(xExpected, shadowValue.x->getDoubleValue());
45 EXPECT_EQ(yExpected, shadowValue.y->getDoubleValue()); 46 EXPECT_EQ(yExpected, shadowValue.y->getDoubleValue());
46 EXPECT_EQ(blurExpected, shadowValue.blur->getDoubleValue()); 47 EXPECT_EQ(blurExpected, shadowValue.blur->getDoubleValue());
47 EXPECT_EQ(spreadExpected, shadowValue.spread->getDoubleValue()); 48 EXPECT_EQ(spreadExpected, shadowValue.spread->getDoubleValue());
48 EXPECT_EQ(colorExpected, shadowValue.color->getRGBA32Value()); 49 EXPECT_EQ(colorExpected, toCSSColorValue(*shadowValue.color).value());
49 50
50 EXPECT_EQ(idExpected->getValueID(), shadowValue.style->getValueID()); 51 EXPECT_EQ(idExpected->getValueID(), shadowValue.style->getValueID());
51 52
52 EXPECT_EQ(shadowValue.x->typeWithCalcResolved(), unitType); 53 EXPECT_EQ(shadowValue.x->typeWithCalcResolved(), unitType);
53 EXPECT_EQ(shadowValue.y->typeWithCalcResolved(), unitType); 54 EXPECT_EQ(shadowValue.y->typeWithCalcResolved(), unitType);
54 EXPECT_EQ(shadowValue.blur->typeWithCalcResolved(), unitType); 55 EXPECT_EQ(shadowValue.blur->typeWithCalcResolved(), unitType);
55 EXPECT_EQ(shadowValue.spread->typeWithCalcResolved(), unitType); 56 EXPECT_EQ(shadowValue.spread->typeWithCalcResolved(), unitType);
56 } 57 }
57 58
58 }; 59 };
59 60
60 TEST_F(AnimationShadowStyleInterpolationTest, ZeroTest) 61 TEST_F(AnimationShadowStyleInterpolationTest, ZeroTest)
61 { 62 {
62 RefPtrWillBeRawPtr<CSSPrimitiveValue> color = CSSPrimitiveValue::createColor (makeRGBA(0, 0, 0, 0)); 63 RefPtrWillBeRawPtr<CSSColorValue> color = CSSColorValue::create(makeRGBA(0, 0, 0, 0));
63 RefPtrWillBeRawPtr<CSSPrimitiveValue> x = CSSPrimitiveValue::create(0, CSSPr imitiveValue::UnitType::Pixels); 64 RefPtrWillBeRawPtr<CSSPrimitiveValue> x = CSSPrimitiveValue::create(0, CSSPr imitiveValue::UnitType::Pixels);
64 RefPtrWillBeRawPtr<CSSPrimitiveValue> y = CSSPrimitiveValue::create(0, CSSPr imitiveValue::UnitType::Pixels); 65 RefPtrWillBeRawPtr<CSSPrimitiveValue> y = CSSPrimitiveValue::create(0, CSSPr imitiveValue::UnitType::Pixels);
65 RefPtrWillBeRawPtr<CSSPrimitiveValue> blur = CSSPrimitiveValue::create(0, CS SPrimitiveValue::UnitType::Pixels); 66 RefPtrWillBeRawPtr<CSSPrimitiveValue> blur = CSSPrimitiveValue::create(0, CS SPrimitiveValue::UnitType::Pixels);
66 RefPtrWillBeRawPtr<CSSPrimitiveValue> spread = CSSPrimitiveValue::create(0, CSSPrimitiveValue::UnitType::Pixels); 67 RefPtrWillBeRawPtr<CSSPrimitiveValue> spread = CSSPrimitiveValue::create(0, CSSPrimitiveValue::UnitType::Pixels);
67 68
68 RefPtrWillBeRawPtr<CSSShadowValue> shadowValue = CSSShadowValue::create(x, y , blur, spread, CSSPrimitiveValue::createIdentifier(CSSValueNone), color); 69 RefPtrWillBeRawPtr<CSSShadowValue> shadowValue = CSSShadowValue::create(x, y , blur, spread, CSSPrimitiveValue::createIdentifier(CSSValueNone), color);
69 70
70 RefPtrWillBeRawPtr<CSSValue> value = roundTrip(shadowValue.release(), false) ; 71 RefPtrWillBeRawPtr<CSSValue> value = roundTrip(shadowValue.release(), false) ;
71 72
72 testPrimitiveValues(value, 0, 0, 0, 0, makeRGBA(0, 0, 0, 0), CSSPrimitiveVal ue::createIdentifier(CSSValueNone), CSSPrimitiveValue::UnitType::Pixels); 73 testPrimitiveValues(value, 0, 0, 0, 0, makeRGBA(0, 0, 0, 0), CSSPrimitiveVal ue::createIdentifier(CSSValueNone), CSSPrimitiveValue::UnitType::Pixels);
73 } 74 }
74 75
75 TEST_F(AnimationShadowStyleInterpolationTest, MultipleValueNonPixelTest) 76 TEST_F(AnimationShadowStyleInterpolationTest, MultipleValueNonPixelTest)
76 { 77 {
77 RefPtrWillBeRawPtr<CSSPrimitiveValue> color = CSSPrimitiveValue::createColor (makeRGBA(112, 123, 175, 255)); 78 RefPtrWillBeRawPtr<CSSColorValue> color = CSSColorValue::create(makeRGBA(112 , 123, 175, 255));
78 RefPtrWillBeRawPtr<CSSPrimitiveValue> x = CSSPrimitiveValue::create(10, CSSP rimitiveValue::UnitType::Ems); 79 RefPtrWillBeRawPtr<CSSPrimitiveValue> x = CSSPrimitiveValue::create(10, CSSP rimitiveValue::UnitType::Ems);
79 RefPtrWillBeRawPtr<CSSPrimitiveValue> y = CSSPrimitiveValue::create(20, CSSP rimitiveValue::UnitType::Ems); 80 RefPtrWillBeRawPtr<CSSPrimitiveValue> y = CSSPrimitiveValue::create(20, CSSP rimitiveValue::UnitType::Ems);
80 RefPtrWillBeRawPtr<CSSPrimitiveValue> blur = CSSPrimitiveValue::create(30, C SSPrimitiveValue::UnitType::Ems); 81 RefPtrWillBeRawPtr<CSSPrimitiveValue> blur = CSSPrimitiveValue::create(30, C SSPrimitiveValue::UnitType::Ems);
81 RefPtrWillBeRawPtr<CSSPrimitiveValue> spread = CSSPrimitiveValue::create(40, CSSPrimitiveValue::UnitType::Ems); 82 RefPtrWillBeRawPtr<CSSPrimitiveValue> spread = CSSPrimitiveValue::create(40, CSSPrimitiveValue::UnitType::Ems);
82 83
83 RefPtrWillBeRawPtr<CSSShadowValue> shadowValue = CSSShadowValue::create(x, y , blur, spread, CSSPrimitiveValue::createIdentifier(CSSValueNone), color); 84 RefPtrWillBeRawPtr<CSSShadowValue> shadowValue = CSSShadowValue::create(x, y , blur, spread, CSSPrimitiveValue::createIdentifier(CSSValueNone), color);
84 85
85 RefPtrWillBeRawPtr<CSSValue> value = roundTrip(shadowValue.release(), false) ; 86 RefPtrWillBeRawPtr<CSSValue> value = roundTrip(shadowValue.release(), false) ;
86 87
87 testPrimitiveValues(value, 10, 20, 30, 40, makeRGBA(112, 123, 175, 255), CSS PrimitiveValue::createIdentifier(CSSValueNone), CSSPrimitiveValue::UnitType::Ems ); 88 testPrimitiveValues(value, 10, 20, 30, 40, makeRGBA(112, 123, 175, 255), CSS PrimitiveValue::createIdentifier(CSSValueNone), CSSPrimitiveValue::UnitType::Ems );
88 } 89 }
89 90
90 TEST_F(AnimationShadowStyleInterpolationTest, InsetShadowTest) 91 TEST_F(AnimationShadowStyleInterpolationTest, InsetShadowTest)
91 { 92 {
92 RefPtrWillBeRawPtr<CSSPrimitiveValue> color = CSSPrimitiveValue::createColor (makeRGBA(54, 48, 214, 64)); 93 RefPtrWillBeRawPtr<CSSColorValue> color = CSSColorValue::create(makeRGBA(54, 48, 214, 64));
93 RefPtrWillBeRawPtr<CSSPrimitiveValue> x = CSSPrimitiveValue::create(10, CSSP rimitiveValue::UnitType::Pixels); 94 RefPtrWillBeRawPtr<CSSPrimitiveValue> x = CSSPrimitiveValue::create(10, CSSP rimitiveValue::UnitType::Pixels);
94 RefPtrWillBeRawPtr<CSSPrimitiveValue> y = CSSPrimitiveValue::create(20, CSSP rimitiveValue::UnitType::Pixels); 95 RefPtrWillBeRawPtr<CSSPrimitiveValue> y = CSSPrimitiveValue::create(20, CSSP rimitiveValue::UnitType::Pixels);
95 RefPtrWillBeRawPtr<CSSPrimitiveValue> blur = CSSPrimitiveValue::create(30, C SSPrimitiveValue::UnitType::Pixels); 96 RefPtrWillBeRawPtr<CSSPrimitiveValue> blur = CSSPrimitiveValue::create(30, C SSPrimitiveValue::UnitType::Pixels);
96 RefPtrWillBeRawPtr<CSSPrimitiveValue> spread = CSSPrimitiveValue::create(40, CSSPrimitiveValue::UnitType::Pixels); 97 RefPtrWillBeRawPtr<CSSPrimitiveValue> spread = CSSPrimitiveValue::create(40, CSSPrimitiveValue::UnitType::Pixels);
97 98
98 RefPtrWillBeRawPtr<CSSShadowValue> shadowValue = CSSShadowValue::create(x, y , blur, spread, CSSPrimitiveValue::createIdentifier(CSSValueInset), color); 99 RefPtrWillBeRawPtr<CSSShadowValue> shadowValue = CSSShadowValue::create(x, y , blur, spread, CSSPrimitiveValue::createIdentifier(CSSValueInset), color);
99 100
100 RefPtrWillBeRawPtr<CSSValue> value = roundTrip(shadowValue.release(), true); 101 RefPtrWillBeRawPtr<CSSValue> value = roundTrip(shadowValue.release(), true);
101 102
102 testPrimitiveValues(value, 10, 20, 30, 40, makeRGBA(54, 48, 214, 64), CSSPri mitiveValue::createIdentifier(CSSValueInset), CSSPrimitiveValue::UnitType::Pixel s); 103 testPrimitiveValues(value, 10, 20, 30, 40, makeRGBA(54, 48, 214, 64), CSSPri mitiveValue::createIdentifier(CSSValueInset), CSSPrimitiveValue::UnitType::Pixel s);
103 } 104 }
104 105
105 } 106 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/animation/ShadowStyleInterpolation.cpp ('k') | third_party/WebKit/Source/core/core.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698