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

Side by Side Diff: Source/core/animation/LengthPairStyleInterpolationTest.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/LengthPairStyleInterpolation.h" 6 #include "core/animation/LengthPairStyleInterpolation.h"
7 7
8 #include "core/css/CSSPrimitiveValue.h" 8 #include "core/css/CSSPrimitiveValue.h"
9 #include "core/css/CSSValue.h" 9 #include "core/css/CSSValue.h"
10 #include "core/css/Pair.h" 10 #include "core/css/Pair.h"
(...skipping 21 matching lines...) Expand all
32 return interpolableValueToLengthPair(lengthPairToInterpolableValue(value ).get(), range); 32 return interpolableValueToLengthPair(lengthPairToInterpolableValue(value ).get(), range);
33 } 33 }
34 34
35 static void testPrimitiveValue(CSSValue value, double first, double second, CSSPrimitiveValue::UnitType unitType) 35 static void testPrimitiveValue(CSSValue value, double first, double second, CSSPrimitiveValue::UnitType unitType)
36 { 36 {
37 EXPECT_TRUE(value.isPrimitiveValue()); 37 EXPECT_TRUE(value.isPrimitiveValue());
38 38
39 Pair* pair = toCSSPrimitiveValue(value).getPairValue(); 39 Pair* pair = toCSSPrimitiveValue(value).getPairValue();
40 ASSERT_TRUE(pair); 40 ASSERT_TRUE(pair);
41 41
42 EXPECT_EQ(toCSSPrimitiveValue(*pair->first()).getDoubleValue(), first); 42 EXPECT_EQ(pair->first().getDoubleValue(), first);
43 EXPECT_EQ(toCSSPrimitiveValue(*pair->second()).getDoubleValue(), second) ; 43 EXPECT_EQ(pair->second().getDoubleValue(), second);
44 44
45 EXPECT_EQ(toCSSPrimitiveValue(*pair->first()).primitiveType(), unitType) ; 45 EXPECT_EQ(pair->first().primitiveType(), unitType);
46 EXPECT_EQ(toCSSPrimitiveValue(*pair->second()).primitiveType(), unitType ); 46 EXPECT_EQ(pair->second().primitiveType(), unitType);
47 } 47 }
48 }; 48 };
49 49
50 TEST_F(LengthPairStyleInterpolationTest, ZeroTest) 50 TEST_F(LengthPairStyleInterpolationTest, ZeroTest)
51 { 51 {
52 CSSPrimitiveValue firstPx = CSSPrimitiveValue::create(0, CSSPrimitiveValue:: CSS_PX); 52 CSSPrimitiveValue firstPx = CSSPrimitiveValue::create(0, CSSPrimitiveValue:: CSS_PX);
53 CSSPrimitiveValue secondPx = CSSPrimitiveValue::create(0, CSSPrimitiveValue: :CSS_PX); 53 CSSPrimitiveValue secondPx = CSSPrimitiveValue::create(0, CSSPrimitiveValue: :CSS_PX);
54 RefPtrWillBeRawPtr<Pair> pairPx = Pair::create(firstPx, secondPx, Pair::Keep IdenticalValues); 54 RefPtrWillBeRawPtr<Pair> pairPx = Pair::create(firstPx, secondPx, Pair::Keep IdenticalValues);
55 CSSValue value1 = roundTrip(CSSPrimitiveValue::create(pairPx.release()), Ran geNonNegative); 55 CSSValue value1 = roundTrip(CSSPrimitiveValue::create(pairPx.release()), Ran geNonNegative);
56 testPrimitiveValue(value1, 0, 0, CSSPrimitiveValue::CSS_PX); 56 testPrimitiveValue(value1, 0, 0, CSSPrimitiveValue::CSS_PX);
(...skipping 26 matching lines...) Expand all
83 testPrimitiveValue(value5, 10, 20, CSSPrimitiveValue::CSS_PX); 83 testPrimitiveValue(value5, 10, 20, CSSPrimitiveValue::CSS_PX);
84 84
85 CSSPrimitiveValue firstPc = CSSPrimitiveValue::create(30, CSSPrimitiveValue: :CSS_PERCENTAGE); 85 CSSPrimitiveValue firstPc = CSSPrimitiveValue::create(30, CSSPrimitiveValue: :CSS_PERCENTAGE);
86 CSSPrimitiveValue secondPc = CSSPrimitiveValue::create(-30, CSSPrimitiveValu e::CSS_PERCENTAGE); 86 CSSPrimitiveValue secondPc = CSSPrimitiveValue::create(-30, CSSPrimitiveValu e::CSS_PERCENTAGE);
87 RefPtrWillBeRawPtr<Pair> pairPc = Pair::create(firstPc, secondPc, Pair::Keep IdenticalValues); 87 RefPtrWillBeRawPtr<Pair> pairPc = Pair::create(firstPc, secondPc, Pair::Keep IdenticalValues);
88 CSSValue value6 = roundTrip(CSSPrimitiveValue::create(pairPc.release()), Ran geNonNegative); 88 CSSValue value6 = roundTrip(CSSPrimitiveValue::create(pairPc.release()), Ran geNonNegative);
89 testPrimitiveValue(value6, 30, 0, CSSPrimitiveValue::CSS_PERCENTAGE); 89 testPrimitiveValue(value6, 30, 0, CSSPrimitiveValue::CSS_PERCENTAGE);
90 } 90 }
91 91
92 } 92 }
OLDNEW
« no previous file with comments | « Source/core/animation/LengthPairStyleInterpolation.cpp ('k') | Source/core/animation/LengthStyleInterpolation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698