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

Unified Diff: Source/platform/geometry/FloatRoundedRectTest.cpp

Issue 1136083002: Drop assert for degenerate cases in FloatRoundedRect::radiusCenterRect() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/platform/geometry/FloatRoundedRect.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/geometry/FloatRoundedRectTest.cpp
diff --git a/Source/platform/geometry/FloatRoundedRectTest.cpp b/Source/platform/geometry/FloatRoundedRectTest.cpp
index 10e5d1b82b0df280e7cad5df780487df5f15bc30..22ae1c2ebde2236d55cb290658c1d70721ed76f3 100644
--- a/Source/platform/geometry/FloatRoundedRectTest.cpp
+++ b/Source/platform/geometry/FloatRoundedRectTest.cpp
@@ -196,5 +196,22 @@ TEST(FloatRoundedRectTest, ellipticalCorners)
EXPECT_FALSE(r.xInterceptsAtY(101, minXIntercept, maxXIntercept));
}
+TEST(FloatRoundedRectTest, radiusCenterRect)
+{
+ FloatSize cornerRect(10, 10);
+ FloatRoundedRect r0(FloatRect(0, 0, 100, 50), FloatRoundedRect::Radii(cornerRect, cornerRect, cornerRect, cornerRect));
+ EXPECT_EQ(FloatRect(10, 10, 80, 30), r0.radiusCenterRect());
+
+ // "Degenerate" cases all return an empty rectangle.
+ FloatRect collapsedRect(0, 0, 100, 50);
+ collapsedRect.expand(FloatRectOutsets(-200, -200, -200, -200));
+ FloatRoundedRect r1(collapsedRect);
+ EXPECT_TRUE(r1.radiusCenterRect().isEmpty());
+
+ FloatRoundedRect::Radii radiiWithTooLargeCorner(FloatSize(55, 55), FloatSize(), FloatSize(), FloatSize());
+ FloatRoundedRect r2(FloatRect(0, 0, 100, 50), radiiWithTooLargeCorner);
+ EXPECT_TRUE(r2.radiusCenterRect().isEmpty());
+}
+
} // namespace
« no previous file with comments | « Source/platform/geometry/FloatRoundedRect.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698