OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "cc/region.h" | 7 #include "cc/region.h" |
8 | 8 |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
11 using namespace cc; | 11 namespace cc { |
12 | |
13 namespace { | 12 namespace { |
14 | 13 |
15 #define TEST_INSIDE_RECT(r, x, y, w, h) \ | 14 #define TEST_INSIDE_RECT(r, x, y, w, h) \ |
16 EXPECT_TRUE(r.Contains(gfx::Point(x, y))); \ | 15 EXPECT_TRUE(r.Contains(gfx::Point(x, y))); \ |
17 EXPECT_TRUE(r.Contains(gfx::Point(x + w - 1, y))); \ | 16 EXPECT_TRUE(r.Contains(gfx::Point(x + w - 1, y))); \ |
18 EXPECT_TRUE(r.Contains(gfx::Point(x, y + h - 1))); \ | 17 EXPECT_TRUE(r.Contains(gfx::Point(x, y + h - 1))); \ |
19 EXPECT_TRUE(r.Contains(gfx::Point(x + w - 1, y + h - 1))); \ | 18 EXPECT_TRUE(r.Contains(gfx::Point(x + w - 1, y + h - 1))); \ |
20 EXPECT_TRUE(r.Contains(gfx::Point(x, y + h / 2))); \ | 19 EXPECT_TRUE(r.Contains(gfx::Point(x, y + h / 2))); \ |
21 EXPECT_TRUE(r.Contains(gfx::Point(x + w - 1, y + h / 2))); \ | 20 EXPECT_TRUE(r.Contains(gfx::Point(x + w - 1, y + h / 2))); \ |
22 EXPECT_TRUE(r.Contains(gfx::Point(x + w / 2, y))); \ | 21 EXPECT_TRUE(r.Contains(gfx::Point(x + w / 2, y))); \ |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 r1 = gfx::Rect(0, 0, 50, 50); | 446 r1 = gfx::Rect(0, 0, 50, 50); |
448 r1.Union(gfx::Rect(100, 0, 50, 50)); | 447 r1.Union(gfx::Rect(100, 0, 50, 50)); |
449 r1.Union(gfx::Rect(0, 0, 500, 500)); | 448 r1.Union(gfx::Rect(0, 0, 500, 500)); |
450 r3 = r1; | 449 r3 = r1; |
451 r1.Swap(r2); | 450 r1.Swap(r2); |
452 EXPECT_EQ(r1.ToString(), Region(gfx::Rect(0, 0, 50, 50)).ToString()); | 451 EXPECT_EQ(r1.ToString(), Region(gfx::Rect(0, 0, 50, 50)).ToString()); |
453 EXPECT_EQ(r2.ToString(), r3.ToString()); | 452 EXPECT_EQ(r2.ToString(), r3.ToString()); |
454 } | 453 } |
455 | 454 |
456 } // namespace | 455 } // namespace |
| 456 } // namespace cc |
OLD | NEW |