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

Side by Side Diff: ui/gfx/vector3d_unittest.cc

Issue 14367021: Rename ClampToMin and ClampToMax (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 6 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
« no previous file with comments | « ui/gfx/vector3d_f.h ('k') | ui/message_center/views/message_center_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <cmath> 5 #include <cmath>
6 #include <limits> 6 #include <limits>
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "ui/gfx/vector3d_f.h" 10 #include "ui/gfx/vector3d_f.h"
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 Vector3dF actual = gfx::CrossProduct(tests[i].input1, tests[i].input2); 227 Vector3dF actual = gfx::CrossProduct(tests[i].input1, tests[i].input2);
228 EXPECT_EQ(tests[i].expected.ToString(), actual.ToString()); 228 EXPECT_EQ(tests[i].expected.ToString(), actual.ToString());
229 } 229 }
230 } 230 }
231 231
232 TEST(Vector3dFTest, ClampVector3dF) { 232 TEST(Vector3dFTest, ClampVector3dF) {
233 Vector3dF a; 233 Vector3dF a;
234 234
235 a = Vector3dF(3.5f, 5.5f, 7.5f); 235 a = Vector3dF(3.5f, 5.5f, 7.5f);
236 EXPECT_EQ(Vector3dF(3.5f, 5.5f, 7.5f).ToString(), a.ToString()); 236 EXPECT_EQ(Vector3dF(3.5f, 5.5f, 7.5f).ToString(), a.ToString());
237 a.ClampToMin(Vector3dF(2, 4.5f, 6.5f)); 237 a.SetToMax(Vector3dF(2, 4.5f, 6.5f));
238 EXPECT_EQ(Vector3dF(3.5f, 5.5f, 7.5f).ToString(), a.ToString()); 238 EXPECT_EQ(Vector3dF(3.5f, 5.5f, 7.5f).ToString(), a.ToString());
239 a.ClampToMin(Vector3dF(3.5f, 5.5f, 7.5f)); 239 a.SetToMax(Vector3dF(3.5f, 5.5f, 7.5f));
240 EXPECT_EQ(Vector3dF(3.5f, 5.5f, 7.5f).ToString(), a.ToString()); 240 EXPECT_EQ(Vector3dF(3.5f, 5.5f, 7.5f).ToString(), a.ToString());
241 a.ClampToMin(Vector3dF(4.5f, 2, 6.5f)); 241 a.SetToMax(Vector3dF(4.5f, 2, 6.5f));
242 EXPECT_EQ(Vector3dF(4.5f, 5.5f, 7.5f).ToString(), a.ToString()); 242 EXPECT_EQ(Vector3dF(4.5f, 5.5f, 7.5f).ToString(), a.ToString());
243 a.ClampToMin(Vector3dF(3.5f, 6.5f, 6.5f)); 243 a.SetToMax(Vector3dF(3.5f, 6.5f, 6.5f));
244 EXPECT_EQ(Vector3dF(4.5f, 6.5f, 7.5f).ToString(), a.ToString()); 244 EXPECT_EQ(Vector3dF(4.5f, 6.5f, 7.5f).ToString(), a.ToString());
245 a.ClampToMin(Vector3dF(3.5f, 5.5f, 8.5f)); 245 a.SetToMax(Vector3dF(3.5f, 5.5f, 8.5f));
246 EXPECT_EQ(Vector3dF(4.5f, 6.5f, 8.5f).ToString(), a.ToString()); 246 EXPECT_EQ(Vector3dF(4.5f, 6.5f, 8.5f).ToString(), a.ToString());
247 a.ClampToMin(Vector3dF(8.5f, 10.5f, 12.5f)); 247 a.SetToMax(Vector3dF(8.5f, 10.5f, 12.5f));
248 EXPECT_EQ(Vector3dF(8.5f, 10.5f, 12.5f).ToString(), a.ToString()); 248 EXPECT_EQ(Vector3dF(8.5f, 10.5f, 12.5f).ToString(), a.ToString());
249 249
250 a.ClampToMax(Vector3dF(9.5f, 11.5f, 13.5f)); 250 a.SetToMin(Vector3dF(9.5f, 11.5f, 13.5f));
251 EXPECT_EQ(Vector3dF(8.5f, 10.5f, 12.5f).ToString(), a.ToString()); 251 EXPECT_EQ(Vector3dF(8.5f, 10.5f, 12.5f).ToString(), a.ToString());
252 a.ClampToMax(Vector3dF(8.5f, 10.5f, 12.5f)); 252 a.SetToMin(Vector3dF(8.5f, 10.5f, 12.5f));
253 EXPECT_EQ(Vector3dF(8.5f, 10.5f, 12.5f).ToString(), a.ToString()); 253 EXPECT_EQ(Vector3dF(8.5f, 10.5f, 12.5f).ToString(), a.ToString());
254 a.ClampToMax(Vector3dF(7.5f, 11.5f, 13.5f)); 254 a.SetToMin(Vector3dF(7.5f, 11.5f, 13.5f));
255 EXPECT_EQ(Vector3dF(7.5f, 10.5f, 12.5f).ToString(), a.ToString()); 255 EXPECT_EQ(Vector3dF(7.5f, 10.5f, 12.5f).ToString(), a.ToString());
256 a.ClampToMax(Vector3dF(9.5f, 9.5f, 13.5f)); 256 a.SetToMin(Vector3dF(9.5f, 9.5f, 13.5f));
257 EXPECT_EQ(Vector3dF(7.5f, 9.5f, 12.5f).ToString(), a.ToString()); 257 EXPECT_EQ(Vector3dF(7.5f, 9.5f, 12.5f).ToString(), a.ToString());
258 a.ClampToMax(Vector3dF(9.5f, 11.5f, 11.5f)); 258 a.SetToMin(Vector3dF(9.5f, 11.5f, 11.5f));
259 EXPECT_EQ(Vector3dF(7.5f, 9.5f, 11.5f).ToString(), a.ToString()); 259 EXPECT_EQ(Vector3dF(7.5f, 9.5f, 11.5f).ToString(), a.ToString());
260 a.ClampToMax(Vector3dF(3.5f, 5.5f, 7.5f)); 260 a.SetToMin(Vector3dF(3.5f, 5.5f, 7.5f));
261 EXPECT_EQ(Vector3dF(3.5f, 5.5f, 7.5f).ToString(), a.ToString()); 261 EXPECT_EQ(Vector3dF(3.5f, 5.5f, 7.5f).ToString(), a.ToString());
262 } 262 }
263 263
264 } // namespace gfx 264 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/vector3d_f.h ('k') | ui/message_center/views/message_center_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698