| 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 } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 EXPECT_FLOAT_EQ((expected)[i], (actual)[i]); \ | 60 EXPECT_FLOAT_EQ((expected)[i], (actual)[i]); \ |
| 61 } \ | 61 } \ |
| 62 } while (false) | 62 } while (false) |
| 63 | 63 |
| 64 #define EXPECT_FLOAT_SIZE_EQ(expected, actual) \ | 64 #define EXPECT_FLOAT_SIZE_EQ(expected, actual) \ |
| 65 do { \ | 65 do { \ |
| 66 EXPECT_FLOAT_EQ((expected).width(), (actual).width()); \ | 66 EXPECT_FLOAT_EQ((expected).width(), (actual).width()); \ |
| 67 EXPECT_FLOAT_EQ((expected).height(), (actual).height()); \ | 67 EXPECT_FLOAT_EQ((expected).height(), (actual).height()); \ |
| 68 } while (false) | 68 } while (false) |
| 69 | 69 |
| 70 #define EXPECT_SIZE_EQ(expected, actual) \ | |
| 71 do { \ | |
| 72 EXPECT_EQ((expected).width(), (actual).width()); \ | |
| 73 EXPECT_EQ((expected).height(), (actual).height()); \ | |
| 74 } while (false) | |
| 75 | |
| 76 // This is a function rather than a macro because when this is included as a | 70 // This is a function rather than a macro because when this is included as a |
| 77 // macro in bulk, it causes a significant slow-down in compilation time. This | 71 // macro in bulk, it causes a significant slow-down in compilation time. This |
| 78 // problem exists with both gcc and clang, and bugs have been filed at | 72 // problem exists with both gcc and clang, and bugs have been filed at |
| 79 // http://llvm.org/bugs/show_bug.cgi?id=13651 | 73 // http://llvm.org/bugs/show_bug.cgi?id=13651 |
| 80 // and http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54337 | 74 // and http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54337 |
| 81 void ExpectTransformationMatrixEq(const gfx::Transform& expected, | 75 void ExpectTransformationMatrixEq(const gfx::Transform& expected, |
| 82 const gfx::Transform& actual); | 76 const gfx::Transform& actual); |
| 83 | 77 |
| 84 #define EXPECT_TRANSFORMATION_MATRIX_EQ(expected, actual) \ | 78 #define EXPECT_TRANSFORMATION_MATRIX_EQ(expected, actual) \ |
| 85 do { \ | 79 do { \ |
| 86 SCOPED_TRACE(""); \ | 80 SCOPED_TRACE(""); \ |
| 87 ExpectTransformationMatrixEq(expected, actual); \ | 81 ExpectTransformationMatrixEq(expected, actual); \ |
| 88 } while (false) | 82 } while (false) |
| 89 | 83 |
| 90 // Should be used in test code only, for convenience. Production code should use | 84 // Should be used in test code only, for convenience. Production code should use |
| 91 // the gfx::Transform::GetInverse() API. | 85 // the gfx::Transform::GetInverse() API. |
| 92 gfx::Transform Inverse(const gfx::Transform& transform); | 86 gfx::Transform Inverse(const gfx::Transform& transform); |
| 93 | 87 |
| 94 } // namespace cc | 88 } // namespace cc |
| 95 | 89 |
| 96 #endif // CC_TEST_GEOMETRY_TEST_UTILS_H_ | 90 #endif // CC_TEST_GEOMETRY_TEST_UTILS_H_ |
| OLD | NEW |