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

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: RELEASE_ASSERT 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 RELEASE_ASSERT(BisonCSSParser::parseValue(dummyStyle.get(), propertyID, string, false, parserMode, 0));
dstockwell 2014/05/27 07:39:55 It's probably clearer to write this as: result = p
27 return DeferredLegacyStyleInterpolation::interpolationRequiresStyleResol ve(*dummyStyle->getPropertyCSSValue(propertyID));
28 }
29 };
30
31 TEST_F(AnimationDeferredLegacyStyleInterpolationTest, Inherit)
32 {
33 EXPECT_TRUE(test(CSSPropertyCaptionSide, "inherit"));
34 }
35
36 TEST_F(AnimationDeferredLegacyStyleInterpolationTest, Color)
37 {
38 EXPECT_FALSE(test(CSSPropertyColor, "rgb(10, 20, 30)"));
39 EXPECT_FALSE(test(CSSPropertyColor, "aqua"));
40 EXPECT_FALSE(test(CSSPropertyColor, "yellow"));
41 EXPECT_FALSE(test(CSSPropertyColor, "transparent"));
42 EXPECT_FALSE(test(CSSPropertyFloodColor, "aliceblue"));
43 EXPECT_FALSE(test(CSSPropertyFloodColor, "yellowgreen"));
44 EXPECT_FALSE(test(CSSPropertyFloodColor, "grey"));
45 EXPECT_TRUE(test(CSSPropertyColor, "currentcolor"));
46 }
47
48 TEST_F(AnimationDeferredLegacyStyleInterpolationTest, Relative)
49 {
50 EXPECT_TRUE(test(CSSPropertyFontWeight, "bolder"));
51 EXPECT_TRUE(test(CSSPropertyFontWeight, "lighter"));
52 EXPECT_TRUE(test(CSSPropertyFontSize, "smaller"));
53 EXPECT_TRUE(test(CSSPropertyFontSize, "larger"));
54 }
55
56 TEST_F(AnimationDeferredLegacyStyleInterpolationTest, Length)
57 {
58 EXPECT_FALSE(test(CSSPropertyWidth, "10px"));
59 EXPECT_TRUE(test(CSSPropertyWidth, "10em"));
60 EXPECT_TRUE(test(CSSPropertyWidth, "10vh"));
61 }
62
63 TEST_F(AnimationDeferredLegacyStyleInterpolationTest, Number)
64 {
65 EXPECT_FALSE(test(CSSPropertyOpacity, "0.5"));
66 }
67
68 TEST_F(AnimationDeferredLegacyStyleInterpolationTest, Transform)
69 {
70 EXPECT_TRUE(test(CSSPropertyTransform, "translateX(1em)"));
71 EXPECT_FALSE(test(CSSPropertyTransform, "translateY(20px)"));
72 EXPECT_FALSE(test(CSSPropertyTransform, "skewX(10rad) perspective(400px)"));
73 EXPECT_TRUE(test(CSSPropertyTransform, "skewX(20rad) perspective(50em)"));
74 }
75
76 TEST_F(AnimationDeferredLegacyStyleInterpolationTest, Filter)
77 {
78 EXPECT_FALSE(test(CSSPropertyWebkitFilter, "hue-rotate(180deg) blur(6px)"));
79 EXPECT_FALSE(test(CSSPropertyWebkitFilter, "grayscale(0) blur(0px)"));
80 EXPECT_FALSE(test(CSSPropertyWebkitFilter, "none"));
81 EXPECT_FALSE(test(CSSPropertyWebkitFilter, "brightness(0) contrast(0)"));
82 EXPECT_FALSE(test(CSSPropertyWebkitFilter, "drop-shadow(20px 10px green)"));
83 EXPECT_TRUE(test(CSSPropertyWebkitFilter, "drop-shadow(20px 10vw green)"));
84 EXPECT_TRUE(test(CSSPropertyWebkitFilter, "drop-shadow(0px 0px 0px currentco lor)"));
85 EXPECT_FALSE(test(CSSPropertyWebkitFilter, "opacity(1)"));
86 EXPECT_FALSE(test(CSSPropertyWebkitFilter, "saturate(0)"));
87 EXPECT_FALSE(test(CSSPropertyWebkitFilter, "grayscale(1)"));
88 EXPECT_FALSE(test(CSSPropertyWebkitFilter, "invert(1)"));
89 EXPECT_FALSE(test(CSSPropertyWebkitFilter, "sepia(1)"));
90 EXPECT_TRUE(test(CSSPropertyWebkitFilter, "url(#svgfilter)"));
91 }
92
93 }
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