Commit 57f6035f authored by Zhuoyu Qian's avatar Zhuoyu Qian Committed by Commit Bot

Rename GeometryTest namepsace to geometry_test

https://google.github.io/styleguide/cppguide.html#Namespace_Names
> Namespace names are all lower-case.

This CL has no behavior changes.

Bug: 889726
Change-Id: If8167502426867a143dc15200809b21b08dfb520
Reviewed-on: https://chromium-review.googlesource.com/c/1293293Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Commit-Queue: Zhuoyu Qian <zhuoyu.qian@samsung.com>
Cr-Commit-Position: refs/heads/master@{#601494}
parent 9e324215
...@@ -33,7 +33,7 @@ namespace blink { ...@@ -33,7 +33,7 @@ namespace blink {
namespace FloatBoxTest { namespace FloatBoxTest {
bool ApproximatelyEqual(const float& a, const float& b) { bool ApproximatelyEqual(const float& a, const float& b) {
return GeometryTest::ApproximatelyEqual(a, b, kTestEpsilon); return geometry_test::ApproximatelyEqual(a, b, kTestEpsilon);
} }
bool ApproximatelyEqual(const FloatBox& a, const FloatBox& b) { bool ApproximatelyEqual(const FloatBox& a, const FloatBox& b) {
......
...@@ -12,19 +12,19 @@ namespace blink { ...@@ -12,19 +12,19 @@ namespace blink {
TEST(FloatPointTest, LengthTest) { TEST(FloatPointTest, LengthTest) {
// Sanity check the Pythagorean triples 3-4-5 and 5-12-13 // Sanity check the Pythagorean triples 3-4-5 and 5-12-13
FloatPoint p1 = FloatPoint(3.f, 4.f); FloatPoint p1 = FloatPoint(3.f, 4.f);
EXPECT_PRED_FORMAT2(GeometryTest::AssertAlmostEqual, p1.length(), 5.f); EXPECT_PRED_FORMAT2(geometry_test::AssertAlmostEqual, p1.length(), 5.f);
FloatPoint p2 = FloatPoint(5.f, 12.f); FloatPoint p2 = FloatPoint(5.f, 12.f);
EXPECT_PRED_FORMAT2(GeometryTest::AssertAlmostEqual, p2.length(), 13.f); EXPECT_PRED_FORMAT2(geometry_test::AssertAlmostEqual, p2.length(), 13.f);
// Test very small numbers. This fails under the old implementation of // Test very small numbers. This fails under the old implementation of
// FloatPoint::length(): `return sqrtf(lengthSquared());' // FloatPoint::length(): `return sqrtf(lengthSquared());'
FloatPoint p3 = FloatPoint(.5e-20f, .5e-20f); FloatPoint p3 = FloatPoint(.5e-20f, .5e-20f);
EXPECT_PRED_FORMAT2(GeometryTest::AssertAlmostEqual, p3.length(), EXPECT_PRED_FORMAT2(geometry_test::AssertAlmostEqual, p3.length(),
.707106781186548e-20f); .707106781186548e-20f);
// Test very large numbers. // Test very large numbers.
FloatPoint p4 = FloatPoint(.5e20f, .5e20f); FloatPoint p4 = FloatPoint(.5e20f, .5e20f);
EXPECT_PRED_FORMAT2(GeometryTest::AssertAlmostEqual, p4.length(), EXPECT_PRED_FORMAT2(geometry_test::AssertAlmostEqual, p4.length(),
.707106781186548e20f); .707106781186548e20f);
} }
......
...@@ -31,107 +31,107 @@ TEST(FloatRectTest, SquaredDistanceToTest) { ...@@ -31,107 +31,107 @@ TEST(FloatRectTest, SquaredDistanceToTest) {
// `1` case // `1` case
FloatPoint p1(80, 80); FloatPoint p1(80, 80);
EXPECT_PRED_FORMAT2(GeometryTest::AssertAlmostEqual, r1.SquaredDistanceTo(p1), EXPECT_PRED_FORMAT2(geometry_test::AssertAlmostEqual,
800.f); r1.SquaredDistanceTo(p1), 800.f);
FloatPoint p2(-10, -10); FloatPoint p2(-10, -10);
EXPECT_PRED_FORMAT2(GeometryTest::AssertAlmostEqual, r1.SquaredDistanceTo(p2), EXPECT_PRED_FORMAT2(geometry_test::AssertAlmostEqual,
24200.f); r1.SquaredDistanceTo(p2), 24200.f);
FloatPoint p3(80, -10); FloatPoint p3(80, -10);
EXPECT_PRED_FORMAT2(GeometryTest::AssertAlmostEqual, r1.SquaredDistanceTo(p3), EXPECT_PRED_FORMAT2(geometry_test::AssertAlmostEqual,
12500.f); r1.SquaredDistanceTo(p3), 12500.f);
// `2` case // `2` case
FloatPoint p4(110, 80); FloatPoint p4(110, 80);
EXPECT_PRED_FORMAT2(GeometryTest::AssertAlmostEqual, r1.SquaredDistanceTo(p4), EXPECT_PRED_FORMAT2(geometry_test::AssertAlmostEqual,
400.f); r1.SquaredDistanceTo(p4), 400.f);
FloatPoint p5(150, 0); FloatPoint p5(150, 0);
EXPECT_PRED_FORMAT2(GeometryTest::AssertAlmostEqual, r1.SquaredDistanceTo(p5), EXPECT_PRED_FORMAT2(geometry_test::AssertAlmostEqual,
10000.f); r1.SquaredDistanceTo(p5), 10000.f);
FloatPoint p6(180, -10); FloatPoint p6(180, -10);
EXPECT_PRED_FORMAT2(GeometryTest::AssertAlmostEqual, r1.SquaredDistanceTo(p6), EXPECT_PRED_FORMAT2(geometry_test::AssertAlmostEqual,
12100.f); r1.SquaredDistanceTo(p6), 12100.f);
// `3` case // `3` case
FloatPoint p7(400, 80); FloatPoint p7(400, 80);
EXPECT_PRED_FORMAT2(GeometryTest::AssertAlmostEqual, r1.SquaredDistanceTo(p7), EXPECT_PRED_FORMAT2(geometry_test::AssertAlmostEqual,
2900.f); r1.SquaredDistanceTo(p7), 2900.f);
FloatPoint p8(360, -10); FloatPoint p8(360, -10);
EXPECT_PRED_FORMAT2(GeometryTest::AssertAlmostEqual, r1.SquaredDistanceTo(p8), EXPECT_PRED_FORMAT2(geometry_test::AssertAlmostEqual,
12200.f); r1.SquaredDistanceTo(p8), 12200.f);
// `4` case // `4` case
FloatPoint p9(80, 110); FloatPoint p9(80, 110);
EXPECT_PRED_FORMAT2(GeometryTest::AssertAlmostEqual, r1.SquaredDistanceTo(p9), EXPECT_PRED_FORMAT2(geometry_test::AssertAlmostEqual,
400.f); r1.SquaredDistanceTo(p9), 400.f);
FloatPoint p10(-10, 180); FloatPoint p10(-10, 180);
EXPECT_PRED_FORMAT2(GeometryTest::AssertAlmostEqual, EXPECT_PRED_FORMAT2(geometry_test::AssertAlmostEqual,
r1.SquaredDistanceTo(p10), 12100.f); r1.SquaredDistanceTo(p10), 12100.f);
// `5`(& In) case // `5`(& In) case
FloatPoint p11(100, 100); FloatPoint p11(100, 100);
EXPECT_PRED_FORMAT2(GeometryTest::AssertAlmostEqual, EXPECT_PRED_FORMAT2(geometry_test::AssertAlmostEqual,
r1.SquaredDistanceTo(p11), 0.f); r1.SquaredDistanceTo(p11), 0.f);
FloatPoint p12(150, 100); FloatPoint p12(150, 100);
EXPECT_PRED_FORMAT2(GeometryTest::AssertAlmostEqual, EXPECT_PRED_FORMAT2(geometry_test::AssertAlmostEqual,
r1.SquaredDistanceTo(p12), 0.f); r1.SquaredDistanceTo(p12), 0.f);
FloatPoint p13(350, 100); FloatPoint p13(350, 100);
EXPECT_PRED_FORMAT2(GeometryTest::AssertAlmostEqual, EXPECT_PRED_FORMAT2(geometry_test::AssertAlmostEqual,
r1.SquaredDistanceTo(p13), 0.f); r1.SquaredDistanceTo(p13), 0.f);
FloatPoint p14(350, 150); FloatPoint p14(350, 150);
EXPECT_PRED_FORMAT2(GeometryTest::AssertAlmostEqual, EXPECT_PRED_FORMAT2(geometry_test::AssertAlmostEqual,
r1.SquaredDistanceTo(p14), 0.f); r1.SquaredDistanceTo(p14), 0.f);
FloatPoint p15(350, 250); FloatPoint p15(350, 250);
EXPECT_PRED_FORMAT2(GeometryTest::AssertAlmostEqual, EXPECT_PRED_FORMAT2(geometry_test::AssertAlmostEqual,
r1.SquaredDistanceTo(p15), 0.f); r1.SquaredDistanceTo(p15), 0.f);
FloatPoint p16(150, 250); FloatPoint p16(150, 250);
EXPECT_PRED_FORMAT2(GeometryTest::AssertAlmostEqual, EXPECT_PRED_FORMAT2(geometry_test::AssertAlmostEqual,
r1.SquaredDistanceTo(p16), 0.f); r1.SquaredDistanceTo(p16), 0.f);
FloatPoint p17(100, 250); FloatPoint p17(100, 250);
EXPECT_PRED_FORMAT2(GeometryTest::AssertAlmostEqual, EXPECT_PRED_FORMAT2(geometry_test::AssertAlmostEqual,
r1.SquaredDistanceTo(p17), 0.f); r1.SquaredDistanceTo(p17), 0.f);
FloatPoint p18(100, 150); FloatPoint p18(100, 150);
EXPECT_PRED_FORMAT2(GeometryTest::AssertAlmostEqual, EXPECT_PRED_FORMAT2(geometry_test::AssertAlmostEqual,
r1.SquaredDistanceTo(p18), 0.f); r1.SquaredDistanceTo(p18), 0.f);
FloatPoint p19(150, 150); FloatPoint p19(150, 150);
EXPECT_PRED_FORMAT2(GeometryTest::AssertAlmostEqual, EXPECT_PRED_FORMAT2(geometry_test::AssertAlmostEqual,
r1.SquaredDistanceTo(p19), 0.f); r1.SquaredDistanceTo(p19), 0.f);
// `6` case // `6` case
FloatPoint p20(380, 150); FloatPoint p20(380, 150);
EXPECT_PRED_FORMAT2(GeometryTest::AssertAlmostEqual, EXPECT_PRED_FORMAT2(geometry_test::AssertAlmostEqual,
r1.SquaredDistanceTo(p20), 900.f); r1.SquaredDistanceTo(p20), 900.f);
// `7` case // `7` case
FloatPoint p21(80, 280); FloatPoint p21(80, 280);
EXPECT_PRED_FORMAT2(GeometryTest::AssertAlmostEqual, EXPECT_PRED_FORMAT2(geometry_test::AssertAlmostEqual,
r1.SquaredDistanceTo(p21), 1300.f); r1.SquaredDistanceTo(p21), 1300.f);
FloatPoint p22(-10, 300); FloatPoint p22(-10, 300);
EXPECT_PRED_FORMAT2(GeometryTest::AssertAlmostEqual, EXPECT_PRED_FORMAT2(geometry_test::AssertAlmostEqual,
r1.SquaredDistanceTo(p22), 14600.f); r1.SquaredDistanceTo(p22), 14600.f);
// `8` case // `8` case
FloatPoint p23(180, 300); FloatPoint p23(180, 300);
EXPECT_PRED_FORMAT2(GeometryTest::AssertAlmostEqual, EXPECT_PRED_FORMAT2(geometry_test::AssertAlmostEqual,
r1.SquaredDistanceTo(p23), 2500.f); r1.SquaredDistanceTo(p23), 2500.f);
// `9` case // `9` case
FloatPoint p24(450, 450); FloatPoint p24(450, 450);
EXPECT_PRED_FORMAT2(GeometryTest::AssertAlmostEqual, EXPECT_PRED_FORMAT2(geometry_test::AssertAlmostEqual,
r1.SquaredDistanceTo(p24), 50000.f); r1.SquaredDistanceTo(p24), 50000.f);
} }
......
...@@ -12,20 +12,20 @@ namespace blink { ...@@ -12,20 +12,20 @@ namespace blink {
TEST(FloatSizeTest, DiagonalLengthTest) { TEST(FloatSizeTest, DiagonalLengthTest) {
// Sanity check the Pythagorean triples 3-4-5 and 5-12-13 // Sanity check the Pythagorean triples 3-4-5 and 5-12-13
FloatSize s1 = FloatSize(3.f, 4.f); FloatSize s1 = FloatSize(3.f, 4.f);
EXPECT_PRED_FORMAT2(GeometryTest::AssertAlmostEqual, s1.DiagonalLength(), EXPECT_PRED_FORMAT2(geometry_test::AssertAlmostEqual, s1.DiagonalLength(),
5.f); 5.f);
FloatSize s2 = FloatSize(5.f, 12.f); FloatSize s2 = FloatSize(5.f, 12.f);
EXPECT_PRED_FORMAT2(GeometryTest::AssertAlmostEqual, s2.DiagonalLength(), EXPECT_PRED_FORMAT2(geometry_test::AssertAlmostEqual, s2.DiagonalLength(),
13.f); 13.f);
// Test very small numbers. // Test very small numbers.
FloatSize s3 = FloatSize(.5e-20f, .5e-20f); FloatSize s3 = FloatSize(.5e-20f, .5e-20f);
EXPECT_PRED_FORMAT2(GeometryTest::AssertAlmostEqual, s3.DiagonalLength(), EXPECT_PRED_FORMAT2(geometry_test::AssertAlmostEqual, s3.DiagonalLength(),
.707106781186548e-20f); .707106781186548e-20f);
// Test very large numbers. // Test very large numbers.
FloatSize s4 = FloatSize(.5e20f, .5e20f); FloatSize s4 = FloatSize(.5e20f, .5e20f);
EXPECT_PRED_FORMAT2(GeometryTest::AssertAlmostEqual, s4.DiagonalLength(), EXPECT_PRED_FORMAT2(geometry_test::AssertAlmostEqual, s4.DiagonalLength(),
.707106781186548e20f); .707106781186548e20f);
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include <math.h> #include <math.h>
namespace blink { namespace blink {
namespace GeometryTest { namespace geometry_test {
bool ApproximatelyEqual(float a, float b, float test_epsilon) { bool ApproximatelyEqual(float a, float b, float test_epsilon) {
float abs_a = ::fabs(a); float abs_a = ::fabs(a);
...@@ -39,5 +39,5 @@ testing::AssertionResult AssertAlmostEqual(const char* actual_expr, ...@@ -39,5 +39,5 @@ testing::AssertionResult AssertAlmostEqual(const char* actual_expr,
return testing::AssertionSuccess(); return testing::AssertionSuccess();
} }
} // namespace GeometryTest } // namespace geometry_test
} // namespace blink } // namespace blink
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
namespace blink { namespace blink {
namespace GeometryTest { namespace geometry_test {
bool ApproximatelyEqual(float, float, float test_epsilon); bool ApproximatelyEqual(float, float, float test_epsilon);
testing::AssertionResult AssertAlmostEqual(const char* actual_expr, testing::AssertionResult AssertAlmostEqual(const char* actual_expr,
...@@ -17,7 +17,7 @@ testing::AssertionResult AssertAlmostEqual(const char* actual_expr, ...@@ -17,7 +17,7 @@ testing::AssertionResult AssertAlmostEqual(const char* actual_expr,
float expected, float expected,
float test_epsilon = 1e-6); float test_epsilon = 1e-6);
} // namespace GeometryTest } // namespace geometry_test
} // namespace blink } // namespace blink
#endif #endif
...@@ -53,16 +53,16 @@ class GeometryMapperTest : public testing::Test, ...@@ -53,16 +53,16 @@ class GeometryMapperTest : public testing::Test,
INSTANTIATE_PAINT_TEST_CASE_P(GeometryMapperTest); INSTANTIATE_PAINT_TEST_CASE_P(GeometryMapperTest);
#define EXPECT_FLOAT_RECT_NEAR(expected, actual) \ #define EXPECT_FLOAT_RECT_NEAR(expected, actual) \
do { \ do { \
EXPECT_PRED_FORMAT2(GeometryTest::AssertAlmostEqual, (actual).X(), \ EXPECT_PRED_FORMAT2(geometry_test::AssertAlmostEqual, (actual).X(), \
(expected).X()); \ (expected).X()); \
EXPECT_PRED_FORMAT2(GeometryTest::AssertAlmostEqual, (actual).Y(), \ EXPECT_PRED_FORMAT2(geometry_test::AssertAlmostEqual, (actual).Y(), \
(expected).Y()); \ (expected).Y()); \
EXPECT_PRED_FORMAT2(GeometryTest::AssertAlmostEqual, (actual).Width(), \ EXPECT_PRED_FORMAT2(geometry_test::AssertAlmostEqual, (actual).Width(), \
(expected).Width()); \ (expected).Width()); \
EXPECT_PRED_FORMAT2(GeometryTest::AssertAlmostEqual, (actual).Height(), \ EXPECT_PRED_FORMAT2(geometry_test::AssertAlmostEqual, (actual).Height(), \
(expected).Height()); \ (expected).Height()); \
} while (false) } while (false)
#define EXPECT_CLIP_RECT_EQ(expected, actual) \ #define EXPECT_CLIP_RECT_EQ(expected, actual) \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment