OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 12 matching lines...) Expand all Loading... |
23 */ | 23 */ |
24 | 24 |
25 #include "config.h" | 25 #include "config.h" |
26 #include "platform/geometry/FloatBoxTestHelpers.h" | 26 #include "platform/geometry/FloatBoxTestHelpers.h" |
27 #include "platform/geometry/GeometryTestHelpers.h" | 27 #include "platform/geometry/GeometryTestHelpers.h" |
28 | 28 |
29 #include "platform/geometry/FloatBox.h" | 29 #include "platform/geometry/FloatBox.h" |
30 const static float kTestEpsilon = 1e-6; | 30 const static float kTestEpsilon = 1e-6; |
31 | 31 |
32 namespace blink { | 32 namespace blink { |
33 | |
34 void PrintTo(const FloatBox& box, ::std::ostream* os) | |
35 { | |
36 *os << "FloatBox(" | |
37 << box.x() << ", " | |
38 << box.y() << ", " | |
39 << box.z() << ", " | |
40 << box.width() << ", " | |
41 << box.height() << ", " | |
42 << box.depth() << ")"; | |
43 } | |
44 | |
45 namespace FloatBoxTest { | 33 namespace FloatBoxTest { |
46 | 34 |
47 bool ApproximatelyEqual(const float& a, const float& b) | 35 bool ApproximatelyEqual(const float& a, const float& b) |
48 { | 36 { |
49 return GeometryTest::ApproximatelyEqual(a, b, kTestEpsilon); | 37 return GeometryTest::ApproximatelyEqual(a, b, kTestEpsilon); |
50 } | 38 } |
51 | 39 |
52 bool ApproximatelyEqual(const FloatBox& a, const FloatBox& b) | 40 bool ApproximatelyEqual(const FloatBox& a, const FloatBox& b) |
53 { | 41 { |
54 if (!ApproximatelyEqual(a.x(), b.x()) | 42 if (!ApproximatelyEqual(a.x(), b.x()) |
(...skipping 26 matching lines...) Expand all Loading... |
81 return ::testing::AssertionFailure() << " Value of:" << n_expr <<
std::endl | 69 return ::testing::AssertionFailure() << " Value of:" << n_expr <<
std::endl |
82 << " Actual:" << testing::PrintToString(n) << std::endl | 70 << " Actual:" << testing::PrintToString(n) << std::endl |
83 << "Not Contained in:" << m_expr << std::endl | 71 << "Not Contained in:" << m_expr << std::endl |
84 << " Which is:" << ::testing::PrintToString(m); | 72 << " Which is:" << ::testing::PrintToString(m); |
85 } | 73 } |
86 return ::testing::AssertionSuccess(); | 74 return ::testing::AssertionSuccess(); |
87 } | 75 } |
88 | 76 |
89 } // namespace FloatBoxTest | 77 } // namespace FloatBoxTest |
90 } // namespace blink | 78 } // namespace blink |
OLD | NEW |