| 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 "sky/engine/config.h" | 5 #include "sky/engine/config.h" |
| 6 #include "sky/engine/core/animation/DeferredLegacyStyleInterpolation.h" | 6 #include "sky/engine/core/animation/DeferredLegacyStyleInterpolation.h" |
| 7 | 7 |
| 8 #include "sky/engine/core/css/CSSInheritedValue.h" | 8 #include "sky/engine/core/css/CSSInheritedValue.h" |
| 9 #include "sky/engine/core/css/CSSPrimitiveValue.h" | 9 #include "sky/engine/core/css/CSSPrimitiveValue.h" |
| 10 #include "sky/engine/core/css/CSSValueList.h" | 10 #include "sky/engine/core/css/CSSValueList.h" |
| 11 #include "sky/engine/core/css/StylePropertySet.h" | 11 #include "sky/engine/core/css/StylePropertySet.h" |
| 12 #include "sky/engine/core/css/parser/BisonCSSParser.h" | 12 #include "sky/engine/core/css/parser/BisonCSSParser.h" |
| 13 | 13 |
| 14 #include <gtest/gtest.h> | 14 #include <gtest/gtest.h> |
| 15 | 15 |
| 16 namespace blink { | 16 namespace blink { |
| 17 | 17 |
| 18 class AnimationDeferredLegacyStyleInterpolationTest : public ::testing::Test { | 18 class AnimationDeferredLegacyStyleInterpolationTest : public ::testing::Test { |
| 19 protected: | 19 protected: |
| 20 static bool test(CSSPropertyID propertyID, const String& string) | 20 static bool test(CSSPropertyID propertyID, const String& string) |
| 21 { | 21 { |
| 22 CSSParserMode parserMode = HTMLStandardMode; | 22 CSSParserMode parserMode = HTMLStandardMode; |
| 23 RefPtr<MutableStylePropertySet> dummyStyle = MutableStylePropertySet::cr
eate(); | 23 RefPtr<MutableStylePropertySet> dummyStyle = MutableStylePropertySet::cr
eate(); |
| 24 bool parseSuccess = BisonCSSParser::parseValue(dummyStyle.get(), propert
yID, string, parserMode, 0); | 24 bool parseSuccess = BisonCSSParser::parseValue(dummyStyle.get(), propert
yID, string, parserMode, 0); |
| 25 ASSERT_UNUSED(parseSuccess, parseSuccess); | 25 ASSERT_UNUSED(parseSuccess, parseSuccess); |
| 26 return DeferredLegacyStyleInterpolation::interpolationRequiresStyleResol
ve(*dummyStyle->getPropertyCSSValue(propertyID)); | 26 return DeferredLegacyStyleInterpolation::interpolationRequiresStyleResol
ve(*dummyStyle->getPropertyCSSValue(propertyID)); |
| 27 } | 27 } |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 TEST_F(AnimationDeferredLegacyStyleInterpolationTest, Inherit) | |
| 31 { | |
| 32 EXPECT_TRUE(test(CSSPropertyCaptionSide, "inherit")); | |
| 33 } | |
| 34 | |
| 35 TEST_F(AnimationDeferredLegacyStyleInterpolationTest, Color) | 30 TEST_F(AnimationDeferredLegacyStyleInterpolationTest, Color) |
| 36 { | 31 { |
| 37 EXPECT_FALSE(test(CSSPropertyColor, "rgb(10, 20, 30)")); | 32 EXPECT_FALSE(test(CSSPropertyColor, "rgb(10, 20, 30)")); |
| 38 EXPECT_FALSE(test(CSSPropertyColor, "aqua")); | 33 EXPECT_FALSE(test(CSSPropertyColor, "aqua")); |
| 39 EXPECT_FALSE(test(CSSPropertyColor, "yellow")); | 34 EXPECT_FALSE(test(CSSPropertyColor, "yellow")); |
| 40 EXPECT_FALSE(test(CSSPropertyColor, "transparent")); | 35 EXPECT_FALSE(test(CSSPropertyColor, "transparent")); |
| 41 EXPECT_TRUE(test(CSSPropertyColor, "currentcolor")); | 36 EXPECT_TRUE(test(CSSPropertyColor, "currentcolor")); |
| 42 } | 37 } |
| 43 | 38 |
| 44 TEST_F(AnimationDeferredLegacyStyleInterpolationTest, Relative) | 39 TEST_F(AnimationDeferredLegacyStyleInterpolationTest, Relative) |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 EXPECT_TRUE(test(CSSPropertyFilter, "drop-shadow(0px 0px 0px currentcolor)")
); | 75 EXPECT_TRUE(test(CSSPropertyFilter, "drop-shadow(0px 0px 0px currentcolor)")
); |
| 81 EXPECT_FALSE(test(CSSPropertyFilter, "opacity(1)")); | 76 EXPECT_FALSE(test(CSSPropertyFilter, "opacity(1)")); |
| 82 EXPECT_FALSE(test(CSSPropertyFilter, "saturate(0)")); | 77 EXPECT_FALSE(test(CSSPropertyFilter, "saturate(0)")); |
| 83 EXPECT_FALSE(test(CSSPropertyFilter, "grayscale(1)")); | 78 EXPECT_FALSE(test(CSSPropertyFilter, "grayscale(1)")); |
| 84 EXPECT_FALSE(test(CSSPropertyFilter, "invert(1)")); | 79 EXPECT_FALSE(test(CSSPropertyFilter, "invert(1)")); |
| 85 EXPECT_FALSE(test(CSSPropertyFilter, "sepia(1)")); | 80 EXPECT_FALSE(test(CSSPropertyFilter, "sepia(1)")); |
| 86 EXPECT_TRUE(test(CSSPropertyFilter, "url(#svgfilter)")); | 81 EXPECT_TRUE(test(CSSPropertyFilter, "url(#svgfilter)")); |
| 87 } | 82 } |
| 88 | 83 |
| 89 } | 84 } |
| OLD | NEW |