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

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

Issue 11369144: ui: Make gfx::Point::Scale() mutate the class, similar to gfx::Rect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes for aura 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 unified diff | Download patch | Annotate | Revision Log
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 "ui/gfx/point_base.h" 5 #include "ui/gfx/point_base.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "ui/gfx/point.h" 9 #include "ui/gfx/point.h"
10 #include "ui/gfx/point_conversions.h" 10 #include "ui/gfx/point_conversions.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 EXPECT_EQ(Point(11, 11), ToRoundedPoint(PointF(10.5f, 10.5f))); 91 EXPECT_EQ(Point(11, 11), ToRoundedPoint(PointF(10.5f, 10.5f)));
92 EXPECT_EQ(Point(11, 11), ToRoundedPoint(PointF(10.9999f, 10.9999f))); 92 EXPECT_EQ(Point(11, 11), ToRoundedPoint(PointF(10.9999f, 10.9999f)));
93 93
94 EXPECT_EQ(Point(-10, -10), ToRoundedPoint(PointF(-10, -10))); 94 EXPECT_EQ(Point(-10, -10), ToRoundedPoint(PointF(-10, -10)));
95 EXPECT_EQ(Point(-10, -10), ToRoundedPoint(PointF(-10.0001f, -10.0001f))); 95 EXPECT_EQ(Point(-10, -10), ToRoundedPoint(PointF(-10.0001f, -10.0001f)));
96 EXPECT_EQ(Point(-10, -10), ToRoundedPoint(PointF(-10.4999f, -10.4999f))); 96 EXPECT_EQ(Point(-10, -10), ToRoundedPoint(PointF(-10.4999f, -10.4999f)));
97 EXPECT_EQ(Point(-11, -11), ToRoundedPoint(PointF(-10.5f, -10.5f))); 97 EXPECT_EQ(Point(-11, -11), ToRoundedPoint(PointF(-10.5f, -10.5f)));
98 EXPECT_EQ(Point(-11, -11), ToRoundedPoint(PointF(-10.9999f, -10.9999f))); 98 EXPECT_EQ(Point(-11, -11), ToRoundedPoint(PointF(-10.9999f, -10.9999f)));
99 } 99 }
100 100
101 TEST(PointTest, Scale) {
102 EXPECT_EQ(PointF().ToString(), ScalePoint(Point(), 2).ToString());
103 EXPECT_EQ(PointF().ToString(), ScalePoint(Point(), 2, 2).ToString());
104
105 EXPECT_EQ(PointF(2, -2).ToString(),
106 ScalePoint(Point(1, -1), 2).ToString());
107 EXPECT_EQ(PointF(2, -2).ToString(),
108 ScalePoint(Point(1, -1), 2, 2).ToString());
109
110 PointF zero;
111 PointF one(1, -1);
112
113 zero.Scale(2);
114 zero.Scale(3, 1.5);
115
116 one.Scale(2);
117 one.Scale(3, 1.5);
118
119 EXPECT_EQ(PointF().ToString(), zero.ToString());
120 EXPECT_EQ(PointF(6, -3).ToString(), one.ToString());
121 }
122
101 } // namespace gfx 123 } // namespace gfx
OLDNEW
« cc/layer_impl.cc ('K') | « ui/gfx/point_f.cc ('k') | ui/gfx/quad_f.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698