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

Unified Diff: ui/gfx/size_unittest.cc

Issue 11365160: ui: Remove gfx::Size::ClampToNonNegative, prevent negative sizes always. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add test Created 8 years, 1 month 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
« ui/gfx/size_base.h ('K') | « ui/gfx/size_base.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/size_unittest.cc
diff --git a/ui/gfx/size_unittest.cc b/ui/gfx/size_unittest.cc
index d647f4c0957b6acb50bf75cd83fdae342ab76315..5523b755370280956f45b9f8a3dcef41f2be0681 100644
--- a/ui/gfx/size_unittest.cc
+++ b/ui/gfx/size_unittest.cc
@@ -91,4 +91,16 @@ TEST(SizeTest, ToRoundedSize) {
EXPECT_EQ(Size(-11, -11), ToRoundedSize(SizeF(-10.9999f, -10.9999f)));
}
+TEST(SizeTest, ClampToZero) {
+ EXPECT_EQ(Size().ToString(), Size(-1, -1).ToString());
+ EXPECT_EQ(Size().ToString(), Size(0, -1).ToString());
+ EXPECT_EQ(Size().ToString(), Size(-1, 0).ToString());
+
+ EXPECT_EQ(SizeF().ToString(), SizeF(-1, -1).ToString());
+ EXPECT_EQ(SizeF().ToString(), SizeF(0, -1).ToString());
+ EXPECT_EQ(SizeF().ToString(), SizeF(-1, 0).ToString());
+
+ EXPECT_EQ(SizeF().ToString(), SizeF(1, 1).Scale(-1).ToString());
+}
+
} // namespace gfx
« ui/gfx/size_base.h ('K') | « ui/gfx/size_base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698