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

Side by Side Diff: ui/gfx/geometry/rect_unittest.cc

Issue 2042073002: Centered flood fill style ink drop ripples on mouse/touch points. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Polished for review. Created 4 years, 6 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 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #include <limits> 5 #include <limits>
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 EXPECT_FLOAT_EQ( 908 EXPECT_FLOAT_EQ(
909 0.0f, f.ManhattanInternalDistance(gfx::RectF(-1.0f, 0.0f, 1.1f, 1.0f))); 909 0.0f, f.ManhattanInternalDistance(gfx::RectF(-1.0f, 0.0f, 1.1f, 1.0f)));
910 EXPECT_FLOAT_EQ( 910 EXPECT_FLOAT_EQ(
911 0.1f + kEpsilon, 911 0.1f + kEpsilon,
912 f.ManhattanInternalDistance(gfx::RectF(-1.5f, 0.0f, 1.4f, 1.0f))); 912 f.ManhattanInternalDistance(gfx::RectF(-1.5f, 0.0f, 1.4f, 1.0f)));
913 EXPECT_FLOAT_EQ( 913 EXPECT_FLOAT_EQ(
914 kEpsilon, 914 kEpsilon,
915 f.ManhattanInternalDistance(gfx::RectF(-1.5f, 0.0f, 1.5f, 1.0f))); 915 f.ManhattanInternalDistance(gfx::RectF(-1.5f, 0.0f, 1.5f, 1.0f)));
916 } 916 }
917 917
918 TEST(RectTest, MaxDistanceToCorners) {
919 const float kAbsError = 0.01f;
920 // Rect with the following corners in clockwise order starting at the origin:
921 // (10, 30), (60, 30), (10, 100), (60, 100)
922 const Rect rect(10, 30, 50, 70);
923
924 // Interior points
925 EXPECT_NEAR(78.10f, rect.MaxDistanceToCorners(gfx::Point(10, 40)), kAbsError);
926 EXPECT_NEAR(71.06f, rect.MaxDistanceToCorners(gfx::Point(55, 45)), kAbsError);
927 EXPECT_NEAR(64.03f, rect.MaxDistanceToCorners(gfx::Point(50, 80)), kAbsError);
928 EXPECT_NEAR(68.01f, rect.MaxDistanceToCorners(gfx::Point(20, 85)), kAbsError);
929
930 // Exterior points
931 EXPECT_NEAR(110.79f, rect.MaxDistanceToCorners(gfx::Point(3, 5)), kAbsError);
932 EXPECT_NEAR(108.17f, rect.MaxDistanceToCorners(gfx::Point(70, 10)),
933 kAbsError);
934 EXPECT_NEAR(103.08f, rect.MaxDistanceToCorners(gfx::Point(75, 110)),
935 kAbsError);
936 EXPECT_NEAR(101.24f, rect.MaxDistanceToCorners(gfx::Point(5, 115)),
937 kAbsError);
938 }
939
918 } // namespace gfx 940 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698