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

Side by Side Diff: tests/PathTest.cpp

Issue 2312923002: compare degenerates with tolerance (Closed)
Patch Set: Created 4 years, 3 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 | « src/core/SkGeometry.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 <cmath> 8 #include <cmath>
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkGeometry.h" 10 #include "SkGeometry.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 SkPath path; 131 SkPath path;
132 path.moveTo(SkBits2Float(0x47452a00), SkBits2Float(0x43211d01)); // 50474, 161.113f 132 path.moveTo(SkBits2Float(0x47452a00), SkBits2Float(0x43211d01)); // 50474, 161.113f
133 path.conicTo(SkBits2Float(0x401c0000), SkBits2Float(0x40680000), 133 path.conicTo(SkBits2Float(0x401c0000), SkBits2Float(0x40680000),
134 SkBits2Float(0x02c25a81), SkBits2Float(0x981a1fa0), 134 SkBits2Float(0x02c25a81), SkBits2Float(0x981a1fa0),
135 SkBits2Float(0x6bf9abea)); // 2.4375f, 3.625f, 2.85577e-37f, -1.992e-24 f, 6.03669e+26f 135 SkBits2Float(0x6bf9abea)); // 2.4375f, 3.625f, 2.85577e-37f, -1.992e-24 f, 6.03669e+26f
136 SkPaint paint; 136 SkPaint paint;
137 paint.setAntiAlias(true); 137 paint.setAntiAlias(true);
138 canvas->drawPath(path, paint); 138 canvas->drawPath(path, paint);
139 } 139 }
140 140
141 static void test_fuzz_crbug_643933() {
142 auto surface(SkSurface::MakeRasterN32Premul(250, 250));
143 SkCanvas* canvas = surface->getCanvas();
144 SkPaint paint;
145 paint.setAntiAlias(true);
146 SkPath path;
147 path.moveTo(0, 0);
148 path.conicTo(SkBits2Float(0x002001f2), SkBits2Float(0x4161ffff), // 2.93943 e-39f, 14.125f
149 SkBits2Float(0x49f7224d), SkBits2Float(0x45eec8df), // 2.02452e+06f, 7641.11f
150 SkBits2Float(0x721aee0c)); // 3.0687e+30f
151 canvas->drawPath(path, paint);
152 path.reset();
153 path.moveTo(0, 0);
154 path.conicTo(SkBits2Float(0x00007ff2), SkBits2Float(0x4169ffff), // 4.58981 e-41f, 14.625f
155 SkBits2Float(0x43ff2261), SkBits2Float(0x41eeea04), // 510.269f, 29.864 3f
156 SkBits2Float(0x5d06eff8)); // 6.07704e+17f
157 canvas->drawPath(path, paint);
158 }
159
141 /** 160 /**
142 * In debug mode, this path was causing an assertion to fail in 161 * In debug mode, this path was causing an assertion to fail in
143 * SkPathStroker::preJoinTo() and, in Release, the use of an unitialized value. 162 * SkPathStroker::preJoinTo() and, in Release, the use of an unitialized value.
144 */ 163 */
145 static void make_path_crbugskia2820(SkPath* path, skiatest::Reporter* reporter) { 164 static void make_path_crbugskia2820(SkPath* path, skiatest::Reporter* reporter) {
146 SkPoint orig, p1, p2, p3; 165 SkPoint orig, p1, p2, p3;
147 orig = SkPoint::Make(1.f, 1.f); 166 orig = SkPoint::Make(1.f, 1.f);
148 p1 = SkPoint::Make(1.f - SK_ScalarNearlyZero, 1.f); 167 p1 = SkPoint::Make(1.f - SK_ScalarNearlyZero, 1.f);
149 p2 = SkPoint::Make(1.f, 1.f + SK_ScalarNearlyZero); 168 p2 = SkPoint::Make(1.f, 1.f + SK_ScalarNearlyZero);
150 p3 = SkPoint::Make(2.f, 2.f); 169 p3 = SkPoint::Make(2.f, 2.f);
(...skipping 4098 matching lines...) Expand 10 before | Expand all | Expand 10 after
4249 4268
4250 DEF_TEST(PathInterp, reporter) { 4269 DEF_TEST(PathInterp, reporter) {
4251 test_interp(reporter); 4270 test_interp(reporter);
4252 } 4271 }
4253 4272
4254 DEF_TEST(PathContains, reporter) { 4273 DEF_TEST(PathContains, reporter) {
4255 test_contains(reporter); 4274 test_contains(reporter);
4256 } 4275 }
4257 4276
4258 DEF_TEST(Paths, reporter) { 4277 DEF_TEST(Paths, reporter) {
4278 test_fuzz_crbug_643933();
4259 test_sect_with_horizontal_needs_pinning(); 4279 test_sect_with_horizontal_needs_pinning();
4260 test_crbug_629455(reporter); 4280 test_crbug_629455(reporter);
4261 test_fuzz_crbug_627414(reporter); 4281 test_fuzz_crbug_627414(reporter);
4262 test_path_crbug364224(); 4282 test_path_crbug364224();
4263 4283
4264 SkTSize<SkScalar>::Make(3,4); 4284 SkTSize<SkScalar>::Make(3,4);
4265 4285
4266 SkPath p, empty; 4286 SkPath p, empty;
4267 SkRect bounds, bounds2; 4287 SkRect bounds, bounds2;
4268 test_empty(reporter, p); 4288 test_empty(reporter, p);
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
4408 PathRefTest_Private::TestPathRef(reporter); 4428 PathRefTest_Private::TestPathRef(reporter);
4409 PathTest_Private::TestPathrefListeners(reporter); 4429 PathTest_Private::TestPathrefListeners(reporter);
4410 test_dump(reporter); 4430 test_dump(reporter);
4411 test_path_crbug389050(reporter); 4431 test_path_crbug389050(reporter);
4412 test_path_crbugskia2820(reporter); 4432 test_path_crbugskia2820(reporter);
4413 test_skbug_3469(reporter); 4433 test_skbug_3469(reporter);
4414 test_skbug_3239(reporter); 4434 test_skbug_3239(reporter);
4415 test_bounds_crbug_513799(reporter); 4435 test_bounds_crbug_513799(reporter);
4416 test_fuzz_crbug_638223(); 4436 test_fuzz_crbug_638223();
4417 } 4437 }
OLDNEW
« no previous file with comments | « src/core/SkGeometry.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698