Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 <limits> | 5 #include <limits> |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 908 EXPECT_FLOAT_EQ( | 908 EXPECT_FLOAT_EQ( |
| 909 0.0f, f.ManhattanInternalDistance(gfx::RectF(-1.0f, 0.0f, 1.1f, 1.0f))); | 909 0.0f, f.ManhattanInternalDistance(gfx::RectF(-1.0f, 0.0f, 1.1f, 1.0f))); |
| 910 EXPECT_FLOAT_EQ( | 910 EXPECT_FLOAT_EQ( |
| 911 0.1f + kEpsilon, | 911 0.1f + kEpsilon, |
| 912 f.ManhattanInternalDistance(gfx::RectF(-1.5f, 0.0f, 1.4f, 1.0f))); | 912 f.ManhattanInternalDistance(gfx::RectF(-1.5f, 0.0f, 1.4f, 1.0f))); |
| 913 EXPECT_FLOAT_EQ( | 913 EXPECT_FLOAT_EQ( |
| 914 kEpsilon, | 914 kEpsilon, |
| 915 f.ManhattanInternalDistance(gfx::RectF(-1.5f, 0.0f, 1.5f, 1.0f))); | 915 f.ManhattanInternalDistance(gfx::RectF(-1.5f, 0.0f, 1.5f, 1.0f))); |
| 916 } | 916 } |
| 917 | 917 |
| 918 TEST(RectTest, IntegerOverflow) { | |
| 919 Rect height_overflow(0, std::numeric_limits<int>::max() - 10, 100, 100); | |
| 920 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.
| |
| 921 | |
| 922 Rect width_overflow(std::numeric_limits<int>::max() - 10, 0, 100, 100); | |
| 923 EXPECT_EQ(10, width_overflow.width()); | |
| 924 | |
| 925 Rect size_height_overflow(Point(0, std::numeric_limits<int>::max() - 10), | |
| 926 Size(100, 100)); | |
| 927 EXPECT_EQ(10, size_height_overflow.height()); | |
| 928 | |
| 929 Rect size_width_overflow(Point(std::numeric_limits<int>::max() - 10, 0), | |
| 930 Size(100, 100)); | |
| 931 EXPECT_EQ(10, size_width_overflow.width()); | |
| 932 } | |
| 933 | |
| 918 } // namespace gfx | 934 } // namespace gfx |
| OLD | NEW |