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/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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 EXPECT_EQ(pair->first()->getDoubleValue(), first); | 42 EXPECT_EQ(pair->first()->getDoubleValue(), first); |
43 EXPECT_EQ(pair->second()->getDoubleValue(), second); | 43 EXPECT_EQ(pair->second()->getDoubleValue(), second); |
44 | 44 |
45 EXPECT_EQ(pair->first()->primitiveType(), unitType); | 45 EXPECT_EQ(pair->first()->primitiveType(), unitType); |
46 EXPECT_EQ(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 RefPtr<CSSPrimitiveValue> firstPx = CSSPrimitiveValue::create(0, CSSPrimitiv
eValue::CSS_PX); | 52 RefPtrWillBeRawPtr<CSSPrimitiveValue> firstPx = CSSPrimitiveValue::create(0,
CSSPrimitiveValue::CSS_PX); |
53 RefPtr<CSSPrimitiveValue> secondPx = CSSPrimitiveValue::create(0, CSSPrimiti
veValue::CSS_PX); | 53 RefPtrWillBeRawPtr<CSSPrimitiveValue> secondPx = CSSPrimitiveValue::create(0
, CSSPrimitiveValue::CSS_PX); |
54 RefPtr<Pair> pairPx = Pair::create(firstPx, secondPx, Pair::KeepIdenticalVal
ues); | 54 RefPtrWillBeRawPtr<Pair> pairPx = Pair::create(firstPx, secondPx, Pair::Keep
IdenticalValues); |
55 RefPtrWillBeRawPtr<CSSValue> value1 = roundTrip(CSSPrimitiveValue::create(pa
irPx.release()), ValueRangeNonNegative); | 55 RefPtrWillBeRawPtr<CSSValue> value1 = roundTrip(CSSPrimitiveValue::create(pa
irPx.release()), ValueRangeNonNegative); |
56 testPrimitiveValue(value1, 0, 0, CSSPrimitiveValue::CSS_PX); | 56 testPrimitiveValue(value1, 0, 0, CSSPrimitiveValue::CSS_PX); |
57 | 57 |
58 RefPtr<CSSPrimitiveValue> firstPc = CSSPrimitiveValue::create(0, CSSPrimitiv
eValue::CSS_PERCENTAGE); | 58 RefPtrWillBeRawPtr<CSSPrimitiveValue> firstPc = CSSPrimitiveValue::create(0,
CSSPrimitiveValue::CSS_PERCENTAGE); |
59 RefPtr<CSSPrimitiveValue> secondPc = CSSPrimitiveValue::create(0, CSSPrimiti
veValue::CSS_PERCENTAGE); | 59 RefPtrWillBeRawPtr<CSSPrimitiveValue> secondPc = CSSPrimitiveValue::create(0
, CSSPrimitiveValue::CSS_PERCENTAGE); |
60 RefPtr<Pair> pairPc = Pair::create(firstPc, secondPc, Pair::KeepIdenticalVal
ues); | 60 RefPtrWillBeRawPtr<Pair> pairPc = Pair::create(firstPc, secondPc, Pair::Keep
IdenticalValues); |
61 RefPtrWillBeRawPtr<CSSValue> value2 = roundTrip(CSSPrimitiveValue::create(pa
irPc.release()), ValueRangeNonNegative); | 61 RefPtrWillBeRawPtr<CSSValue> value2 = roundTrip(CSSPrimitiveValue::create(pa
irPc.release()), ValueRangeNonNegative); |
62 testPrimitiveValue(value2, 0, 0, CSSPrimitiveValue::CSS_PX); | 62 testPrimitiveValue(value2, 0, 0, CSSPrimitiveValue::CSS_PX); |
63 | 63 |
64 RefPtr<CSSPrimitiveValue> firstEms = CSSPrimitiveValue::create(0, CSSPrimiti
veValue::CSS_EMS); | 64 RefPtrWillBeRawPtr<CSSPrimitiveValue> firstEms = CSSPrimitiveValue::create(0
, CSSPrimitiveValue::CSS_EMS); |
65 RefPtr<CSSPrimitiveValue> secondEms = CSSPrimitiveValue::create(0, CSSPrimit
iveValue::CSS_EMS); | 65 RefPtrWillBeRawPtr<CSSPrimitiveValue> secondEms = CSSPrimitiveValue::create(
0, CSSPrimitiveValue::CSS_EMS); |
66 RefPtr<Pair> pairEms = Pair::create(firstEms, secondEms, Pair::KeepIdentical
Values); | 66 RefPtrWillBeRawPtr<Pair> pairEms = Pair::create(firstEms, secondEms, Pair::K
eepIdenticalValues); |
67 RefPtrWillBeRawPtr<CSSValue> value3 = roundTrip(CSSPrimitiveValue::create(pa
irEms.release()), ValueRangeNonNegative); | 67 RefPtrWillBeRawPtr<CSSValue> value3 = roundTrip(CSSPrimitiveValue::create(pa
irEms.release()), ValueRangeNonNegative); |
68 testPrimitiveValue(value3, 0, 0, CSSPrimitiveValue::CSS_PX); | 68 testPrimitiveValue(value3, 0, 0, CSSPrimitiveValue::CSS_PX); |
69 | 69 |
70 RefPtr<CSSPrimitiveValue> firstPcNeg = CSSPrimitiveValue::create(0, CSSPrimi
tiveValue::CSS_PERCENTAGE); | 70 RefPtrWillBeRawPtr<CSSPrimitiveValue> firstPcNeg = CSSPrimitiveValue::create
(0, CSSPrimitiveValue::CSS_PERCENTAGE); |
71 RefPtr<CSSPrimitiveValue> secondPcNeg = CSSPrimitiveValue::create(0, CSSPrim
itiveValue::CSS_PERCENTAGE); | 71 RefPtrWillBeRawPtr<CSSPrimitiveValue> secondPcNeg = CSSPrimitiveValue::creat
e(0, CSSPrimitiveValue::CSS_PERCENTAGE); |
72 RefPtr<Pair> pairPcNeg = Pair::create(firstPcNeg, secondPcNeg, Pair::KeepIde
nticalValues); | 72 RefPtrWillBeRawPtr<Pair> pairPcNeg = Pair::create(firstPcNeg, secondPcNeg, P
air::KeepIdenticalValues); |
73 RefPtrWillBeRawPtr<CSSValue> value4 = roundTrip(CSSPrimitiveValue::create(pa
irPcNeg.release()), ValueRangeAll); | 73 RefPtrWillBeRawPtr<CSSValue> value4 = roundTrip(CSSPrimitiveValue::create(pa
irPcNeg.release()), ValueRangeAll); |
74 testPrimitiveValue(value4, 0, 0, CSSPrimitiveValue::CSS_PX); | 74 testPrimitiveValue(value4, 0, 0, CSSPrimitiveValue::CSS_PX); |
75 } | 75 } |
76 | 76 |
77 TEST_F(LengthPairStyleInterpolationTest, MultipleValueTest) | 77 TEST_F(LengthPairStyleInterpolationTest, MultipleValueTest) |
78 { | 78 { |
79 RefPtr<CSSPrimitiveValue> firstPx = CSSPrimitiveValue::create(10, CSSPrimiti
veValue::CSS_PX); | 79 RefPtrWillBeRawPtr<CSSPrimitiveValue> firstPx = CSSPrimitiveValue::create(10
, CSSPrimitiveValue::CSS_PX); |
80 RefPtr<CSSPrimitiveValue> secondPx = CSSPrimitiveValue::create(20, CSSPrimit
iveValue::CSS_PX); | 80 RefPtrWillBeRawPtr<CSSPrimitiveValue> secondPx = CSSPrimitiveValue::create(2
0, CSSPrimitiveValue::CSS_PX); |
81 RefPtr<Pair> pairPx = Pair::create(firstPx, secondPx, Pair::KeepIdenticalVal
ues); | 81 RefPtrWillBeRawPtr<Pair> pairPx = Pair::create(firstPx, secondPx, Pair::Keep
IdenticalValues); |
82 RefPtrWillBeRawPtr<CSSValue> value5 = roundTrip(CSSPrimitiveValue::create(pa
irPx.release()), ValueRangeNonNegative); | 82 RefPtrWillBeRawPtr<CSSValue> value5 = roundTrip(CSSPrimitiveValue::create(pa
irPx.release()), ValueRangeNonNegative); |
83 testPrimitiveValue(value5, 10, 20, CSSPrimitiveValue::CSS_PX); | 83 testPrimitiveValue(value5, 10, 20, CSSPrimitiveValue::CSS_PX); |
84 | 84 |
85 RefPtr<CSSPrimitiveValue> firstPc = CSSPrimitiveValue::create(30, CSSPrimiti
veValue::CSS_PERCENTAGE); | 85 RefPtrWillBeRawPtr<CSSPrimitiveValue> firstPc = CSSPrimitiveValue::create(30
, CSSPrimitiveValue::CSS_PERCENTAGE); |
86 RefPtr<CSSPrimitiveValue> secondPc = CSSPrimitiveValue::create(-30, CSSPrimi
tiveValue::CSS_PERCENTAGE); | 86 RefPtrWillBeRawPtr<CSSPrimitiveValue> secondPc = CSSPrimitiveValue::create(-
30, CSSPrimitiveValue::CSS_PERCENTAGE); |
87 RefPtr<Pair> pairPc = Pair::create(firstPc, secondPc, Pair::KeepIdenticalVal
ues); | 87 RefPtrWillBeRawPtr<Pair> pairPc = Pair::create(firstPc, secondPc, Pair::Keep
IdenticalValues); |
88 RefPtrWillBeRawPtr<CSSValue> value6 = roundTrip(CSSPrimitiveValue::create(pa
irPc.release()), ValueRangeNonNegative); | 88 RefPtrWillBeRawPtr<CSSValue> value6 = roundTrip(CSSPrimitiveValue::create(pa
irPc.release()), ValueRangeNonNegative); |
89 testPrimitiveValue(value6, 30, 0, CSSPrimitiveValue::CSS_PERCENTAGE); | 89 testPrimitiveValue(value6, 30, 0, CSSPrimitiveValue::CSS_PERCENTAGE); |
90 } | 90 } |
91 | 91 |
92 } | 92 } |
OLD | NEW |