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