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

Unified Diff: ui/gfx/rect_unittest.cc

Issue 11270042: Add non-member non-mutating methods for common gfx::Rect operations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 2 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 | « ui/gfx/rect_f.cc ('k') | ui/gfx/screen_gtk.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/rect_unittest.cc
diff --git a/ui/gfx/rect_unittest.cc b/ui/gfx/rect_unittest.cc
index 6bdbb3bdb2323c9c2bcbeacb04277197487053fd..b83d8a466b432019e3d396d10cbc2e1b916f82a7 100644
--- a/ui/gfx/rect_unittest.cc
+++ b/ui/gfx/rect_unittest.cc
@@ -107,8 +107,7 @@ TEST(RectTest, Intersect) {
gfx::Rect r1(tests[i].x1, tests[i].y1, tests[i].w1, tests[i].h1);
gfx::Rect r2(tests[i].x2, tests[i].y2, tests[i].w2, tests[i].h2);
gfx::Rect r3(tests[i].x3, tests[i].y3, tests[i].w3, tests[i].h3);
- gfx::Rect ir = r1;
- ir.Intersect(r2);
+ gfx::Rect ir = gfx::IntersectRects(r1, r2);
EXPECT_EQ(r3.x(), ir.x());
EXPECT_EQ(r3.y(), ir.y());
EXPECT_EQ(r3.width(), ir.width());
@@ -157,8 +156,7 @@ TEST(RectTest, Union) {
gfx::Rect r1(tests[i].x1, tests[i].y1, tests[i].w1, tests[i].h1);
gfx::Rect r2(tests[i].x2, tests[i].y2, tests[i].w2, tests[i].h2);
gfx::Rect r3(tests[i].x3, tests[i].y3, tests[i].w3, tests[i].h3);
- gfx::Rect u = r1;
- u.Union(r2);
+ gfx::Rect u = gfx::UnionRects(r1, r2);
EXPECT_EQ(r3.x(), u.x());
EXPECT_EQ(r3.y(), u.y());
EXPECT_EQ(r3.width(), u.width());
@@ -446,8 +444,7 @@ TEST(RectTest, ScaleRect) {
gfx::Rect r1(tests[i].x1, tests[i].y1, tests[i].w1, tests[i].h1);
gfx::RectF r2(tests[i].x2, tests[i].y2, tests[i].w2, tests[i].h2);
- gfx::RectF scaled = r1;
- scaled.Scale(tests[i].scale);
+ gfx::RectF scaled = gfx::ScaleRect(r1, tests[i].scale);
EXPECT_FLOAT_AND_NAN_EQ(r2.x(), scaled.x());
EXPECT_FLOAT_AND_NAN_EQ(r2.y(), scaled.y());
EXPECT_FLOAT_AND_NAN_EQ(r2.width(), scaled.width());
@@ -602,8 +599,7 @@ TEST(RectTest, ToRectF) {
gfx::Rect a(10, 20, 30, 40);
gfx::RectF b(10, 20, 30, 40);
- gfx::RectF intersect = b;
- intersect.Intersect(a);
+ gfx::RectF intersect = gfx::IntersectRects(a, b);
EXPECT_EQ(b.ToString(), intersect.ToString());
EXPECT_EQ(a, b);
« no previous file with comments | « ui/gfx/rect_f.cc ('k') | ui/gfx/screen_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698