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 |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 | 217 |
218 #define TEST_CONTAINS(a, b) \ | 218 #define TEST_CONTAINS(a, b) \ |
219 { \ | 219 { \ |
220 Region ar = a; \ | 220 Region ar = a; \ |
221 Region br = b; \ | 221 Region br = b; \ |
222 EXPECT_TRUE(ar.Contains(br)); \ | 222 EXPECT_TRUE(ar.Contains(br)); \ |
223 EXPECT_TRUE(ar.Contains(b)); \ | 223 EXPECT_TRUE(ar.Contains(b)); \ |
224 } | 224 } |
225 | 225 |
226 TEST(RegionTest, ContainsRegion) { | 226 TEST(RegionTest, ContainsRegion) { |
227 TEST_NO_CONTAINS(gfx::Rect(), gfx::Rect()); | 227 TEST_CONTAINS(gfx::Rect(), gfx::Rect()); |
| 228 TEST_CONTAINS(gfx::Rect(0, 0, 1, 1), gfx::Rect()); |
| 229 TEST_CONTAINS(gfx::Rect(10, 10, 1, 1), gfx::Rect()); |
| 230 |
228 TEST_NO_CONTAINS(gfx::Rect(), gfx::Rect(0, 0, 1, 1)); | 231 TEST_NO_CONTAINS(gfx::Rect(), gfx::Rect(0, 0, 1, 1)); |
229 TEST_NO_CONTAINS(gfx::Rect(), gfx::Rect(1, 1, 1, 1)); | 232 TEST_NO_CONTAINS(gfx::Rect(), gfx::Rect(1, 1, 1, 1)); |
230 | 233 |
231 TEST_NO_CONTAINS(gfx::Rect(10, 10, 1, 1), gfx::Rect(11, 10, 1, 1)); | 234 TEST_NO_CONTAINS(gfx::Rect(10, 10, 1, 1), gfx::Rect(11, 10, 1, 1)); |
232 TEST_NO_CONTAINS(gfx::Rect(10, 10, 1, 1), gfx::Rect(10, 11, 1, 1)); | 235 TEST_NO_CONTAINS(gfx::Rect(10, 10, 1, 1), gfx::Rect(10, 11, 1, 1)); |
233 TEST_NO_CONTAINS(gfx::Rect(10, 10, 1, 1), gfx::Rect(9, 10, 1, 1)); | 236 TEST_NO_CONTAINS(gfx::Rect(10, 10, 1, 1), gfx::Rect(9, 10, 1, 1)); |
234 TEST_NO_CONTAINS(gfx::Rect(10, 10, 1, 1), gfx::Rect(10, 9, 1, 1)); | 237 TEST_NO_CONTAINS(gfx::Rect(10, 10, 1, 1), gfx::Rect(10, 9, 1, 1)); |
235 TEST_NO_CONTAINS(gfx::Rect(10, 10, 1, 1), gfx::Rect(9, 9, 2, 2)); | 238 TEST_NO_CONTAINS(gfx::Rect(10, 10, 1, 1), gfx::Rect(9, 9, 2, 2)); |
236 TEST_NO_CONTAINS(gfx::Rect(10, 10, 1, 1), gfx::Rect(10, 9, 2, 2)); | 239 TEST_NO_CONTAINS(gfx::Rect(10, 10, 1, 1), gfx::Rect(10, 9, 2, 2)); |
237 TEST_NO_CONTAINS(gfx::Rect(10, 10, 1, 1), gfx::Rect(9, 10, 2, 2)); | 240 TEST_NO_CONTAINS(gfx::Rect(10, 10, 1, 1), gfx::Rect(9, 10, 2, 2)); |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 EXPECT_TRUE(SkIRect::MakeXYWH(10, 10, 10, 0).isEmpty()); | 414 EXPECT_TRUE(SkIRect::MakeXYWH(10, 10, 10, 0).isEmpty()); |
412 EXPECT_TRUE(SkIRect::MakeXYWH(10, 10, 0, 10).isEmpty()); | 415 EXPECT_TRUE(SkIRect::MakeXYWH(10, 10, 0, 10).isEmpty()); |
413 EXPECT_TRUE(SkIRect::MakeXYWH(-10, 10, 10, 0).isEmpty()); | 416 EXPECT_TRUE(SkIRect::MakeXYWH(-10, 10, 10, 0).isEmpty()); |
414 EXPECT_TRUE(SkIRect::MakeXYWH(-10, 10, 0, 10).isEmpty()); | 417 EXPECT_TRUE(SkIRect::MakeXYWH(-10, 10, 0, 10).isEmpty()); |
415 EXPECT_FALSE(SkIRect::MakeXYWH(-1, -1, 1, 1).isEmpty()); | 418 EXPECT_FALSE(SkIRect::MakeXYWH(-1, -1, 1, 1).isEmpty()); |
416 EXPECT_FALSE(SkIRect::MakeXYWH(0, 0, 1, 1).isEmpty()); | 419 EXPECT_FALSE(SkIRect::MakeXYWH(0, 0, 1, 1).isEmpty()); |
417 EXPECT_FALSE(SkIRect::MakeXYWH(0, 0, 2, 2).isEmpty()); | 420 EXPECT_FALSE(SkIRect::MakeXYWH(0, 0, 2, 2).isEmpty()); |
418 } | 421 } |
419 | 422 |
420 } // namespace | 423 } // namespace |
OLD | NEW |