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

Side by Side Diff: Source/core/animation/ListStyleInterpolationTest.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/ListStyleInterpolation.h" 6 #include "core/animation/ListStyleInterpolation.h"
7 7
8 #include "core/animation/LengthStyleInterpolation.h" 8 #include "core/animation/LengthStyleInterpolation.h"
9 #include "core/animation/ShadowStyleInterpolation.h" 9 #include "core/animation/ShadowStyleInterpolation.h"
10 10
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 static void compareShadowList(RefPtrWillBeRawPtr<CSSValueList> expectedList, CSSValue actualList) 58 static void compareShadowList(RefPtrWillBeRawPtr<CSSValueList> expectedList, CSSValue actualList)
59 { 59 {
60 ASSERT(actualList.isValueList()); 60 ASSERT(actualList.isValueList());
61 61
62 for (size_t i = 0; i < 10; i++) { 62 for (size_t i = 0; i < 10; i++) {
63 63
64 CSSShadowValue& expectedShadow = toCSSShadowValue(expectedList->item (i)); 64 CSSShadowValue& expectedShadow = toCSSShadowValue(expectedList->item (i));
65 CSSShadowValue& actualShadow = toCSSShadowValue(toCSSValueList(actua lList).item(i)); 65 CSSShadowValue& actualShadow = toCSSShadowValue(toCSSValueList(actua lList).item(i));
66 66
67 EXPECT_EQ(toCSSPrimitiveValue(*expectedShadow.x).getDoubleValue(), t oCSSPrimitiveValue(*actualShadow.x).getDoubleValue()); 67 EXPECT_EQ(toCSSPrimitiveValue(expectedShadow.x).getDoubleValue(), to CSSPrimitiveValue(actualShadow.x).getDoubleValue());
68 EXPECT_EQ(toCSSPrimitiveValue(*expectedShadow.y).getDoubleValue(), t oCSSPrimitiveValue(*actualShadow.y).getDoubleValue()); 68 EXPECT_EQ(toCSSPrimitiveValue(expectedShadow.y).getDoubleValue(), to CSSPrimitiveValue(actualShadow.y).getDoubleValue());
69 EXPECT_EQ(toCSSPrimitiveValue(*expectedShadow.blur).getDoubleValue() , toCSSPrimitiveValue(*actualShadow.blur).getDoubleValue()); 69 EXPECT_EQ(toCSSPrimitiveValue(expectedShadow.blur).getDoubleValue(), toCSSPrimitiveValue(actualShadow.blur).getDoubleValue());
70 EXPECT_EQ(toCSSPrimitiveValue(*expectedShadow.spread).getDoubleValue (), toCSSPrimitiveValue(*actualShadow.spread).getDoubleValue()); 70 EXPECT_EQ(toCSSPrimitiveValue(expectedShadow.spread).getDoubleValue( ), toCSSPrimitiveValue(actualShadow.spread).getDoubleValue());
71 EXPECT_EQ(toCSSPrimitiveValue(*expectedShadow.color).getRGBA32Value( ), toCSSPrimitiveValue(*actualShadow.color).getRGBA32Value()); 71 EXPECT_EQ(toCSSPrimitiveValue(expectedShadow.color).getRGBA32Value() , toCSSPrimitiveValue(actualShadow.color).getRGBA32Value());
72 72
73 EXPECT_EQ(toCSSPrimitiveValue(*expectedShadow.style).getValueID(), t oCSSPrimitiveValue(*actualShadow.style).getValueID()); 73 EXPECT_EQ(toCSSPrimitiveValue(expectedShadow.style).getValueID(), to CSSPrimitiveValue(actualShadow.style).getValueID());
74 } 74 }
75 } 75 }
76 }; 76 };
77 77
78 TEST_F(ListStyleInterpolationTest, LengthListMultipleValuesTest) 78 TEST_F(ListStyleInterpolationTest, LengthListMultipleValuesTest)
79 { 79 {
80 RefPtrWillBeRawPtr<CSSValueList> expectedList = CSSValueList::createCommaSep arated(); 80 RefPtrWillBeRawPtr<CSSValueList> expectedList = CSSValueList::createCommaSep arated();
81 for (size_t i = 0; i < 10; i++) { 81 for (size_t i = 0; i < 10; i++) {
82 CSSPrimitiveValue lengthValue = CSSPrimitiveValue::create(static_cast<do uble>(i), CSSPrimitiveValue::CSS_PX); 82 CSSPrimitiveValue lengthValue = CSSPrimitiveValue::create(static_cast<do uble>(i), CSSPrimitiveValue::CSS_PX);
83 expectedList->append(lengthValue); 83 expectedList->append(lengthValue);
84 } 84 }
85 85
86 compareLengthLists(expectedList, lengthRoundTrip(expectedList, RangeNonNegat ive)); 86 compareLengthLists(expectedList, lengthRoundTrip(expectedList, RangeNonNegat ive));
87 } 87 }
88 88
89 TEST_F(ListStyleInterpolationTest, ShadowListMultipleValuesTest) 89 TEST_F(ListStyleInterpolationTest, ShadowListMultipleValuesTest)
90 { 90 {
91 RefPtrWillBeRawPtr<CSSValueList> expectedList = CSSValueList::createCommaSep arated(); 91 RefPtrWillBeRawPtr<CSSValueList> expectedList = CSSValueList::createCommaSep arated();
92 RefPtrWillBeRawPtr<CSSShadowValue> shadowValue = createShadowValue(); 92 RefPtrWillBeRawPtr<CSSShadowValue> shadowValue = createShadowValue();
93 for (size_t i = 0; i < 10; i++) { 93 for (size_t i = 0; i < 10; i++) {
94 expectedList->append(shadowValue); 94 expectedList->append(shadowValue);
95 } 95 }
96 96
97 compareShadowList(expectedList, shadowRoundTrip(expectedList)); 97 compareShadowList(expectedList, shadowRoundTrip(expectedList));
98 } 98 }
99 99
100 } // namespace blink 100 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/animation/LengthStyleInterpolationTest.cpp ('k') | Source/core/animation/SVGStrokeDasharrayStyleInterpolation.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698