| Index: ui/gfx/rect_unittest.cc
|
| diff --git a/ui/gfx/rect_unittest.cc b/ui/gfx/rect_unittest.cc
|
| index 1f31ae261376c4ba419b4f19632315e189ac8291..fbb3c9b8779f5438fd067c8a6c1a1c58ce0bdd2d 100644
|
| --- a/ui/gfx/rect_unittest.cc
|
| +++ b/ui/gfx/rect_unittest.cc
|
| @@ -671,4 +671,35 @@ TEST(RectTest, BoundingRect) {
|
| }
|
| }
|
|
|
| +TEST(RectTest, IsExpressibleAsRect) {
|
| + //EXPECT_TRUE(gfx::RectF().IsExpressibleAsRect());
|
| +
|
| + float min = std::numeric_limits<int>::min();
|
| + float max = std::numeric_limits<int>::max();
|
| + float infinity = std::numeric_limits<float>::infinity();
|
| +
|
| + EXPECT_TRUE(gfx::RectF(min, min, max, max).IsExpressibleAsRect());
|
| + EXPECT_TRUE(gfx::RectF(min + 200, min, max, max).IsExpressibleAsRect());
|
| + EXPECT_TRUE(gfx::RectF(min, min + 200, max, max).IsExpressibleAsRect());
|
| + EXPECT_FALSE(gfx::RectF(min - 200, min, max, max).IsExpressibleAsRect());
|
| + EXPECT_FALSE(gfx::RectF(min, min - 200, max, max).IsExpressibleAsRect());
|
| + EXPECT_TRUE(gfx::RectF(min, min, max - 200, max).IsExpressibleAsRect());
|
| + EXPECT_TRUE(gfx::RectF(min, min, max, max - 200).IsExpressibleAsRect());
|
| + EXPECT_FALSE(gfx::RectF(min, min, max + 200, max).IsExpressibleAsRect());
|
| + EXPECT_FALSE(gfx::RectF(min, min, max, max + 200).IsExpressibleAsRect());
|
| +
|
| + EXPECT_TRUE(gfx::RectF(0, 0, max, max).IsExpressibleAsRect());
|
| + EXPECT_FALSE(gfx::RectF(200, 0, max, max).IsExpressibleAsRect());
|
| + EXPECT_FALSE(gfx::RectF(0, 200, max, max).IsExpressibleAsRect());
|
| + EXPECT_TRUE(gfx::RectF(0, 0, max - 200, max).IsExpressibleAsRect());
|
| + EXPECT_TRUE(gfx::RectF(0, 0, max, max - 200).IsExpressibleAsRect());
|
| + EXPECT_FALSE(gfx::RectF(0, 0, max + 200, max).IsExpressibleAsRect());
|
| + EXPECT_FALSE(gfx::RectF(0, 0, max, max + 200).IsExpressibleAsRect());
|
| +
|
| + EXPECT_FALSE(gfx::RectF(infinity, 0, 1, 1).IsExpressibleAsRect());
|
| + EXPECT_FALSE(gfx::RectF(0, infinity, 1, 1).IsExpressibleAsRect());
|
| + EXPECT_FALSE(gfx::RectF(0, 0, infinity, 1).IsExpressibleAsRect());
|
| + EXPECT_FALSE(gfx::RectF(0, 0, 1, infinity).IsExpressibleAsRect());
|
| +}
|
| +
|
| } // namespace ui
|
|
|