| 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 CCGeometryTestUtils_h | 5 #ifndef CCGeometryTestUtils_h |
| 6 #define CCGeometryTestUtils_h | 6 #define CCGeometryTestUtils_h |
| 7 | 7 |
| 8 #include "FloatRect.h" |
| 9 #include "IntRect.h" |
| 10 |
| 8 namespace WebKit { | 11 namespace WebKit { |
| 9 class WebTransformationMatrix; | 12 class WebTransformationMatrix; |
| 10 } | 13 } |
| 11 | 14 |
| 12 namespace WebKitTests { | 15 namespace WebKitTests { |
| 13 | 16 |
| 14 // These are macros instead of functions so that we get useful line numbers wher
e a test failed. | 17 // These are macros instead of functions so that we get useful line numbers wher
e a test failed. |
| 15 #define EXPECT_FLOAT_RECT_EQ(expected, actual) \ | 18 #define EXPECT_FLOAT_RECT_EQ(expected, actual) \ |
| 16 EXPECT_FLOAT_EQ((expected).location().x(), (actual).location().x()); \ | 19 EXPECT_FLOAT_EQ(static_cast<FloatRect>(expected).location().x(), static_cast
<FloatRect>(actual).location().x()); \ |
| 17 EXPECT_FLOAT_EQ((expected).location().y(), (actual).location().y()); \ | 20 EXPECT_FLOAT_EQ(static_cast<FloatRect>(expected).location().y(), static_cast
<FloatRect>(actual).location().y()); \ |
| 18 EXPECT_FLOAT_EQ((expected).size().width(), (actual).size().width()); \ | 21 EXPECT_FLOAT_EQ(static_cast<FloatRect>(expected).size().width(), static_cast
<FloatRect>(actual).size().width()); \ |
| 19 EXPECT_FLOAT_EQ((expected).size().height(), (actual).size().height()) | 22 EXPECT_FLOAT_EQ(static_cast<FloatRect>(expected).size().height(), static_cas
t<FloatRect>(actual).size().height()) |
| 20 | 23 |
| 21 #define EXPECT_RECT_EQ(expected, actual) \ | 24 #define EXPECT_RECT_EQ(expected, actual) \ |
| 22 EXPECT_EQ((expected).location().x(), (actual).location().x()); \ | 25 EXPECT_EQ(static_cast<IntRect>(expected).location().x(), static_cast<IntRect
>(actual).location().x()); \ |
| 23 EXPECT_EQ((expected).location().y(), (actual).location().y()); \ | 26 EXPECT_EQ(static_cast<IntRect>(expected).location().y(), static_cast<IntRect
>(actual).location().y()); \ |
| 24 EXPECT_EQ((expected).size().width(), (actual).size().width()); \ | 27 EXPECT_EQ(static_cast<IntRect>(expected).size().width(), static_cast<IntRect
>(actual).size().width()); \ |
| 25 EXPECT_EQ((expected).size().height(), (actual).size().height()) | 28 EXPECT_EQ(static_cast<IntRect>(expected).size().height(), static_cast<IntRec
t>(actual).size().height()) |
| 26 | 29 |
| 27 // This is a function rather than a macro because when this is included as a mac
ro | 30 // This is a function rather than a macro because when this is included as a mac
ro |
| 28 // in bulk, it causes a significant slow-down in compilation time. This problem | 31 // in bulk, it causes a significant slow-down in compilation time. This problem |
| 29 // exists with both gcc and clang, and bugs have been filed at | 32 // exists with both gcc and clang, and bugs have been filed at |
| 30 // http://llvm.org/bugs/show_bug.cgi?id=13651 and http://gcc.gnu.org/bugzilla/sh
ow_bug.cgi?id=54337 | 33 // http://llvm.org/bugs/show_bug.cgi?id=13651 and http://gcc.gnu.org/bugzilla/sh
ow_bug.cgi?id=54337 |
| 31 void ExpectTransformationMatrixEq(const WebKit::WebTransformationMatrix& expecte
d, | 34 void ExpectTransformationMatrixEq(const WebKit::WebTransformationMatrix& expecte
d, |
| 32 const WebKit::WebTransformationMatrix& actual)
; | 35 const WebKit::WebTransformationMatrix& actual)
; |
| 33 | 36 |
| 34 #define EXPECT_TRANSFORMATION_MATRIX_EQ(expected, actual) \ | 37 #define EXPECT_TRANSFORMATION_MATRIX_EQ(expected, actual) \ |
| 35 { \ | 38 { \ |
| 36 SCOPED_TRACE(""); \ | 39 SCOPED_TRACE(""); \ |
| 37 WebKitTests::ExpectTransformationMatrixEq(expected, actual); \ | 40 WebKitTests::ExpectTransformationMatrixEq(expected, actual); \ |
| 38 } | 41 } |
| 39 | 42 |
| 40 } // namespace WebKitTests | 43 } // namespace WebKitTests |
| 41 | 44 |
| 42 #endif // CCGeometryTestUtils_h | 45 #endif // CCGeometryTestUtils_h |
| OLD | NEW |