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

Side by Side Diff: third_party/WebKit/Source/core/animation/animatable/AnimatableDoubleAndBoolTest.cpp

Issue 2701993002: DO NOT COMMIT: Results of running new (proposed) clang-format on Blink (Closed)
Patch Set: Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/animation/animatable/AnimatableDoubleAndBool.h" 5 #include "core/animation/animatable/AnimatableDoubleAndBool.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 namespace blink { 9 namespace blink {
10 10
(...skipping 30 matching lines...) Expand all
41 TEST(AnimationAnimatableDoubleAndBoolTest, InterpolateFalse) { 41 TEST(AnimationAnimatableDoubleAndBoolTest, InterpolateFalse) {
42 RefPtr<AnimatableDoubleAndBool> from10 = 42 RefPtr<AnimatableDoubleAndBool> from10 =
43 AnimatableDoubleAndBool::create(10, false); 43 AnimatableDoubleAndBool::create(10, false);
44 RefPtr<AnimatableDoubleAndBool> to20 = 44 RefPtr<AnimatableDoubleAndBool> to20 =
45 AnimatableDoubleAndBool::create(20, false); 45 AnimatableDoubleAndBool::create(20, false);
46 EXPECT_FALSE( 46 EXPECT_FALSE(
47 toAnimatableDoubleAndBool( 47 toAnimatableDoubleAndBool(
48 AnimatableValue::interpolate(from10.get(), to20.get(), -0.5).get()) 48 AnimatableValue::interpolate(from10.get(), to20.get(), -0.5).get())
49 ->flag()); 49 ->flag());
50 EXPECT_EQ( 50 EXPECT_EQ(
51 5, toAnimatableDoubleAndBool( 51 5,
52 AnimatableValue::interpolate(from10.get(), to20.get(), -0.5).get()) 52 toAnimatableDoubleAndBool(
53 ->toDouble()); 53 AnimatableValue::interpolate(from10.get(), to20.get(), -0.5).get())
54 ->toDouble());
54 EXPECT_EQ(10, 55 EXPECT_EQ(10,
55 toAnimatableDoubleAndBool( 56 toAnimatableDoubleAndBool(
56 AnimatableValue::interpolate(from10.get(), to20.get(), 0).get()) 57 AnimatableValue::interpolate(from10.get(), to20.get(), 0).get())
57 ->toDouble()); 58 ->toDouble());
58 EXPECT_EQ( 59 EXPECT_EQ(
59 14, toAnimatableDoubleAndBool( 60 14,
60 AnimatableValue::interpolate(from10.get(), to20.get(), 0.4).get()) 61 toAnimatableDoubleAndBool(
61 ->toDouble()); 62 AnimatableValue::interpolate(from10.get(), to20.get(), 0.4).get())
63 ->toDouble());
62 EXPECT_EQ( 64 EXPECT_EQ(
63 15, toAnimatableDoubleAndBool( 65 15,
64 AnimatableValue::interpolate(from10.get(), to20.get(), 0.5).get()) 66 toAnimatableDoubleAndBool(
65 ->toDouble()); 67 AnimatableValue::interpolate(from10.get(), to20.get(), 0.5).get())
68 ->toDouble());
66 EXPECT_EQ( 69 EXPECT_EQ(
67 16, toAnimatableDoubleAndBool( 70 16,
68 AnimatableValue::interpolate(from10.get(), to20.get(), 0.6).get()) 71 toAnimatableDoubleAndBool(
69 ->toDouble()); 72 AnimatableValue::interpolate(from10.get(), to20.get(), 0.6).get())
73 ->toDouble());
70 EXPECT_EQ(20, 74 EXPECT_EQ(20,
71 toAnimatableDoubleAndBool( 75 toAnimatableDoubleAndBool(
72 AnimatableValue::interpolate(from10.get(), to20.get(), 1).get()) 76 AnimatableValue::interpolate(from10.get(), to20.get(), 1).get())
73 ->toDouble()); 77 ->toDouble());
74 EXPECT_EQ( 78 EXPECT_EQ(
75 25, toAnimatableDoubleAndBool( 79 25,
76 AnimatableValue::interpolate(from10.get(), to20.get(), 1.5).get()) 80 toAnimatableDoubleAndBool(
77 ->toDouble()); 81 AnimatableValue::interpolate(from10.get(), to20.get(), 1.5).get())
82 ->toDouble());
78 EXPECT_FALSE( 83 EXPECT_FALSE(
79 toAnimatableDoubleAndBool( 84 toAnimatableDoubleAndBool(
80 AnimatableValue::interpolate(from10.get(), to20.get(), 1.5).get()) 85 AnimatableValue::interpolate(from10.get(), to20.get(), 1.5).get())
81 ->flag()); 86 ->flag());
82 } 87 }
83 88
84 TEST(AnimationAnimatableDoubleAndBoolTest, InterpolateTrue) { 89 TEST(AnimationAnimatableDoubleAndBoolTest, InterpolateTrue) {
85 RefPtr<AnimatableDoubleAndBool> from10 = 90 RefPtr<AnimatableDoubleAndBool> from10 =
86 AnimatableDoubleAndBool::create(10, true); 91 AnimatableDoubleAndBool::create(10, true);
87 RefPtr<AnimatableDoubleAndBool> to20 = 92 RefPtr<AnimatableDoubleAndBool> to20 =
88 AnimatableDoubleAndBool::create(20, true); 93 AnimatableDoubleAndBool::create(20, true);
89 EXPECT_TRUE( 94 EXPECT_TRUE(
90 toAnimatableDoubleAndBool( 95 toAnimatableDoubleAndBool(
91 AnimatableValue::interpolate(from10.get(), to20.get(), -0.5).get()) 96 AnimatableValue::interpolate(from10.get(), to20.get(), -0.5).get())
92 ->flag()); 97 ->flag());
93 EXPECT_EQ( 98 EXPECT_EQ(
94 5, toAnimatableDoubleAndBool( 99 5,
95 AnimatableValue::interpolate(from10.get(), to20.get(), -0.5).get()) 100 toAnimatableDoubleAndBool(
96 ->toDouble()); 101 AnimatableValue::interpolate(from10.get(), to20.get(), -0.5).get())
102 ->toDouble());
97 EXPECT_EQ(10, 103 EXPECT_EQ(10,
98 toAnimatableDoubleAndBool( 104 toAnimatableDoubleAndBool(
99 AnimatableValue::interpolate(from10.get(), to20.get(), 0).get()) 105 AnimatableValue::interpolate(from10.get(), to20.get(), 0).get())
100 ->toDouble()); 106 ->toDouble());
101 EXPECT_EQ( 107 EXPECT_EQ(
102 14, toAnimatableDoubleAndBool( 108 14,
103 AnimatableValue::interpolate(from10.get(), to20.get(), 0.4).get()) 109 toAnimatableDoubleAndBool(
104 ->toDouble()); 110 AnimatableValue::interpolate(from10.get(), to20.get(), 0.4).get())
111 ->toDouble());
105 EXPECT_EQ( 112 EXPECT_EQ(
106 15, toAnimatableDoubleAndBool( 113 15,
107 AnimatableValue::interpolate(from10.get(), to20.get(), 0.5).get()) 114 toAnimatableDoubleAndBool(
108 ->toDouble()); 115 AnimatableValue::interpolate(from10.get(), to20.get(), 0.5).get())
116 ->toDouble());
109 EXPECT_EQ( 117 EXPECT_EQ(
110 16, toAnimatableDoubleAndBool( 118 16,
111 AnimatableValue::interpolate(from10.get(), to20.get(), 0.6).get()) 119 toAnimatableDoubleAndBool(
112 ->toDouble()); 120 AnimatableValue::interpolate(from10.get(), to20.get(), 0.6).get())
121 ->toDouble());
113 EXPECT_EQ(20, 122 EXPECT_EQ(20,
114 toAnimatableDoubleAndBool( 123 toAnimatableDoubleAndBool(
115 AnimatableValue::interpolate(from10.get(), to20.get(), 1).get()) 124 AnimatableValue::interpolate(from10.get(), to20.get(), 1).get())
116 ->toDouble()); 125 ->toDouble());
117 EXPECT_EQ( 126 EXPECT_EQ(
118 25, toAnimatableDoubleAndBool( 127 25,
119 AnimatableValue::interpolate(from10.get(), to20.get(), 1.5).get()) 128 toAnimatableDoubleAndBool(
120 ->toDouble()); 129 AnimatableValue::interpolate(from10.get(), to20.get(), 1.5).get())
130 ->toDouble());
121 EXPECT_TRUE( 131 EXPECT_TRUE(
122 toAnimatableDoubleAndBool( 132 toAnimatableDoubleAndBool(
123 AnimatableValue::interpolate(from10.get(), to20.get(), 1.5).get()) 133 AnimatableValue::interpolate(from10.get(), to20.get(), 1.5).get())
124 ->flag()); 134 ->flag());
125 } 135 }
126 136
127 TEST(AnimationAnimatableDoubleAndBoolTest, Step) { 137 TEST(AnimationAnimatableDoubleAndBoolTest, Step) {
128 RefPtr<AnimatableDoubleAndBool> from10 = 138 RefPtr<AnimatableDoubleAndBool> from10 =
129 AnimatableDoubleAndBool::create(10, true); 139 AnimatableDoubleAndBool::create(10, true);
130 RefPtr<AnimatableDoubleAndBool> to20 = 140 RefPtr<AnimatableDoubleAndBool> to20 =
131 AnimatableDoubleAndBool::create(20, false); 141 AnimatableDoubleAndBool::create(20, false);
132 EXPECT_TRUE( 142 EXPECT_TRUE(
133 toAnimatableDoubleAndBool( 143 toAnimatableDoubleAndBool(
134 AnimatableValue::interpolate(from10.get(), to20.get(), -0.5).get()) 144 AnimatableValue::interpolate(from10.get(), to20.get(), -0.5).get())
135 ->flag()); 145 ->flag());
136 EXPECT_EQ( 146 EXPECT_EQ(
137 10, 147 10,
138 toAnimatableDoubleAndBool( 148 toAnimatableDoubleAndBool(
139 AnimatableValue::interpolate(from10.get(), to20.get(), -0.5).get()) 149 AnimatableValue::interpolate(from10.get(), to20.get(), -0.5).get())
140 ->toDouble()); 150 ->toDouble());
141 EXPECT_EQ(10, 151 EXPECT_EQ(10,
142 toAnimatableDoubleAndBool( 152 toAnimatableDoubleAndBool(
143 AnimatableValue::interpolate(from10.get(), to20.get(), 0).get()) 153 AnimatableValue::interpolate(from10.get(), to20.get(), 0).get())
144 ->toDouble()); 154 ->toDouble());
145 EXPECT_EQ( 155 EXPECT_EQ(
146 10, toAnimatableDoubleAndBool( 156 10,
147 AnimatableValue::interpolate(from10.get(), to20.get(), 0.4).get()) 157 toAnimatableDoubleAndBool(
148 ->toDouble()); 158 AnimatableValue::interpolate(from10.get(), to20.get(), 0.4).get())
159 ->toDouble());
149 EXPECT_TRUE( 160 EXPECT_TRUE(
150 toAnimatableDoubleAndBool( 161 toAnimatableDoubleAndBool(
151 AnimatableValue::interpolate(from10.get(), to20.get(), 0.4).get()) 162 AnimatableValue::interpolate(from10.get(), to20.get(), 0.4).get())
152 ->flag()); 163 ->flag());
153 164
154 EXPECT_FALSE( 165 EXPECT_FALSE(
155 toAnimatableDoubleAndBool( 166 toAnimatableDoubleAndBool(
156 AnimatableValue::interpolate(from10.get(), to20.get(), 0.6).get()) 167 AnimatableValue::interpolate(from10.get(), to20.get(), 0.6).get())
157 ->flag()); 168 ->flag());
158 EXPECT_EQ( 169 EXPECT_EQ(
159 20, toAnimatableDoubleAndBool( 170 20,
160 AnimatableValue::interpolate(from10.get(), to20.get(), 0.6).get()) 171 toAnimatableDoubleAndBool(
161 ->toDouble()); 172 AnimatableValue::interpolate(from10.get(), to20.get(), 0.6).get())
173 ->toDouble());
162 EXPECT_EQ(20, 174 EXPECT_EQ(20,
163 toAnimatableDoubleAndBool( 175 toAnimatableDoubleAndBool(
164 AnimatableValue::interpolate(from10.get(), to20.get(), 1).get()) 176 AnimatableValue::interpolate(from10.get(), to20.get(), 1).get())
165 ->toDouble()); 177 ->toDouble());
166 EXPECT_EQ( 178 EXPECT_EQ(
167 20, toAnimatableDoubleAndBool( 179 20,
168 AnimatableValue::interpolate(from10.get(), to20.get(), 1.5).get()) 180 toAnimatableDoubleAndBool(
169 ->toDouble()); 181 AnimatableValue::interpolate(from10.get(), to20.get(), 1.5).get())
182 ->toDouble());
170 EXPECT_FALSE( 183 EXPECT_FALSE(
171 toAnimatableDoubleAndBool( 184 toAnimatableDoubleAndBool(
172 AnimatableValue::interpolate(from10.get(), to20.get(), 1.5).get()) 185 AnimatableValue::interpolate(from10.get(), to20.get(), 1.5).get())
173 ->flag()); 186 ->flag());
174 } 187 }
175 188
176 } // namespace blink 189 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698