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

Unified Diff: third_party/WebKit/Source/core/animation/PropertyHandleTest.cpp

Issue 2309873003: Extend PropertyHandle to include custom property identifiers (Closed)
Patch Set: Add unit tests Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/animation/PropertyHandleTest.cpp
diff --git a/third_party/WebKit/Source/core/animation/PropertyHandleTest.cpp b/third_party/WebKit/Source/core/animation/PropertyHandleTest.cpp
index 6eaa1c121ce5c7df120b2f04c2f2999ae12e33bb..99b9198f61b763fbab24cb0aa125efec8de4ee6b 100644
--- a/third_party/WebKit/Source/core/animation/PropertyHandleTest.cpp
+++ b/third_party/WebKit/Source/core/animation/PropertyHandleTest.cpp
@@ -17,15 +17,33 @@ class PropertyHandleTest : public ::testing::Test {
TEST_F(PropertyHandleTest, Equality)
{
+ AtomicString nameA = "--a";
+ AtomicString nameB = "--b";
+
EXPECT_TRUE(PropertyHandle(CSSPropertyOpacity) == PropertyHandle(CSSPropertyOpacity));
EXPECT_FALSE(PropertyHandle(CSSPropertyOpacity) != PropertyHandle(CSSPropertyOpacity));
EXPECT_FALSE(PropertyHandle(CSSPropertyOpacity) == PropertyHandle(CSSPropertyTransform));
EXPECT_TRUE(PropertyHandle(CSSPropertyOpacity) != PropertyHandle(CSSPropertyTransform));
+ EXPECT_FALSE(PropertyHandle(CSSPropertyOpacity) == PropertyHandle(nameA));
+ EXPECT_TRUE(PropertyHandle(CSSPropertyOpacity) != PropertyHandle(nameA));
EXPECT_FALSE(PropertyHandle(CSSPropertyOpacity) == PropertyHandle(amplitudeAttr));
EXPECT_TRUE(PropertyHandle(CSSPropertyOpacity) != PropertyHandle(amplitudeAttr));
+ EXPECT_FALSE(PropertyHandle(nameA) == PropertyHandle(CSSPropertyOpacity));
+ EXPECT_TRUE(PropertyHandle(nameA) != PropertyHandle(CSSPropertyOpacity));
+ EXPECT_FALSE(PropertyHandle(nameA) == PropertyHandle(CSSPropertyTransform));
+ EXPECT_TRUE(PropertyHandle(nameA) != PropertyHandle(CSSPropertyTransform));
+ EXPECT_TRUE(PropertyHandle(nameA) == PropertyHandle(nameA));
+ EXPECT_FALSE(PropertyHandle(nameA) != PropertyHandle(nameA));
+ EXPECT_FALSE(PropertyHandle(nameA) == PropertyHandle(nameB));
+ EXPECT_TRUE(PropertyHandle(nameA) != PropertyHandle(nameB));
+ EXPECT_FALSE(PropertyHandle(nameA) == PropertyHandle(amplitudeAttr));
+ EXPECT_TRUE(PropertyHandle(nameA) != PropertyHandle(amplitudeAttr));
+
EXPECT_FALSE(PropertyHandle(amplitudeAttr) == PropertyHandle(CSSPropertyOpacity));
EXPECT_TRUE(PropertyHandle(amplitudeAttr) != PropertyHandle(CSSPropertyOpacity));
+ EXPECT_FALSE(PropertyHandle(amplitudeAttr) == PropertyHandle(nameA));
+ EXPECT_TRUE(PropertyHandle(amplitudeAttr) != PropertyHandle(nameA));
EXPECT_TRUE(PropertyHandle(amplitudeAttr) == PropertyHandle(amplitudeAttr));
EXPECT_FALSE(PropertyHandle(amplitudeAttr) != PropertyHandle(amplitudeAttr));
EXPECT_FALSE(PropertyHandle(amplitudeAttr) == PropertyHandle(exponentAttr));
@@ -34,23 +52,44 @@ TEST_F(PropertyHandleTest, Equality)
TEST_F(PropertyHandleTest, Hash)
{
+ AtomicString nameA = "--a";
+ AtomicString nameB = "--b";
+
EXPECT_TRUE(PropertyHandle(CSSPropertyOpacity).hash() == PropertyHandle(CSSPropertyOpacity).hash());
+ EXPECT_FALSE(PropertyHandle(CSSPropertyOpacity).hash() == PropertyHandle(nameA).hash());
EXPECT_FALSE(PropertyHandle(CSSPropertyOpacity).hash() == PropertyHandle(CSSPropertyTransform).hash());
EXPECT_FALSE(PropertyHandle(CSSPropertyOpacity).hash() == PropertyHandle(amplitudeAttr).hash());
+ EXPECT_FALSE(PropertyHandle(nameA).hash() == PropertyHandle(CSSPropertyOpacity).hash());
+ EXPECT_TRUE(PropertyHandle(nameA).hash() == PropertyHandle(nameA).hash());
+ EXPECT_FALSE(PropertyHandle(nameA).hash() == PropertyHandle(nameB).hash());
+ EXPECT_FALSE(PropertyHandle(nameA).hash() == PropertyHandle(exponentAttr).hash());
+
EXPECT_FALSE(PropertyHandle(amplitudeAttr).hash() == PropertyHandle(CSSPropertyOpacity).hash());
+ EXPECT_FALSE(PropertyHandle(amplitudeAttr).hash() == PropertyHandle(nameA).hash());
EXPECT_TRUE(PropertyHandle(amplitudeAttr).hash() == PropertyHandle(amplitudeAttr).hash());
EXPECT_FALSE(PropertyHandle(amplitudeAttr).hash() == PropertyHandle(exponentAttr).hash());
}
TEST_F(PropertyHandleTest, Accessors)
{
+ AtomicString name = "--x";
+
EXPECT_TRUE(PropertyHandle(CSSPropertyOpacity).isCSSProperty());
- EXPECT_EQ(PropertyHandle(CSSPropertyOpacity).cssProperty(), CSSPropertyOpacity);
+ EXPECT_TRUE(PropertyHandle(name).isCSSProperty());
EXPECT_FALSE(PropertyHandle(amplitudeAttr).isCSSProperty());
EXPECT_FALSE(PropertyHandle(CSSPropertyOpacity).isSVGAttribute());
+ EXPECT_FALSE(PropertyHandle(name).isSVGAttribute());
EXPECT_TRUE(PropertyHandle(amplitudeAttr).isSVGAttribute());
+
+ EXPECT_FALSE(PropertyHandle(CSSPropertyOpacity).isCSSCustomProperty());
+ EXPECT_TRUE(PropertyHandle(name).isCSSCustomProperty());
+ EXPECT_FALSE(PropertyHandle(amplitudeAttr).isCSSCustomProperty());
+
+ EXPECT_EQ(PropertyHandle(CSSPropertyOpacity).cssProperty(), CSSPropertyOpacity);
+ EXPECT_EQ(PropertyHandle(name).cssProperty(), CSSPropertyVariable);
+ EXPECT_EQ(PropertyHandle(name).customPropertyName(), name);
EXPECT_EQ(PropertyHandle(amplitudeAttr).svgAttribute(), amplitudeAttr);
}

Powered by Google App Engine
This is Rietveld 408576698