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

Unified Diff: tests/PathTest.cpp

Issue 460813002: Fallback to moveTo when unable to find the first tangent in cubicTo (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Bugfix Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkStroke.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/PathTest.cpp
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp
index 3941ad6e183946ff42f86a40434c87c8b5467f02..2719e1fd913dc38f068f9592c75b1d2d3693de4b 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -64,6 +64,35 @@ static void test_path_crbug364224() {
canvas->drawPath(path, paint);
}
+static void make_path_crbugskia2820(SkPath* path, skiatest::Reporter* reporter) {
reed1 2014/08/20 14:47:11 Seems like a brief comment would help. e.g. /* Th
Rémi Piotaix 2014/08/20 18:18:08 Done.
+ float rdi = 1./4096.;
reed1 2014/08/20 14:47:10 All of these literals will generate double->float
Rémi Piotaix 2014/08/20 18:18:08 Done.
+
+ SkPoint orig, p1, p2, p3;
+ orig = SkPoint::Make(1., 1.);
+ p1 = SkPoint::Make(1.-rdi, 1.);
+ p2 = SkPoint::Make(1., 1.+rdi);
+ p3 = SkPoint::Make(2., 2.);
+
+ REPORTER_ASSERT(reporter, SkPath::IsLineDegenerate(orig, p1));
reed1 2014/08/20 14:47:10 I don't see why these checks should be in the test
Rémi Piotaix 2014/08/20 18:18:08 These are assertions on the data (orig+p1-3) used
+ REPORTER_ASSERT(reporter, SkPath::IsLineDegenerate(orig, p2));
+ REPORTER_ASSERT(reporter, !SkPath::IsLineDegenerate(p1, p2));
+ REPORTER_ASSERT(reporter, !SkPath::IsLineDegenerate(p2, p3));
+
+ path->reset();
+ path->moveTo(1, 1);
+ path->cubicTo(p1, p2, p3);
+ path->close();
+}
+
+static void test_path_crbugskia2820(skiatest::Reporter* reporter) {//GrContext* context) {
+ SkPath path;
+ make_path_crbugskia2820(&path, reporter);
+
+ SkStrokeRec stroke(SkStrokeRec::kFill_InitStyle);
+ stroke.setStrokeStyle(2 * SK_Scalar1);
+ stroke.applyToPath(&path, path);
+}
+
static void make_path0(SkPath* path) {
// from * https://code.google.com/p/skia/issues/detail?id=1706
@@ -3553,4 +3582,5 @@ DEF_TEST(Paths, reporter) {
PathTest_Private::TestPathTo(reporter);
PathRefTest_Private::TestPathRef(reporter);
test_dump(reporter);
+ test_path_crbugskia2820(reporter);
}
« no previous file with comments | « src/core/SkStroke.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698