add a use_alsa gyp setting
[chromium-blink-merge.git] / cc / test / geometry_test_utils.h
blob2c147df750bb31e2309413ab260d17d8c65427d5
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
3 // found in the LICENSE file.
5 #ifndef CC_TEST_GEOMETRY_TEST_UTILS_H_
6 #define CC_TEST_GEOMETRY_TEST_UTILS_H_
8 namespace gfx {
9 class Transform;
12 namespace cc {
14 // These are macros instead of functions so that we get useful line numbers where a test failed.
15 #define EXPECT_FLOAT_RECT_EQ(expected, actual) \
16 do { \
17 EXPECT_FLOAT_EQ((expected).x(), (actual).x()); \
18 EXPECT_FLOAT_EQ((expected).y(), (actual).y()); \
19 EXPECT_FLOAT_EQ((expected).width(), (actual).width()); \
20 EXPECT_FLOAT_EQ((expected).height(), (actual).height()); \
21 } while (false)
23 #define EXPECT_RECT_EQ(expected, actual) \
24 do { \
25 EXPECT_EQ((expected).x(), (actual).x()); \
26 EXPECT_EQ((expected).y(), (actual).y()); \
27 EXPECT_EQ((expected).width(), (actual).width()); \
28 EXPECT_EQ((expected).height(), (actual).height()); \
29 } while (false)
31 #define EXPECT_SIZE_EQ(expected, actual) \
32 do { \
33 EXPECT_EQ((expected).width(), (actual).width()); \
34 EXPECT_EQ((expected).height(), (actual).height()); \
35 } while (false)
37 #define EXPECT_POINT_EQ(expected, actual) \
38 do { \
39 EXPECT_EQ((expected).x(), (actual).x()); \
40 EXPECT_EQ((expected).y(), (actual).y()); \
41 } while (false)
43 #define EXPECT_POINT3F_EQ(expected, actual) \
44 do { \
45 EXPECT_FLOAT_EQ((expected).x(), (actual).x()); \
46 EXPECT_FLOAT_EQ((expected).y(), (actual).y()); \
47 EXPECT_FLOAT_EQ((expected).z(), (actual).z()); \
48 } while (false)
50 #define EXPECT_VECTOR_EQ(expected, actual) \
51 do { \
52 EXPECT_EQ((expected).x(), (actual).x()); \
53 EXPECT_EQ((expected).y(), (actual).y()); \
54 } while (false)
56 #define EXPECT_FLOAT_ARRAY_EQ(expected, actual, count) \
57 do { \
58 for (int i = 0; i < count; i++) {\
59 EXPECT_FLOAT_EQ((expected)[i], (actual)[i]); \
61 } while (false)
63 // This is a function rather than a macro because when this is included as a macro
64 // in bulk, it causes a significant slow-down in compilation time. This problem
65 // exists with both gcc and clang, and bugs have been filed at
66 // http://llvm.org/bugs/show_bug.cgi?id=13651 and http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54337
67 void ExpectTransformationMatrixEq(const gfx::Transform& expected,
68 const gfx::Transform& actual);
70 #define EXPECT_TRANSFORMATION_MATRIX_EQ(expected, actual) \
71 { \
72 SCOPED_TRACE(""); \
73 cc::ExpectTransformationMatrixEq(expected, actual); \
76 // Should be used in test code only, for convenience. Production code should use
77 // the gfx::Transform::GetInverse() API.
78 gfx::Transform inverse(const gfx::Transform& transform);
80 } // namespace cc
82 #endif // CC_TEST_GEOMETRY_TEST_UTILS_H_