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 11 matching lines...) Expand all Loading... | |
22 } while (false) | 22 } while (false) |
23 | 23 |
24 #define EXPECT_RECT_NEAR(expected, actual, abs_error) \ | 24 #define EXPECT_RECT_NEAR(expected, actual, abs_error) \ |
25 do { \ | 25 do { \ |
26 EXPECT_NEAR((expected).x(), (actual).x(), (abs_error)); \ | 26 EXPECT_NEAR((expected).x(), (actual).x(), (abs_error)); \ |
27 EXPECT_NEAR((expected).y(), (actual).y(), (abs_error)); \ | 27 EXPECT_NEAR((expected).y(), (actual).y(), (abs_error)); \ |
28 EXPECT_NEAR((expected).width(), (actual).width(), (abs_error)); \ | 28 EXPECT_NEAR((expected).width(), (actual).width(), (abs_error)); \ |
29 EXPECT_NEAR((expected).height(), (actual).height(), (abs_error)); \ | 29 EXPECT_NEAR((expected).height(), (actual).height(), (abs_error)); \ |
30 } while (false) | 30 } while (false) |
31 | 31 |
32 #define EXPECT_RECT_EQ(expected, actual) \ | |
33 do { \ | |
34 EXPECT_EQ((expected).x(), (actual).x()); \ | |
35 EXPECT_EQ((expected).y(), (actual).y()); \ | |
36 EXPECT_EQ((expected).width(), (actual).width()); \ | |
37 EXPECT_EQ((expected).height(), (actual).height()); \ | |
38 } while (false) | |
39 | |
40 #define EXPECT_SIZE_EQ(expected, actual) \ | |
41 do { \ | |
42 EXPECT_EQ((expected).width(), (actual).width()); \ | |
43 EXPECT_EQ((expected).height(), (actual).height()); \ | |
44 } while (false) | |
45 | |
46 #define EXPECT_POINT_EQ(expected, actual) \ | |
47 do { \ | |
48 EXPECT_EQ((expected).x(), (actual).x()); \ | |
49 EXPECT_EQ((expected).y(), (actual).y()); \ | |
50 } while (false) | |
51 | |
52 #define EXPECT_POINT3F_EQ(expected, actual) \ | |
hush (inactive)
2014/12/04 20:10:18
On second thought, I need to keep EXPECT_POINT3F_E
danakj
2014/12/04 20:13:19
I think it's fine to use EXPECT_EQ, and if a test
| |
53 do { \ | |
54 EXPECT_FLOAT_EQ((expected).x(), (actual).x()); \ | |
55 EXPECT_FLOAT_EQ((expected).y(), (actual).y()); \ | |
56 EXPECT_FLOAT_EQ((expected).z(), (actual).z()); \ | |
57 } while (false) | |
58 | |
59 #define EXPECT_VECTOR_EQ(expected, actual) \ | 32 #define EXPECT_VECTOR_EQ(expected, actual) \ |
danakj
2014/12/04 19:34:29
we could do these vector things too right?
hush (inactive)
2014/12/04 20:10:18
no... Right now EXPECT_VECTOR_EQ is treating |expe
danakj
2014/12/04 20:13:19
That sounds.. a bit weird. I'm guessing some place
| |
60 do { \ | 33 do { \ |
61 EXPECT_EQ((expected).x(), (actual).x()); \ | 34 EXPECT_EQ((expected).x(), (actual).x()); \ |
62 EXPECT_EQ((expected).y(), (actual).y()); \ | 35 EXPECT_EQ((expected).y(), (actual).y()); \ |
63 } while (false) | 36 } while (false) |
64 | 37 |
65 #define EXPECT_VECTOR2DF_EQ(expected, actual) \ | 38 #define EXPECT_VECTOR2DF_EQ(expected, actual) \ |
66 do { \ | 39 do { \ |
67 EXPECT_FLOAT_EQ((expected).x(), (actual).x()); \ | 40 EXPECT_FLOAT_EQ((expected).x(), (actual).x()); \ |
68 EXPECT_FLOAT_EQ((expected).y(), (actual).y()); \ | 41 EXPECT_FLOAT_EQ((expected).y(), (actual).y()); \ |
69 } while (false) | 42 } while (false) |
(...skipping 25 matching lines...) Expand all Loading... | |
95 ExpectTransformationMatrixEq(expected, actual); \ | 68 ExpectTransformationMatrixEq(expected, actual); \ |
96 } while (false) | 69 } while (false) |
97 | 70 |
98 // Should be used in test code only, for convenience. Production code should use | 71 // Should be used in test code only, for convenience. Production code should use |
99 // the gfx::Transform::GetInverse() API. | 72 // the gfx::Transform::GetInverse() API. |
100 gfx::Transform Inverse(const gfx::Transform& transform); | 73 gfx::Transform Inverse(const gfx::Transform& transform); |
101 | 74 |
102 } // namespace cc | 75 } // namespace cc |
103 | 76 |
104 #endif // CC_TEST_GEOMETRY_TEST_UTILS_H_ | 77 #endif // CC_TEST_GEOMETRY_TEST_UTILS_H_ |
OLD | NEW |