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/FilterStyleInterpolation.h" | 6 #include "core/animation/FilterStyleInterpolation.h" |
7 | 7 |
8 #include "core/css/CSSPrimitiveValue.h" | 8 #include "core/css/CSSPrimitiveValue.h" |
9 | 9 |
10 #include <gtest/gtest.h> | 10 #include <gtest/gtest.h> |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 class AnimationFilterStyleInterpolationTest : public ::testing::Test { | 14 class AnimationFilterStyleInterpolationTest : public ::testing::Test { |
15 protected: | 15 protected: |
16 static void roundTrip(const CSSValue& value) | 16 static void roundTrip(const CSSValue& value) |
17 { | 17 { |
18 CSSValueID functionType; | 18 CSSValueID functionType; |
19 ASSERT_TRUE(FilterStyleInterpolation::canCreateFrom(value, value)); | 19 ASSERT_TRUE(FilterStyleInterpolation::canCreateFrom(value, value)); |
20 OwnPtrWillBeRawPtr<InterpolableValue> interpolableValue = FilterStyleInt
erpolation::toInterpolableValue(value, functionType); | 20 OwnPtr<InterpolableValue> interpolableValue = FilterStyleInterpolation::
toInterpolableValue(value, functionType); |
21 RefPtrWillBeRawPtr<CSSFunctionValue> result = FilterStyleInterpolation::
fromInterpolableValue(*interpolableValue, functionType); | 21 RefPtrWillBeRawPtr<CSSFunctionValue> result = FilterStyleInterpolation::
fromInterpolableValue(*interpolableValue, functionType); |
22 ASSERT_TRUE(value.equals(*result)); | 22 ASSERT_TRUE(value.equals(*result)); |
23 } | 23 } |
24 }; | 24 }; |
25 | 25 |
26 TEST_F(AnimationFilterStyleInterpolationTest, ZeroTest) | 26 TEST_F(AnimationFilterStyleInterpolationTest, ZeroTest) |
27 { | 27 { |
28 RefPtrWillBeRawPtr<CSSFunctionValue> filter; | 28 RefPtrWillBeRawPtr<CSSFunctionValue> filter; |
29 filter = CSSFunctionValue::create(CSSValueBlur); | 29 filter = CSSFunctionValue::create(CSSValueBlur); |
30 filter->append(CSSPrimitiveValue::create(0, CSSPrimitiveValue::UnitType::Pix
els)); | 30 filter->append(CSSPrimitiveValue::create(0, CSSPrimitiveValue::UnitType::Pix
els)); |
31 roundTrip(*filter); | 31 roundTrip(*filter); |
32 } | 32 } |
33 | 33 |
34 TEST_F(AnimationFilterStyleInterpolationTest, SimpleTest) | 34 TEST_F(AnimationFilterStyleInterpolationTest, SimpleTest) |
35 { | 35 { |
36 RefPtrWillBeRawPtr<CSSFunctionValue> filter; | 36 RefPtrWillBeRawPtr<CSSFunctionValue> filter; |
37 | 37 |
38 filter = CSSFunctionValue::create(CSSValueOpacity); | 38 filter = CSSFunctionValue::create(CSSValueOpacity); |
39 filter->append(CSSPrimitiveValue::create(0.5, CSSPrimitiveValue::UnitType::N
umber)); | 39 filter->append(CSSPrimitiveValue::create(0.5, CSSPrimitiveValue::UnitType::N
umber)); |
40 roundTrip(*filter); | 40 roundTrip(*filter); |
41 } | 41 } |
42 | 42 |
43 } | 43 } |
OLD | NEW |