Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: Source/core/animation/interpolation/DeferredLegacyStyleInterpolationTest.cpp

Issue 292173009: Web Animations - responsive interpolation (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@0519_MySeparation
Patch Set: SVG Paint Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "config.h"
6 #include "core/animation/interpolation/DeferredLegacyStyleInterpolation.h"
7
8 #include "core/css/CSSInheritedValue.h"
9 #include "core/css/CSSPrimitiveValue.h"
10 #include "core/css/CSSValueList.h"
11 #include "core/css/StylePropertySet.h"
12 #include "core/css/parser/BisonCSSParser.h"
13
14 #include <gtest/gtest.h>
15
16 namespace WebCore {
17
18 class AnimationDeferredLegacyStyleInterpolationTest : public ::testing::Test {
19 protected:
20 static bool test(CSSPropertyID propertyID, const String& string)
21 {
22 CSSParserMode parserMode = HTMLStandardMode;
23 if (propertyID == CSSPropertyFloodColor)
24 parserMode = SVGAttributeMode;
25 RefPtrWillBeRawPtr<MutableStylePropertySet> dummyStyle = MutableStylePro pertySet::create();
26 bool ok = BisonCSSParser::parseValue(dummyStyle.get(), propertyID, strin g, false, parserMode, 0);
27 ASSERT(ok);
28 return DeferredLegacyStyleInterpolation::interpolationRequiresStyleResol ve(*dummyStyle->getPropertyCSSValue(propertyID));
29 }
30 };
31
32 TEST_F(AnimationDeferredLegacyStyleInterpolationTest, Inherit)
33 {
34 EXPECT_TRUE(test(CSSPropertyCaptionSide, "inherit"));
35 }
36
37 TEST_F(AnimationDeferredLegacyStyleInterpolationTest, Color)
38 {
39 EXPECT_FALSE(test(CSSPropertyColor, "rgb(10, 20, 30)"));
40 EXPECT_FALSE(test(CSSPropertyColor, "aqua"));
41 EXPECT_FALSE(test(CSSPropertyColor, "yellow"));
42 EXPECT_FALSE(test(CSSPropertyColor, "transparent"));
43 EXPECT_FALSE(test(CSSPropertyFloodColor, "aliceblue"));
44 EXPECT_FALSE(test(CSSPropertyFloodColor, "yellowgreen"));
45 EXPECT_FALSE(test(CSSPropertyFloodColor, "grey"));
46 EXPECT_TRUE(test(CSSPropertyColor, "currentcolor"));
47 }
48
49 TEST_F(AnimationDeferredLegacyStyleInterpolationTest, SVG)
50 {
51 EXPECT_FALSE(test(CSSPropertyFill, "pink"));
52 EXPECT_FALSE(test(CSSPropertyFill, "green"));
53 }
54
55 TEST_F(AnimationDeferredLegacyStyleInterpolationTest, Relative)
56 {
57 EXPECT_TRUE(test(CSSPropertyFontWeight, "bolder"));
58 EXPECT_TRUE(test(CSSPropertyFontWeight, "lighter"));
59 EXPECT_TRUE(test(CSSPropertyFontSize, "smaller"));
60 EXPECT_TRUE(test(CSSPropertyFontSize, "larger"));
61 }
62
63 TEST_F(AnimationDeferredLegacyStyleInterpolationTest, Length)
64 {
65 EXPECT_FALSE(test(CSSPropertyWidth, "10px"));
66 EXPECT_TRUE(test(CSSPropertyWidth, "10em"));
67 EXPECT_TRUE(test(CSSPropertyWidth, "10vh"));
68 }
69
70 TEST_F(AnimationDeferredLegacyStyleInterpolationTest, Number)
71 {
72 EXPECT_FALSE(test(CSSPropertyOpacity, "0.5"));
73 }
74
75 TEST_F(AnimationDeferredLegacyStyleInterpolationTest, Transform)
76 {
77 EXPECT_TRUE(test(CSSPropertyTransform, "translateX(1em)"));
78 EXPECT_FALSE(test(CSSPropertyTransform, "translateY(20px)"));
79 EXPECT_FALSE(test(CSSPropertyTransform, "skewX(10rad) perspective(400px)"));
80 EXPECT_TRUE(test(CSSPropertyTransform, "skewX(20rad) perspective(50em)"));
81 }
82
83 TEST_F(AnimationDeferredLegacyStyleInterpolationTest, Filter)
84 {
85 EXPECT_FALSE(test(CSSPropertyWebkitFilter, "hue-rotate(180deg) blur(6px)"));
86 EXPECT_FALSE(test(CSSPropertyWebkitFilter, "grayscale(0) blur(0px)"));
87 EXPECT_FALSE(test(CSSPropertyWebkitFilter, "none"));
88 EXPECT_FALSE(test(CSSPropertyWebkitFilter, "brightness(0) contrast(0)"));
89 EXPECT_FALSE(test(CSSPropertyWebkitFilter, "drop-shadow(20px 10px green)"));
90 EXPECT_TRUE(test(CSSPropertyWebkitFilter, "drop-shadow(20px 10vw green)"));
91 EXPECT_TRUE(test(CSSPropertyWebkitFilter, "drop-shadow(0px 0px 0px currentco lor)"));
92 EXPECT_FALSE(test(CSSPropertyWebkitFilter, "opacity(1)"));
93 EXPECT_FALSE(test(CSSPropertyWebkitFilter, "saturate(0)"));
94 EXPECT_FALSE(test(CSSPropertyWebkitFilter, "grayscale(1)"));
95 EXPECT_FALSE(test(CSSPropertyWebkitFilter, "invert(1)"));
96 EXPECT_FALSE(test(CSSPropertyWebkitFilter, "sepia(1)"));
97 EXPECT_TRUE(test(CSSPropertyWebkitFilter, "url(#svgfilter)"));
98 }
99
100 }
OLDNEW
« no previous file with comments | « Source/core/animation/interpolation/DeferredLegacyStyleInterpolation.cpp ('k') | Source/core/core.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698