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

Side by Side Diff: tests/RegionTest.cpp

Issue 1008883002: Handle paths that do not report empty, but have no edges. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix uninit warning? Created 5 years, 9 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 unified diff | Download patch
« no previous file with comments | « tests/CanvasTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * 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
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkPath.h"
8 #include "SkRandom.h" 9 #include "SkRandom.h"
9 #include "SkRegion.h" 10 #include "SkRegion.h"
10 #include "Test.h" 11 #include "Test.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))
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 REPORTER_ASSERT(reporter, !valid.isEmpty()); 85 REPORTER_ASSERT(reporter, !valid.isEmpty());
85 86
86 // test intersects 87 // test intersects
87 REPORTER_ASSERT(reporter, !empty.intersects(empty2)); 88 REPORTER_ASSERT(reporter, !empty.intersects(empty2));
88 REPORTER_ASSERT(reporter, !valid.intersects(empty)); 89 REPORTER_ASSERT(reporter, !valid.intersects(empty));
89 90
90 // test contains 91 // test contains
91 REPORTER_ASSERT(reporter, !empty.contains(empty2)); 92 REPORTER_ASSERT(reporter, !empty.contains(empty2));
92 REPORTER_ASSERT(reporter, !valid.contains(empty)); 93 REPORTER_ASSERT(reporter, !valid.contains(empty));
93 REPORTER_ASSERT(reporter, !empty.contains(valid)); 94 REPORTER_ASSERT(reporter, !empty.contains(valid));
95
96 SkPath emptyPath;
97 emptyPath.moveTo(1, 5);
98 emptyPath.close();
99 SkRegion openClip;
100 openClip.setRect(-16000, -16000, 16000, 16000);
101 empty.setPath(emptyPath, openClip); // should not assert
94 } 102 }
95 103
96 enum { 104 enum {
97 W = 256, 105 W = 256,
98 H = 256 106 H = 256
99 }; 107 };
100 108
101 static SkIRect randRect(SkRandom& rand) { 109 static SkIRect randRect(SkRandom& rand) {
102 int x = rand.nextU() % W; 110 int x = rand.nextU() % W;
103 int y = rand.nextU() % H; 111 int y = rand.nextU() % H;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 rand_rect(&rect[j], rand); 255 rand_rect(&rect[j], rand);
248 } 256 }
249 REPORTER_ASSERT(reporter, test_rects(rect, N)); 257 REPORTER_ASSERT(reporter, test_rects(rect, N));
250 } 258 }
251 259
252 test_proc(reporter, contains_proc); 260 test_proc(reporter, contains_proc);
253 test_proc(reporter, intersects_proc); 261 test_proc(reporter, intersects_proc);
254 test_empties(reporter); 262 test_empties(reporter);
255 test_fromchrome(reporter); 263 test_fromchrome(reporter);
256 } 264 }
OLDNEW
« no previous file with comments | « tests/CanvasTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698