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 "cc/base/region.h" | 5 #include "cc/base/region.h" |
6 | 6 |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 | 8 |
9 namespace cc { | 9 namespace cc { |
10 namespace { | 10 namespace { |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 r.Union(gfx::Rect(0, 0, 500, 500)); | 430 r.Union(gfx::Rect(0, 0, 500, 500)); |
431 EXPECT_FALSE(r.IsEmpty()); | 431 EXPECT_FALSE(r.IsEmpty()); |
432 r.Clear(); | 432 r.Clear(); |
433 EXPECT_TRUE(r.IsEmpty()); | 433 EXPECT_TRUE(r.IsEmpty()); |
434 } | 434 } |
435 | 435 |
436 TEST(RegionSwap, Swap) { | 436 TEST(RegionSwap, Swap) { |
437 Region r1, r2, r3; | 437 Region r1, r2, r3; |
438 | 438 |
439 r1 = gfx::Rect(0, 0, 50, 50); | 439 r1 = gfx::Rect(0, 0, 50, 50); |
440 r1.Swap(r2); | 440 r1.Swap(&r2); |
441 EXPECT_TRUE(r1.IsEmpty()); | 441 EXPECT_TRUE(r1.IsEmpty()); |
442 EXPECT_EQ(r2.ToString(), Region(gfx::Rect(0, 0, 50, 50)).ToString()); | 442 EXPECT_EQ(r2.ToString(), Region(gfx::Rect(0, 0, 50, 50)).ToString()); |
443 | 443 |
444 r1 = gfx::Rect(0, 0, 50, 50); | 444 r1 = gfx::Rect(0, 0, 50, 50); |
445 r1.Union(gfx::Rect(100, 0, 50, 50)); | 445 r1.Union(gfx::Rect(100, 0, 50, 50)); |
446 r1.Union(gfx::Rect(0, 0, 500, 500)); | 446 r1.Union(gfx::Rect(0, 0, 500, 500)); |
447 r3 = r1; | 447 r3 = r1; |
448 r1.Swap(r2); | 448 r1.Swap(&r2); |
449 EXPECT_EQ(r1.ToString(), Region(gfx::Rect(0, 0, 50, 50)).ToString()); | 449 EXPECT_EQ(r1.ToString(), Region(gfx::Rect(0, 0, 50, 50)).ToString()); |
450 EXPECT_EQ(r2.ToString(), r3.ToString()); | 450 EXPECT_EQ(r2.ToString(), r3.ToString()); |
451 } | 451 } |
452 | 452 |
453 } // namespace | 453 } // namespace |
454 } // namespace cc | 454 } // namespace cc |
OLD | NEW |