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

Unified Diff: ui/gfx/vector2d_unittest.cc

Issue 11293193: ui: Add non-member Vector2dScale() and Vector3dScale() methods to create scaled vectors (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 8 years, 1 month 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 | « ui/gfx/vector2d_f.cc ('k') | ui/gfx/vector3d_f.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/vector2d_unittest.cc
diff --git a/ui/gfx/vector2d_unittest.cc b/ui/gfx/vector2d_unittest.cc
index ccb6059e2420793540cd4bafb82b14fd17f86597..b71b310a22f649fe66dabcad3f9cc294106a84c3 100644
--- a/ui/gfx/vector2d_unittest.cc
+++ b/ui/gfx/vector2d_unittest.cc
@@ -115,6 +115,12 @@ TEST(Vector2dTest, Scale) {
v.Scale(double_values[i][2], double_values[i][3]);
EXPECT_EQ(v.x(), double_values[i][0] * double_values[i][2]);
EXPECT_EQ(v.y(), double_values[i][1] * double_values[i][3]);
+
+ Vector2dF v2 = ScaleVector2d(
+ gfx::Vector2dF(double_values[i][0], double_values[i][1]),
+ double_values[i][2], double_values[i][3]);
+ EXPECT_EQ(double_values[i][0] * double_values[i][2], v2.x());
+ EXPECT_EQ(double_values[i][1] * double_values[i][3], v2.y());
}
float single_values[][3] = {
@@ -134,6 +140,12 @@ TEST(Vector2dTest, Scale) {
v.Scale(single_values[i][2]);
EXPECT_EQ(v.x(), single_values[i][0] * single_values[i][2]);
EXPECT_EQ(v.y(), single_values[i][1] * single_values[i][2]);
+
+ Vector2dF v2 = ScaleVector2d(
+ gfx::Vector2dF(double_values[i][0], double_values[i][1]),
+ double_values[i][2]);
+ EXPECT_EQ(single_values[i][0] * single_values[i][2], v2.x());
+ EXPECT_EQ(single_values[i][1] * single_values[i][2], v2.y());
}
}
« no previous file with comments | « ui/gfx/vector2d_f.cc ('k') | ui/gfx/vector3d_f.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698