Index: ui/gfx/geometry/rect_unittest.cc |
diff --git a/ui/gfx/geometry/rect_unittest.cc b/ui/gfx/geometry/rect_unittest.cc |
index be4b462073671ccef217627f2c6977be5299ff08..aad1acfb13f367c97987e2fb85e46450c28d04fc 100644 |
--- a/ui/gfx/geometry/rect_unittest.cc |
+++ b/ui/gfx/geometry/rect_unittest.cc |
@@ -915,4 +915,20 @@ TEST(RectTest, ManhattanInternalDistance) { |
f.ManhattanInternalDistance(gfx::RectF(-1.5f, 0.0f, 1.5f, 1.0f))); |
} |
+TEST(RectTest, IntegerOverflow) { |
+ Rect height_overflow(0, std::numeric_limits<int>::max() - 10, 100, 100); |
+ EXPECT_EQ(10, height_overflow.height()); |
danakj
2016/08/25 17:59:21
can you EXPECT_EQ(max(), height_overflow.bottom())
sunxd
2016/08/25 19:25:09
Acknowledged.
|
+ |
+ Rect width_overflow(std::numeric_limits<int>::max() - 10, 0, 100, 100); |
+ EXPECT_EQ(10, width_overflow.width()); |
+ |
+ Rect size_height_overflow(Point(0, std::numeric_limits<int>::max() - 10), |
+ Size(100, 100)); |
+ EXPECT_EQ(10, size_height_overflow.height()); |
+ |
+ Rect size_width_overflow(Point(std::numeric_limits<int>::max() - 10, 0), |
+ Size(100, 100)); |
+ EXPECT_EQ(10, size_width_overflow.width()); |
+} |
+ |
} // namespace gfx |