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/CSSValuePair.h" | 10 #include "core/css/CSSValuePair.h" |
11 #include "core/css/StylePropertySet.h" | 11 #include "core/css/StylePropertySet.h" |
12 | 12 |
13 #include <gtest/gtest.h> | 13 #include <gtest/gtest.h> |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 | 16 |
17 class LengthPairStyleInterpolationTest : public ::testing::Test { | 17 class LengthPairStyleInterpolationTest : public ::testing::Test { |
18 | 18 |
19 protected: | 19 protected: |
20 static PassOwnPtrWillBeRawPtr<InterpolableValue> lengthPairToInterpolableVal
ue(const CSSValue& value) | 20 static PassOwnPtr<InterpolableValue> lengthPairToInterpolableValue(const CSS
Value& value) |
21 { | 21 { |
22 return LengthPairStyleInterpolation::lengthPairToInterpolableValue(value
); | 22 return LengthPairStyleInterpolation::lengthPairToInterpolableValue(value
); |
23 } | 23 } |
24 | 24 |
25 static PassRefPtrWillBeRawPtr<CSSValue> interpolableValueToLengthPair(Interp
olableValue* value, InterpolationRange range) | 25 static PassRefPtrWillBeRawPtr<CSSValue> interpolableValueToLengthPair(Interp
olableValue* value, InterpolationRange range) |
26 { | 26 { |
27 return LengthPairStyleInterpolation::interpolableValueToLengthPair(value
, range); | 27 return LengthPairStyleInterpolation::interpolableValueToLengthPair(value
, range); |
28 } | 28 } |
29 | 29 |
30 static PassRefPtrWillBeRawPtr<CSSValue> roundTrip(PassRefPtrWillBeRawPtr<CSS
Value> value, InterpolationRange range) | 30 static PassRefPtrWillBeRawPtr<CSSValue> roundTrip(PassRefPtrWillBeRawPtr<CSS
Value> value, InterpolationRange range) |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 testPrimitiveValue(value5, 10, 20, CSSPrimitiveValue::UnitType::Pixels); | 81 testPrimitiveValue(value5, 10, 20, CSSPrimitiveValue::UnitType::Pixels); |
82 | 82 |
83 RefPtrWillBeRawPtr<CSSPrimitiveValue> firstPc = CSSPrimitiveValue::create(30
, CSSPrimitiveValue::UnitType::Percentage); | 83 RefPtrWillBeRawPtr<CSSPrimitiveValue> firstPc = CSSPrimitiveValue::create(30
, CSSPrimitiveValue::UnitType::Percentage); |
84 RefPtrWillBeRawPtr<CSSPrimitiveValue> secondPc = CSSPrimitiveValue::create(-
30, CSSPrimitiveValue::UnitType::Percentage); | 84 RefPtrWillBeRawPtr<CSSPrimitiveValue> secondPc = CSSPrimitiveValue::create(-
30, CSSPrimitiveValue::UnitType::Percentage); |
85 RefPtrWillBeRawPtr<CSSValuePair> pairPc = CSSValuePair::create(firstPc.relea
se(), secondPc.release(), CSSValuePair::KeepIdenticalValues); | 85 RefPtrWillBeRawPtr<CSSValuePair> pairPc = CSSValuePair::create(firstPc.relea
se(), secondPc.release(), CSSValuePair::KeepIdenticalValues); |
86 RefPtrWillBeRawPtr<CSSValue> value6 = roundTrip(pairPc.release(), RangeNonNe
gative); | 86 RefPtrWillBeRawPtr<CSSValue> value6 = roundTrip(pairPc.release(), RangeNonNe
gative); |
87 testPrimitiveValue(value6, 30, 0, CSSPrimitiveValue::UnitType::Percentage); | 87 testPrimitiveValue(value6, 30, 0, CSSPrimitiveValue::UnitType::Percentage); |
88 } | 88 } |
89 | 89 |
90 } | 90 } |
OLD | NEW |