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

Unified Diff: ui/gfx/geometry/point_unittest.cc

Issue 1372253002: gfx: Make conversions from gfx::Point to PointF explicit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pointfconvert-event: mandol_line Created 5 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/geometry/point_f.h ('k') | ui/ozone/platform/drm/host/drm_cursor.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/geometry/point_unittest.cc
diff --git a/ui/gfx/geometry/point_unittest.cc b/ui/gfx/geometry/point_unittest.cc
index 07a5d5b25ca4b36521cf203d2fad01d232b81008..dd5ea1d4ce7d3f486361f4333bfa3b8b47c496cb 100644
--- a/ui/gfx/geometry/point_unittest.cc
+++ b/ui/gfx/geometry/point_unittest.cc
@@ -10,23 +10,13 @@
namespace gfx {
-namespace {
-
-int TestPointF(const PointF& p) {
- return p.x();
-}
-
-} // namespace
-
TEST(PointTest, ToPointF) {
- // Check that implicit conversion from integer to float compiles.
+ // Check that explicit conversion from integer to float compiles.
Point a(10, 20);
- float x = TestPointF(a);
- EXPECT_EQ(x, a.x());
+ PointF b = PointF(a);
- PointF b(10, 20);
- EXPECT_EQ(a, b);
- EXPECT_EQ(b, a);
+ EXPECT_EQ(static_cast<float>(a.x()), b.x());
+ EXPECT_EQ(static_cast<float>(a.y()), b.y());
}
TEST(PointTest, IsOrigin) {
@@ -96,13 +86,12 @@ TEST(PointTest, ToRoundedPoint) {
}
TEST(PointTest, Scale) {
- EXPECT_EQ(PointF().ToString(), ScalePoint(Point(), 2).ToString());
- EXPECT_EQ(PointF().ToString(), ScalePoint(Point(), 2, 2).ToString());
+ EXPECT_EQ(PointF().ToString(), ScalePoint(PointF(), 2).ToString());
+ EXPECT_EQ(PointF().ToString(), ScalePoint(PointF(), 2, 2).ToString());
+ EXPECT_EQ(PointF(2, -2).ToString(), ScalePoint(PointF(1, -1), 2).ToString());
EXPECT_EQ(PointF(2, -2).ToString(),
- ScalePoint(Point(1, -1), 2).ToString());
- EXPECT_EQ(PointF(2, -2).ToString(),
- ScalePoint(Point(1, -1), 2, 2).ToString());
+ ScalePoint(PointF(1, -1), 2, 2).ToString());
PointF zero;
PointF one(1, -1);
« no previous file with comments | « ui/gfx/geometry/point_f.h ('k') | ui/ozone/platform/drm/host/drm_cursor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698