Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Side by Side Diff: Source/platform/geometry/FloatBoxTestHelpers.cpp

Issue 1110913002: Removing blink::prefix (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 11 matching lines...) Expand all
22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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 void blink::PrintTo(const FloatBox& box, ::std::ostream* os) 32 namespace blink {
33
34 void PrintTo(const FloatBox& box, ::std::ostream* os)
33 { 35 {
34 *os << "FloatBox(" 36 *os << "FloatBox("
35 << box.x() << ", " 37 << box.x() << ", "
36 << box.y() << ", " 38 << box.y() << ", "
37 << box.z() << ", " 39 << box.z() << ", "
38 << box.width() << ", " 40 << box.width() << ", "
39 << box.height() << ", " 41 << box.height() << ", "
40 << box.depth() << ")"; 42 << box.depth() << ")";
41 } 43 }
42 44
43 bool blink::FloatBoxTest::ApproximatelyEqual(const float& a, const float& b) 45 namespace FloatBoxTest {
46
47 bool ApproximatelyEqual(const float& a, const float& b)
44 { 48 {
45 return blink::GeometryTest::ApproximatelyEqual(a, b, kTestEpsilon); 49 return GeometryTest::ApproximatelyEqual(a, b, kTestEpsilon);
46 } 50 }
47 51
48 bool blink::FloatBoxTest::ApproximatelyEqual(const FloatBox& a, const FloatBox& b) 52 bool ApproximatelyEqual(const FloatBox& a, const FloatBox& b)
49 { 53 {
50 if (!ApproximatelyEqual(a.x(), b.x()) 54 if (!ApproximatelyEqual(a.x(), b.x())
51 || !ApproximatelyEqual(a.y(), b.y()) 55 || !ApproximatelyEqual(a.y(), b.y())
52 || !ApproximatelyEqual(a.z(), b.z()) 56 || !ApproximatelyEqual(a.z(), b.z())
53 || !ApproximatelyEqual(a.width(), b.width()) 57 || !ApproximatelyEqual(a.width(), b.width())
54 || !ApproximatelyEqual(a.height(), b.height()) 58 || !ApproximatelyEqual(a.height(), b.height())
55 || !ApproximatelyEqual(a.depth(), b.depth())) { 59 || !ApproximatelyEqual(a.depth(), b.depth())) {
56 return false; 60 return false;
57 } 61 }
58 return true; 62 return true;
59 } 63 }
60 64
61 ::testing::AssertionResult blink::FloatBoxTest::AssertAlmostEqual(const char* m_ expr, const char* n_expr, const FloatBox& m, const FloatBox& n) 65 ::testing::AssertionResult AssertAlmostEqual(const char* m_expr, const char* n_e xpr, const FloatBox& m, const FloatBox& n)
62 { 66 {
63 if (!ApproximatelyEqual(m, n)) { 67 if (!ApproximatelyEqual(m, n)) {
64 return ::testing::AssertionFailure() << " Value of:" << n_expr << std::endl 68 return ::testing::AssertionFailure() << " Value of:" << n_expr << std::endl
65 << " Actual:" << testing::PrintToString(n) << std::endl 69 << " Actual:" << testing::PrintToString(n) << std::endl
66 << "Expected Approx:" << m_expr << std::endl 70 << "Expected Approx:" << m_expr << std::endl
67 << " Which is:" << ::testing::PrintToString(m); 71 << " Which is:" << ::testing::PrintToString(m);
68 } 72 }
69 return ::testing::AssertionSuccess(); 73 return ::testing::AssertionSuccess();
70 } 74 }
71 75
72 ::testing::AssertionResult blink::FloatBoxTest::AssertContains(const char* m_exp r, const char* n_expr, const FloatBox& m, const FloatBox& n) 76 ::testing::AssertionResult AssertContains(const char* m_expr, const char* n_expr , const FloatBox& m, const FloatBox& n)
73 { 77 {
74 FloatBox newM = m; 78 FloatBox newM = m;
75 newM.expandTo(n); 79 newM.expandTo(n);
76 if (!ApproximatelyEqual(m, newM)) { 80 if (!ApproximatelyEqual(m, newM)) {
77 return ::testing::AssertionFailure() << " Value of:" << n_expr << std::endl 81 return ::testing::AssertionFailure() << " Value of:" << n_expr << std::endl
78 << " Actual:" << testing::PrintToString(n) << std::endl 82 << " Actual:" << testing::PrintToString(n) << std::endl
79 << "Not Contained in:" << m_expr << std::endl 83 << "Not Contained in:" << m_expr << std::endl
80 << " Which is:" << ::testing::PrintToString(m); 84 << " Which is:" << ::testing::PrintToString(m);
81 } 85 }
82 return ::testing::AssertionSuccess(); 86 return ::testing::AssertionSuccess();
83 } 87 }
84 88
85 89 } // namespace FloatBoxTest
90 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/fonts/opentype/OpenTypeSanitizer.cpp ('k') | Source/platform/geometry/GeometryTestHelpers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698