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

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

Issue 204743002: Oilpan: Move AnimatableValue's hierarchy to oilpan's heap (Closed) Base URL: svn://svn.chromium.org/blink/trunk
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 | Annotate | Revision Log
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 TEST(AnimationAnimatableDoubleTest, ToDouble) 62 TEST(AnimationAnimatableDoubleTest, ToDouble)
63 { 63 {
64 EXPECT_EQ(5.9, AnimatableDouble::create(5.9)->toDouble()); 64 EXPECT_EQ(5.9, AnimatableDouble::create(5.9)->toDouble());
65 EXPECT_EQ(-10, AnimatableDouble::create(-10)->toDouble()); 65 EXPECT_EQ(-10, AnimatableDouble::create(-10)->toDouble());
66 } 66 }
67 67
68 68
69 TEST(AnimationAnimatableDoubleTest, Interpolate) 69 TEST(AnimationAnimatableDoubleTest, Interpolate)
70 { 70 {
71 RefPtr<AnimatableDouble> from10 = AnimatableDouble::create(10); 71 RefPtrWillBeRawPtr<AnimatableDouble> from10 = AnimatableDouble::create(10);
72 RefPtr<AnimatableDouble> to20 = AnimatableDouble::create(20); 72 RefPtrWillBeRawPtr<AnimatableDouble> to20 = AnimatableDouble::create(20);
73 EXPECT_EQ(5, toAnimatableDouble(AnimatableValue::interpolate(from10.get(), t o20.get(), -0.5).get())->toDouble()); 73 EXPECT_EQ(5, toAnimatableDouble(AnimatableValue::interpolate(from10.get(), t o20.get(), -0.5).get())->toDouble());
74 EXPECT_EQ(10, toAnimatableDouble(AnimatableValue::interpolate(from10.get(), to20.get(), 0).get())->toDouble()); 74 EXPECT_EQ(10, toAnimatableDouble(AnimatableValue::interpolate(from10.get(), to20.get(), 0).get())->toDouble());
75 EXPECT_EQ(14, toAnimatableDouble(AnimatableValue::interpolate(from10.get(), to20.get(), 0.4).get())->toDouble()); 75 EXPECT_EQ(14, toAnimatableDouble(AnimatableValue::interpolate(from10.get(), to20.get(), 0.4).get())->toDouble());
76 EXPECT_EQ(15, toAnimatableDouble(AnimatableValue::interpolate(from10.get(), to20.get(), 0.5).get())->toDouble()); 76 EXPECT_EQ(15, toAnimatableDouble(AnimatableValue::interpolate(from10.get(), to20.get(), 0.5).get())->toDouble());
77 EXPECT_EQ(16, toAnimatableDouble(AnimatableValue::interpolate(from10.get(), to20.get(), 0.6).get())->toDouble()); 77 EXPECT_EQ(16, toAnimatableDouble(AnimatableValue::interpolate(from10.get(), to20.get(), 0.6).get())->toDouble());
78 EXPECT_EQ(20, toAnimatableDouble(AnimatableValue::interpolate(from10.get(), to20.get(), 1).get())->toDouble()); 78 EXPECT_EQ(20, toAnimatableDouble(AnimatableValue::interpolate(from10.get(), to20.get(), 1).get())->toDouble());
79 EXPECT_EQ(25, toAnimatableDouble(AnimatableValue::interpolate(from10.get(), to20.get(), 1.5).get())->toDouble()); 79 EXPECT_EQ(25, toAnimatableDouble(AnimatableValue::interpolate(from10.get(), to20.get(), 1.5).get())->toDouble());
80 } 80 }
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) 91 TEST(AnimationAnimatableDoubleTest, Distance)
92 { 92 {
93 RefPtr<AnimatableDouble> first = AnimatableDouble::create(-1.5); 93 RefPtrWillBeRawPtr<AnimatableDouble> first = AnimatableDouble::create(-1.5);
94 RefPtr<AnimatableDouble> second = AnimatableDouble::create(2.25); 94 RefPtrWillBeRawPtr<AnimatableDouble> second = AnimatableDouble::create(2.25) ;
95 RefPtr<AnimatableDouble> third = AnimatableDouble::create(3); 95 RefPtrWillBeRawPtr<AnimatableDouble> third = AnimatableDouble::create(3);
96 96
97 EXPECT_DOUBLE_EQ(3.75, AnimatableValue::distance(first.get(), second.get())) ; 97 EXPECT_DOUBLE_EQ(3.75, AnimatableValue::distance(first.get(), second.get())) ;
98 EXPECT_DOUBLE_EQ(0.75, AnimatableValue::distance(second.get(), third.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())); 99 EXPECT_DOUBLE_EQ(4.5, AnimatableValue::distance(third.get(), first.get()));
100 } 100 }
101 101
102 } 102 }
OLDNEW
« no previous file with comments | « Source/core/animation/AnimatableDouble.cpp ('k') | Source/core/animation/AnimatableFilterOperations.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698