| 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 |
| 11 #include <gtest/gtest.h> | 11 #include <gtest/gtest.h> |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 class AnimationSVGStrokeDasharrayStyleInterpolationTest : public ::testing::Test
{ | 15 class AnimationSVGStrokeDasharrayStyleInterpolationTest : public ::testing::Test
{ |
| 16 protected: | 16 protected: |
| 17 static PassRefPtrWillBeRawPtr<CSSValueList> interpolableValueToStrokeDasharr
ay(const InterpolableValue& value) | 17 static PassRefPtrWillBeRawPtr<CSSValueList> interpolableValueToStrokeDasharr
ay(const InterpolableValue& value) |
| 18 { | 18 { |
| 19 return SVGStrokeDasharrayStyleInterpolation::interpolableValueToStrokeDa
sharray(value); | 19 return SVGStrokeDasharrayStyleInterpolation::interpolableValueToStrokeDa
sharray(value); |
| 20 } | 20 } |
| 21 | 21 |
| 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 SVGStrokeDasharrayStyleInterpolation* interpolation = SVGStrokeDasharray
StyleInterpolation::maybeCreate(value, value, CSSPropertyStrokeDasharray); |
| 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.typeWithCalcResolved(), unitType); | 34 EXPECT_EQ(primitiveValue.typeWithCalcResolved(), unitType); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 TEST_F(AnimationSVGStrokeDasharrayStyleInterpolationTest, None) | 71 TEST_F(AnimationSVGStrokeDasharrayStyleInterpolationTest, None) |
| 72 { | 72 { |
| 73 RefPtrWillBeRawPtr<CSSPrimitiveValue> start = CSSPrimitiveValue::createIdent
ifier(CSSValueNone); | 73 RefPtrWillBeRawPtr<CSSPrimitiveValue> start = CSSPrimitiveValue::createIdent
ifier(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::UnitType::Pixels); | 77 testPrimitiveValue(*value->item(0), 0, CSSPrimitiveValue::UnitType::Pixels); |
| 78 } | 78 } |
| 79 | 79 |
| 80 } | 80 } |
| OLD | NEW |