OLD | NEW |
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/SVGStrokeDasharrayStyleInterpolation.h" | 6 #include "core/animation/SVGStrokeDasharrayStyleInterpolation.h" |
7 | 7 |
8 #include "core/css/CSSPrimitiveValue.h" | 8 #include "core/css/CSSPrimitiveValue.h" |
9 #include "core/css/CSSValueList.h" | 9 #include "core/css/CSSValueList.h" |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 static PassRefPtrWillBeRawPtr<CSSValueList> roundTrip(const CSSValue& value) | 22 static PassRefPtrWillBeRawPtr<CSSValueList> roundTrip(const CSSValue& value) |
23 { | 23 { |
24 RefPtrWillBeRawPtr<SVGStrokeDasharrayStyleInterpolation> interpolation =
SVGStrokeDasharrayStyleInterpolation::maybeCreate(value, value, CSSPropertyStro
keDasharray); | 24 RefPtrWillBeRawPtr<SVGStrokeDasharrayStyleInterpolation> interpolation =
SVGStrokeDasharrayStyleInterpolation::maybeCreate(value, value, CSSPropertyStro
keDasharray); |
25 ASSERT(interpolation); | 25 ASSERT(interpolation); |
26 return SVGStrokeDasharrayStyleInterpolation::interpolableValueToStrokeDa
sharray(*interpolation->m_start); | 26 return SVGStrokeDasharrayStyleInterpolation::interpolableValueToStrokeDa
sharray(*interpolation->m_start); |
27 } | 27 } |
28 | 28 |
29 static void testPrimitiveValue(const CSSValue& cssValue, double value, CSSPr
imitiveValue::UnitType unitType) | 29 static void testPrimitiveValue(const CSSValue& cssValue, double value, CSSPr
imitiveValue::UnitType unitType) |
30 { | 30 { |
31 EXPECT_TRUE(cssValue.isPrimitiveValue()); | 31 EXPECT_TRUE(cssValue.isPrimitiveValue()); |
32 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(cssValue); | 32 const CSSPrimitiveValue primitiveValue = toCSSPrimitiveValue(cssValue); |
33 | 33 |
34 EXPECT_EQ(primitiveValue.primitiveType(), unitType); | 34 EXPECT_EQ(primitiveValue.primitiveType(), unitType); |
35 EXPECT_EQ(primitiveValue.getDoubleValue(), value); | 35 EXPECT_EQ(primitiveValue.getDoubleValue(), value); |
36 } | 36 } |
37 }; | 37 }; |
38 | 38 |
39 TEST_F(AnimationSVGStrokeDasharrayStyleInterpolationTest, Zero) | 39 TEST_F(AnimationSVGStrokeDasharrayStyleInterpolationTest, Zero) |
40 { | 40 { |
41 RefPtrWillBeRawPtr<CSSValueList> start = CSSValueList::createCommaSeparated(
); | 41 RefPtrWillBeRawPtr<CSSValueList> start = CSSValueList::createCommaSeparated(
); |
42 start->append(CSSPrimitiveValue::create(0, CSSPrimitiveValue::CSS_PERCENTAGE
)); | 42 start->append(CSSPrimitiveValue::create(0, CSSPrimitiveValue::CSS_PERCENTAGE
)); |
(...skipping 20 matching lines...) Expand all Loading... |
63 EXPECT_EQ(value->length(), 5u); | 63 EXPECT_EQ(value->length(), 5u); |
64 testPrimitiveValue(value->item(0), 0, CSSPrimitiveValue::CSS_PX); | 64 testPrimitiveValue(value->item(0), 0, CSSPrimitiveValue::CSS_PX); |
65 testPrimitiveValue(value->item(1), 10, CSSPrimitiveValue::CSS_EMS); | 65 testPrimitiveValue(value->item(1), 10, CSSPrimitiveValue::CSS_EMS); |
66 testPrimitiveValue(value->item(2), 0, CSSPrimitiveValue::CSS_EMS); | 66 testPrimitiveValue(value->item(2), 0, CSSPrimitiveValue::CSS_EMS); |
67 testPrimitiveValue(value->item(3), 0, CSSPrimitiveValue::CSS_PERCENTAGE); | 67 testPrimitiveValue(value->item(3), 0, CSSPrimitiveValue::CSS_PERCENTAGE); |
68 testPrimitiveValue(value->item(4), 30, CSSPrimitiveValue::CSS_EMS); | 68 testPrimitiveValue(value->item(4), 30, CSSPrimitiveValue::CSS_EMS); |
69 } | 69 } |
70 | 70 |
71 TEST_F(AnimationSVGStrokeDasharrayStyleInterpolationTest, None) | 71 TEST_F(AnimationSVGStrokeDasharrayStyleInterpolationTest, None) |
72 { | 72 { |
73 RefPtrWillBeRawPtr<CSSPrimitiveValue> start = CSSPrimitiveValue::createIdent
ifier(CSSValueNone); | 73 CSSPrimitiveValue start = CSSPrimitiveValue::createIdentifier(CSSValueNone); |
74 | 74 |
75 RefPtrWillBeRawPtr<CSSValueList> value = roundTrip(start); | 75 RefPtrWillBeRawPtr<CSSValueList> value = roundTrip(start); |
76 EXPECT_EQ(value->length(), 1u); | 76 EXPECT_EQ(value->length(), 1u); |
77 testPrimitiveValue(value->item(0), 0, CSSPrimitiveValue::CSS_PX); | 77 testPrimitiveValue(value->item(0), 0, CSSPrimitiveValue::CSS_PX); |
78 } | 78 } |
79 | 79 |
80 } | 80 } |
OLD | NEW |