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

Unified Diff: Source/core/animation/AnimatableColorTest.cpp

Issue 186463002: Web Animations: define distance for AnimatableColor (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove blank line Created 6 years, 10 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
« no previous file with comments | « Source/core/animation/AnimatableColor.cpp ('k') | Source/core/animation/AnimatableDouble.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/animation/AnimatableColorTest.cpp
diff --git a/Source/core/animation/AnimatableColorTest.cpp b/Source/core/animation/AnimatableColorTest.cpp
index 12ecf8570a0844aa5a02c401bb6931b8c35a5d89..b9838aac219acd160fdb1b0137546568655c3b64 100644
--- a/Source/core/animation/AnimatableColorTest.cpp
+++ b/Source/core/animation/AnimatableColorTest.cpp
@@ -75,5 +75,16 @@ TEST(AnimationAnimatableColorTest, Add)
EXPECT_EQ(AnimatableColorImpl(Color(0x10204080)).addWith(Color(0x104080C0)).toColor().rgb(), 0x203060A0u);
}
+TEST(AnimationAnimatableColorTest, Distance)
+{
+ EXPECT_NEAR(1.0, AnimatableColorImpl(Color(0xFF000000)).distanceTo(Color(0xFFFF0000)), 0.00000001);
+ EXPECT_NEAR(13.0 / 255, AnimatableColorImpl(Color(0xFF53647C)).distanceTo(Color(0xFF506070)), 0.00000001);
+ EXPECT_NEAR(60.0 / 255, AnimatableColorImpl(Color(0x3C000000)).distanceTo(Color(0x00FFFFFF)), 0.00000001);
+ EXPECT_NEAR(60.0 / 255, AnimatableColorImpl(Color(0x3C000000)).distanceTo(Color(0x3C00FF00)), 0.00000001);
+
+ RefPtrWillBeRawPtr<AnimatableColor> first = AnimatableColor::create(AnimatableColorImpl(Color(0xFF53647C)), AnimatableColorImpl(Color(0xFF000000)));
+ RefPtrWillBeRawPtr<AnimatableColor> second = AnimatableColor::create(AnimatableColorImpl(Color(0xFF506070)), AnimatableColorImpl(Color(0xFF000000)));
+ EXPECT_NEAR(13.0 / 255, AnimatableValue::distance(first.get(), second.get()), 0.00000001);
}
+}
« no previous file with comments | « Source/core/animation/AnimatableColor.cpp ('k') | Source/core/animation/AnimatableDouble.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698