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

Side by Side Diff: Source/core/animation/AnimatableDoubleTest.cpp

Issue 186463002: Web Animations: define distance for AnimatableColor (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 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
1 /* 1 /*
2 * Copyright (c) 2013, Google Inc. All rights reserved. 2 * Copyright (c) 2013, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 81
82 TEST(AnimationAnimatableDoubleTest, Add) 82 TEST(AnimationAnimatableDoubleTest, Add)
83 { 83 {
84 EXPECT_EQ(-10, toAnimatableDouble(AnimatableValue::add(AnimatableDouble::cre ate(-2).get(), AnimatableDouble::create(-8).get()).get())->toDouble()); 84 EXPECT_EQ(-10, toAnimatableDouble(AnimatableValue::add(AnimatableDouble::cre ate(-2).get(), AnimatableDouble::create(-8).get()).get())->toDouble());
85 EXPECT_EQ(0, toAnimatableDouble(AnimatableValue::add(AnimatableDouble::creat e(50).get(), AnimatableDouble::create(-50).get()).get())->toDouble()); 85 EXPECT_EQ(0, toAnimatableDouble(AnimatableValue::add(AnimatableDouble::creat e(50).get(), AnimatableDouble::create(-50).get()).get())->toDouble());
86 EXPECT_EQ(10, toAnimatableDouble(AnimatableValue::add(AnimatableDouble::crea te(4).get(), AnimatableDouble::create(6).get()).get())->toDouble()); 86 EXPECT_EQ(10, toAnimatableDouble(AnimatableValue::add(AnimatableDouble::crea te(4).get(), AnimatableDouble::create(6).get()).get())->toDouble());
87 EXPECT_EQ(20, toAnimatableDouble(AnimatableValue::add(AnimatableDouble::crea te(0).get(), AnimatableDouble::create(20).get()).get())->toDouble()); 87 EXPECT_EQ(20, toAnimatableDouble(AnimatableValue::add(AnimatableDouble::crea te(0).get(), AnimatableDouble::create(20).get()).get())->toDouble());
88 EXPECT_EQ(30, toAnimatableDouble(AnimatableValue::add(AnimatableDouble::crea te(30).get(), AnimatableDouble::create(0).get()).get())->toDouble()); 88 EXPECT_EQ(30, toAnimatableDouble(AnimatableValue::add(AnimatableDouble::crea te(30).get(), AnimatableDouble::create(0).get()).get())->toDouble());
89 } 89 }
90 90
91 TEST(AnimationAnimatableDoubleTest, Distance)
92 {
93 RefPtrWillBeRawPtr<AnimatableDouble> first = AnimatableDouble::create(-1.5);
94 RefPtrWillBeRawPtr<AnimatableDouble> second = AnimatableDouble::create(2.25) ;
95 RefPtrWillBeRawPtr<AnimatableDouble> third = AnimatableDouble::create(3);
96
97 EXPECT_DOUBLE_EQ(3.75, AnimatableValue::distance(first.get(), second.get())) ;
98 EXPECT_DOUBLE_EQ(0.75, AnimatableValue::distance(second.get(), third.get())) ;
99 EXPECT_DOUBLE_EQ(4.5, AnimatableValue::distance(third.get(), first.get()));
91 } 100 }
101
102 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698