| 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 WebKit { | |
| 13 class WebTransformationMatrix; | |
| 14 } | |
| 15 | |
| 16 namespace cc { | 12 namespace cc { |
| 17 | 13 |
| 18 // These are macros instead of functions so that we get useful line numbers wher
e a test failed. | 14 // These are macros instead of functions so that we get useful line numbers wher
e a test failed. |
| 19 #define EXPECT_FLOAT_RECT_EQ(expected, actual) \ | 15 #define EXPECT_FLOAT_RECT_EQ(expected, actual) \ |
| 20 do { \ | 16 do { \ |
| 21 EXPECT_FLOAT_EQ((expected).x(), (actual).x()); \ | 17 EXPECT_FLOAT_EQ((expected).x(), (actual).x()); \ |
| 22 EXPECT_FLOAT_EQ((expected).y(), (actual).y()); \ | 18 EXPECT_FLOAT_EQ((expected).y(), (actual).y()); \ |
| 23 EXPECT_FLOAT_EQ((expected).width(), (actual).width()); \ | 19 EXPECT_FLOAT_EQ((expected).width(), (actual).width()); \ |
| 24 EXPECT_FLOAT_EQ((expected).height(), (actual).height()); \ | 20 EXPECT_FLOAT_EQ((expected).height(), (actual).height()); \ |
| 25 } while (false) | 21 } while (false) |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 }\ | 53 }\ |
| 58 } while (false) | 54 } while (false) |
| 59 | 55 |
| 60 // This is a function rather than a macro because when this is included as a mac
ro | 56 // This is a function rather than a macro because when this is included as a mac
ro |
| 61 // in bulk, it causes a significant slow-down in compilation time. This problem | 57 // in bulk, it causes a significant slow-down in compilation time. This problem |
| 62 // exists with both gcc and clang, and bugs have been filed at | 58 // exists with both gcc and clang, and bugs have been filed at |
| 63 // http://llvm.org/bugs/show_bug.cgi?id=13651 and http://gcc.gnu.org/bugzilla/sh
ow_bug.cgi?id=54337 | 59 // http://llvm.org/bugs/show_bug.cgi?id=13651 and http://gcc.gnu.org/bugzilla/sh
ow_bug.cgi?id=54337 |
| 64 void ExpectTransformationMatrixEq(const gfx::Transform& expected, | 60 void ExpectTransformationMatrixEq(const gfx::Transform& expected, |
| 65 const gfx::Transform& actual); | 61 const gfx::Transform& actual); |
| 66 | 62 |
| 67 void ExpectTransformationMatrixEq(const WebKit::WebTransformationMatrix& expecte
d, | |
| 68 const WebKit::WebTransformationMatrix& actual)
; | |
| 69 | |
| 70 #define EXPECT_TRANSFORMATION_MATRIX_EQ(expected, actual) \ | 63 #define EXPECT_TRANSFORMATION_MATRIX_EQ(expected, actual) \ |
| 71 { \ | 64 { \ |
| 72 SCOPED_TRACE(""); \ | 65 SCOPED_TRACE(""); \ |
| 73 cc::ExpectTransformationMatrixEq(expected, actual); \ | 66 cc::ExpectTransformationMatrixEq(expected, actual); \ |
| 74 } | 67 } |
| 75 | 68 |
| 76 // Should be used in test code only, for convenience. Production code should use | 69 // Should be used in test code only, for convenience. Production code should use |
| 77 // the gfx::Transform::GetInverse() API. | 70 // the gfx::Transform::GetInverse() API. |
| 78 gfx::Transform inverse(const gfx::Transform& transform); | 71 gfx::Transform inverse(const gfx::Transform& transform); |
| 79 | 72 |
| 80 } // namespace cc | 73 } // namespace cc |
| 81 | 74 |
| 82 #endif // CC_TEST_GEOMETRY_TEST_UTILS_H_ | 75 #endif // CC_TEST_GEOMETRY_TEST_UTILS_H_ |
| OLD | NEW |