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

Side by Side Diff: tests/PathTest.cpp

Issue 2174383002: cherry-pick https://codereview.chromium.org/2159223005 (Closed) Base URL: https://skia.googlesource.com/skia.git@m53
Patch Set: Created 4 years, 5 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/SkEdgeClipper.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 4098 matching lines...) Expand 10 before | Expand all | Expand 10 after
4109 SkPath q; 4109 SkPath q;
4110 q.moveTo(10, 10); 4110 q.moveTo(10, 10);
4111 SkPathPriv::AddGenIDChangeListener(q, new ChangeListener(&changed)); 4111 SkPathPriv::AddGenIDChangeListener(q, new ChangeListener(&changed));
4112 REPORTER_ASSERT(reporter, !changed); 4112 REPORTER_ASSERT(reporter, !changed);
4113 } 4113 }
4114 // q went out of scope. 4114 // q went out of scope.
4115 REPORTER_ASSERT(reporter, changed); 4115 REPORTER_ASSERT(reporter, changed);
4116 } 4116 }
4117 }; 4117 };
4118 4118
4119 static void test_crbug_629455(skiatest::Reporter* reporter) {
4120 SkPath path;
4121 path.moveTo(0, 0);
4122 path.cubicTo(SkBits2Float(0xcdcdcd00), SkBits2Float(0xcdcdcdcd),
4123 SkBits2Float(0xcdcdcdcd), SkBits2Float(0xcdcdcdcd),
4124 SkBits2Float(0x423fcdcd), SkBits2Float(0x40ed9341));
4125 // AKA: cubicTo(-4.31596e+08f, -4.31602e+08f, -4.31602e+08f, -4.31602e+08f, 47. 951f, 7.42423f);
4126 path.lineTo(0, 0);
4127
4128 auto surface = SkSurface::MakeRasterN32Premul(100, 100);
4129 SkPaint paint;
4130 paint.setAntiAlias(true);
4131 surface->getCanvas()->drawPath(path, paint);
4132 }
4133
4119 static void test_interp(skiatest::Reporter* reporter) { 4134 static void test_interp(skiatest::Reporter* reporter) {
4120 SkPath p1, p2, out; 4135 SkPath p1, p2, out;
4121 REPORTER_ASSERT(reporter, p1.isInterpolatable(p2)); 4136 REPORTER_ASSERT(reporter, p1.isInterpolatable(p2));
4122 REPORTER_ASSERT(reporter, p1.interpolate(p2, 0, &out)); 4137 REPORTER_ASSERT(reporter, p1.interpolate(p2, 0, &out));
4123 REPORTER_ASSERT(reporter, p1 == out); 4138 REPORTER_ASSERT(reporter, p1 == out);
4124 REPORTER_ASSERT(reporter, p1.interpolate(p2, 1, &out)); 4139 REPORTER_ASSERT(reporter, p1.interpolate(p2, 1, &out));
4125 REPORTER_ASSERT(reporter, p1 == out); 4140 REPORTER_ASSERT(reporter, p1 == out);
4126 p1.moveTo(0, 2); 4141 p1.moveTo(0, 2);
4127 p1.lineTo(0, 4); 4142 p1.lineTo(0, 4);
4128 REPORTER_ASSERT(reporter, !p1.isInterpolatable(p2)); 4143 REPORTER_ASSERT(reporter, !p1.isInterpolatable(p2));
(...skipping 28 matching lines...) Expand all
4157 4172
4158 DEF_TEST(PathInterp, reporter) { 4173 DEF_TEST(PathInterp, reporter) {
4159 test_interp(reporter); 4174 test_interp(reporter);
4160 } 4175 }
4161 4176
4162 DEF_TEST(PathContains, reporter) { 4177 DEF_TEST(PathContains, reporter) {
4163 test_contains(reporter); 4178 test_contains(reporter);
4164 } 4179 }
4165 4180
4166 DEF_TEST(Paths, reporter) { 4181 DEF_TEST(Paths, reporter) {
4182 test_crbug_629455(reporter);
4167 test_path_crbug364224(); 4183 test_path_crbug364224();
4168 4184
4169 SkTSize<SkScalar>::Make(3,4); 4185 SkTSize<SkScalar>::Make(3,4);
4170 4186
4171 SkPath p, empty; 4187 SkPath p, empty;
4172 SkRect bounds, bounds2; 4188 SkRect bounds, bounds2;
4173 test_empty(reporter, p); 4189 test_empty(reporter, p);
4174 4190
4175 REPORTER_ASSERT(reporter, p.getBounds().isEmpty()); 4191 REPORTER_ASSERT(reporter, p.getBounds().isEmpty());
4176 4192
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
4312 PathTest_Private::TestPathTo(reporter); 4328 PathTest_Private::TestPathTo(reporter);
4313 PathRefTest_Private::TestPathRef(reporter); 4329 PathRefTest_Private::TestPathRef(reporter);
4314 PathTest_Private::TestPathrefListeners(reporter); 4330 PathTest_Private::TestPathrefListeners(reporter);
4315 test_dump(reporter); 4331 test_dump(reporter);
4316 test_path_crbug389050(reporter); 4332 test_path_crbug389050(reporter);
4317 test_path_crbugskia2820(reporter); 4333 test_path_crbugskia2820(reporter);
4318 test_skbug_3469(reporter); 4334 test_skbug_3469(reporter);
4319 test_skbug_3239(reporter); 4335 test_skbug_3239(reporter);
4320 test_bounds_crbug_513799(reporter); 4336 test_bounds_crbug_513799(reporter);
4321 } 4337 }
OLDNEW
« no previous file with comments | « src/core/SkEdgeClipper.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698