| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 #ifndef CC_TEST_GEOMETRY_TEST_UTILS_H_ | 5 #ifndef CC_TEST_GEOMETRY_TEST_UTILS_H_ |
| 6 #define CC_TEST_GEOMETRY_TEST_UTILS_H_ | 6 #define CC_TEST_GEOMETRY_TEST_UTILS_H_ |
| 7 | 7 |
| 8 namespace gfx { | 8 namespace gfx { |
| 9 class Transform; | 9 class Transform; |
| 10 } | 10 } |
| 11 | 11 |
| 12 namespace cc { | 12 namespace cc { |
| 13 | 13 |
| 14 // These are macros instead of functions so that we get useful line numbers | 14 // These are macros instead of functions so that we get useful line numbers |
| 15 // where a test failed. | 15 // where a test failed. |
| 16 #define EXPECT_FLOAT_RECT_EQ(expected, actual) \ | 16 #define EXPECT_FLOAT_RECT_EQ(expected, actual) \ |
| 17 do { \ | 17 do { \ |
| 18 EXPECT_FLOAT_EQ((expected).x(), (actual).x()); \ | 18 EXPECT_FLOAT_EQ((expected).x(), (actual).x()); \ |
| 19 EXPECT_FLOAT_EQ((expected).y(), (actual).y()); \ | 19 EXPECT_FLOAT_EQ((expected).y(), (actual).y()); \ |
| 20 EXPECT_FLOAT_EQ((expected).width(), (actual).width()); \ | 20 EXPECT_FLOAT_EQ((expected).width(), (actual).width()); \ |
| 21 EXPECT_FLOAT_EQ((expected).height(), (actual).height()); \ | 21 EXPECT_FLOAT_EQ((expected).height(), (actual).height()); \ |
| 22 } while (false) | 22 } while (false) |
| 23 | 23 |
| 24 #define EXPECT_RECT_EQ(expected, actual) \ |
| 25 do { \ |
| 26 const gfx::Rect& actualRect = actual; \ |
| 27 EXPECT_EQ(expected.x(), actualRect.x()); \ |
| 28 EXPECT_EQ(expected.y(), actualRect.y()); \ |
| 29 EXPECT_EQ(expected.width(), actualRect.width()); \ |
| 30 EXPECT_EQ(expected.height(), actualRect.height()); \ |
| 31 } while (false) |
| 32 |
| 24 #define EXPECT_RECT_NEAR(expected, actual, abs_error) \ | 33 #define EXPECT_RECT_NEAR(expected, actual, abs_error) \ |
| 25 do { \ | 34 do { \ |
| 26 EXPECT_NEAR((expected).x(), (actual).x(), (abs_error)); \ | 35 EXPECT_NEAR((expected).x(), (actual).x(), (abs_error)); \ |
| 27 EXPECT_NEAR((expected).y(), (actual).y(), (abs_error)); \ | 36 EXPECT_NEAR((expected).y(), (actual).y(), (abs_error)); \ |
| 28 EXPECT_NEAR((expected).width(), (actual).width(), (abs_error)); \ | 37 EXPECT_NEAR((expected).width(), (actual).width(), (abs_error)); \ |
| 29 EXPECT_NEAR((expected).height(), (actual).height(), (abs_error)); \ | 38 EXPECT_NEAR((expected).height(), (actual).height(), (abs_error)); \ |
| 30 } while (false) | 39 } while (false) |
| 31 | 40 |
| 32 #define EXPECT_POINT3F_EQ(expected, actual) \ | 41 #define EXPECT_POINT3F_EQ(expected, actual) \ |
| 33 do { \ | 42 do { \ |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 ExpectTransformationMatrixEq(expected, actual); \ | 96 ExpectTransformationMatrixEq(expected, actual); \ |
| 88 } while (false) | 97 } while (false) |
| 89 | 98 |
| 90 // Should be used in test code only, for convenience. Production code should use | 99 // Should be used in test code only, for convenience. Production code should use |
| 91 // the gfx::Transform::GetInverse() API. | 100 // the gfx::Transform::GetInverse() API. |
| 92 gfx::Transform Inverse(const gfx::Transform& transform); | 101 gfx::Transform Inverse(const gfx::Transform& transform); |
| 93 | 102 |
| 94 } // namespace cc | 103 } // namespace cc |
| 95 | 104 |
| 96 #endif // CC_TEST_GEOMETRY_TEST_UTILS_H_ | 105 #endif // CC_TEST_GEOMETRY_TEST_UTILS_H_ |
| OLD | NEW |