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

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

Issue 2327903002: gfx: Do the ToEnclosingRect in double precision. (Closed)
Patch Set: update Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/geometry/rect_conversions.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/geometry/rect_unittest.cc
diff --git a/ui/gfx/geometry/rect_unittest.cc b/ui/gfx/geometry/rect_unittest.cc
index 7963cc0bbbf41562865126e200994a78a923786f..b436f0a8468c79f50c40cd3d91eb72b651d1a21b 100644
--- a/ui/gfx/geometry/rect_unittest.cc
+++ b/ui/gfx/geometry/rect_unittest.cc
@@ -530,39 +530,30 @@ TEST(RectTest, ToEnclosingRect) {
int y2;
int w2;
int h2;
- } tests[] = {{0.0f, 0.0f, 0.0f, 0.0f, 0, 0, 0, 0},
- {5.5f, 5.5f, 0.0f, 0.0f, 5, 5, 0, 0},
- {-1.5f, -1.5f, 3.0f, 3.0f, -2, -2, 4, 4},
- {-1.5f, -1.5f, 3.5f, 3.5f, -2, -2, 4, 4},
- {max_float, max_float, 2.0f, 2.0f, max_int, max_int, 0, 0},
- {0.0f, 0.0f, max_float, max_float, 0, 0, max_int, max_int},
- {20000.5f, 20000.5f, 0.5f, 0.5f, 20000, 20000, 1, 1},
- {static_cast<float>(min_int),
- static_cast<float>(min_int),
- max_int * 2.f,
- max_int * 2.f,
- min_int,
- min_int,
- max_int,
- max_int},
- {static_cast<float>(max_int),
- static_cast<float>(max_int),
- static_cast<float>(max_int),
- static_cast<float>(max_int),
- max_int,
- max_int,
- 0,
- 0}};
+ } tests[] = {
+ {0.0f, 0.0f, 0.0f, 0.0f, 0, 0, 0, 0},
+ {5.5f, 5.5f, 0.0f, 0.0f, 5, 5, 0, 0},
+ {-1.5f, -1.5f, 3.0f, 3.0f, -2, -2, 4, 4},
+ {-1.5f, -1.5f, 3.5f, 3.5f, -2, -2, 4, 4},
+ {max_float, max_float, 2.0f, 2.0f, max_int, max_int, 0, 0},
+ {0.0f, 0.0f, max_float, max_float, 0, 0, max_int, max_int},
+ {20000.5f, 20000.5f, 0.5f, 0.5f, 20000, 20000, 1, 1},
+ {static_cast<float>(min_int), static_cast<float>(min_int), max_int * 2.f,
+ max_int * 2.f, min_int, min_int, max_int, max_int},
+ {static_cast<float>(max_int), static_cast<float>(max_int),
+ static_cast<float>(max_int), static_cast<float>(max_int), max_int,
+ max_int, 0, 0},
+ {-0.5f, -0.5f, 22777712.f, 1.f, -1, -1, 22777713, 2}};
for (size_t i = 0; i < arraysize(tests); ++i) {
RectF r1(tests[i].x1, tests[i].y1, tests[i].w1, tests[i].h1);
Rect r2(tests[i].x2, tests[i].y2, tests[i].w2, tests[i].h2);
Rect enclosed = ToEnclosingRect(r1);
- EXPECT_FLOAT_AND_NAN_EQ(r2.x(), enclosed.x());
- EXPECT_FLOAT_AND_NAN_EQ(r2.y(), enclosed.y());
- EXPECT_FLOAT_AND_NAN_EQ(r2.width(), enclosed.width());
- EXPECT_FLOAT_AND_NAN_EQ(r2.height(), enclosed.height());
+ EXPECT_EQ(r2.x(), enclosed.x());
+ EXPECT_EQ(r2.y(), enclosed.y());
+ EXPECT_EQ(r2.width(), enclosed.width());
+ EXPECT_EQ(r2.height(), enclosed.height());
}
}
« no previous file with comments | « ui/gfx/geometry/rect_conversions.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698