OLD | NEW |
1 | |
2 /* | 1 /* |
3 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
4 * | 3 * |
5 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 5 * found in the LICENSE file. |
7 */ | 6 */ |
| 7 |
8 #include "Test.h" | 8 #include "Test.h" |
| 9 #include "TestClassDef.h" |
9 #include "SkRegion.h" | 10 #include "SkRegion.h" |
10 #include "SkRandom.h" | 11 #include "SkRandom.h" |
11 | 12 |
12 static void Union(SkRegion* rgn, const SkIRect& rect) { | 13 static void Union(SkRegion* rgn, const SkIRect& rect) { |
13 rgn->op(rect, SkRegion::kUnion_Op); | 14 rgn->op(rect, SkRegion::kUnion_Op); |
14 } | 15 } |
15 | 16 |
16 #define TEST_NO_INTERSECT(rgn, rect) REPORTER_ASSERT(reporter, !rgn.intersect
s(rect)) | 17 #define TEST_NO_INTERSECT(rgn, rect) REPORTER_ASSERT(reporter, !rgn.intersect
s(rect)) |
17 #define TEST_INTERSECT(rgn, rect) REPORTER_ASSERT(reporter, rgn.intersects
(rect)) | 18 #define TEST_INTERSECT(rgn, rect) REPORTER_ASSERT(reporter, rgn.intersects
(rect)) |
18 #define TEST_NO_CONTAINS(rgn, rect) REPORTER_ASSERT(reporter, !rgn.contains(
rect)) | 19 #define TEST_NO_CONTAINS(rgn, rect) REPORTER_ASSERT(reporter, !rgn.contains(
rect)) |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 SkDebugf(" { %d, %d, %d, %d },\n", | 216 SkDebugf(" { %d, %d, %d, %d },\n", |
216 rect[i].fLeft, rect[i].fTop, | 217 rect[i].fLeft, rect[i].fTop, |
217 rect[i].fRight, rect[i].fBottom); | 218 rect[i].fRight, rect[i].fBottom); |
218 } | 219 } |
219 SkDebugf("\n"); | 220 SkDebugf("\n"); |
220 return false; | 221 return false; |
221 } | 222 } |
222 return true; | 223 return true; |
223 } | 224 } |
224 | 225 |
225 static void TestRegion(skiatest::Reporter* reporter) { | 226 DEF_TEST(Region, reporter) { |
226 const SkIRect r2[] = { | 227 const SkIRect r2[] = { |
227 { 0, 0, 1, 1 }, | 228 { 0, 0, 1, 1 }, |
228 { 2, 2, 3, 3 }, | 229 { 2, 2, 3, 3 }, |
229 }; | 230 }; |
230 REPORTER_ASSERT(reporter, test_rects(r2, SK_ARRAY_COUNT(r2))); | 231 REPORTER_ASSERT(reporter, test_rects(r2, SK_ARRAY_COUNT(r2))); |
231 | 232 |
232 const SkIRect rects[] = { | 233 const SkIRect rects[] = { |
233 { 0, 0, 1, 2 }, | 234 { 0, 0, 1, 2 }, |
234 { 2, 1, 3, 3 }, | 235 { 2, 1, 3, 3 }, |
235 { 4, 0, 5, 1 }, | 236 { 4, 0, 5, 1 }, |
(...skipping 11 matching lines...) Expand all Loading... |
247 rand_rect(&rect[j], rand); | 248 rand_rect(&rect[j], rand); |
248 } | 249 } |
249 REPORTER_ASSERT(reporter, test_rects(rect, N)); | 250 REPORTER_ASSERT(reporter, test_rects(rect, N)); |
250 } | 251 } |
251 | 252 |
252 test_proc(reporter, contains_proc); | 253 test_proc(reporter, contains_proc); |
253 test_proc(reporter, intersects_proc); | 254 test_proc(reporter, intersects_proc); |
254 test_empties(reporter); | 255 test_empties(reporter); |
255 test_fromchrome(reporter); | 256 test_fromchrome(reporter); |
256 } | 257 } |
257 | |
258 #include "TestClassDef.h" | |
259 DEFINE_TESTCLASS("Region", RegionTestClass, TestRegion) | |
OLD | NEW |