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

Unified Diff: tests/PathTest.cpp

Issue 1532003004: fix bugs in path contains (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years 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
« src/core/SkPath.cpp ('K') | « src/core/SkPath.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 aa2ffdb32f106cecb913e2acf52701d6cf5921a9..faa091c997fca89779ff54b8c3e05a649563a4a0 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -3591,6 +3591,10 @@ static void test_contains(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, p.contains(5, 5));
REPORTER_ASSERT(reporter, p.contains(5, 8));
REPORTER_ASSERT(reporter, p.contains(4, 5));
+ // test quad endpoints
+ REPORTER_ASSERT(reporter, p.contains(4, 4));
+ REPORTER_ASSERT(reporter, p.contains(8, 8));
+ REPORTER_ASSERT(reporter, p.contains(4, 8));
p.reset();
const SkPoint qPts[] = {{6, 6}, {8, 8}, {6, 8}, {4, 8}, {4, 6}, {4, 4}, {6, 6}};
@@ -3622,6 +3626,10 @@ static void test_contains(skiatest::Reporter* reporter) {
halfway = conic.evalAt(0.5f);
REPORTER_ASSERT(reporter, p.contains(halfway.fX, halfway.fY));
}
+ // test conic end points
+ REPORTER_ASSERT(reporter, p.contains(4, 4));
+ REPORTER_ASSERT(reporter, p.contains(8, 8));
+ REPORTER_ASSERT(reporter, p.contains(4, 8));
// test cubics
SkPoint pts[] = {{5, 4}, {6, 5}, {7, 6}, {6, 6}, {4, 6}, {5, 7}, {5, 5}, {5, 4}, {6, 5}, {7, 6}};
@@ -3639,6 +3647,10 @@ static void test_contains(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, p.contains(halfway.fX, halfway.fY));
SkEvalCubicAt(&pts[i + 3], 0.5f, &halfway, nullptr, nullptr);
REPORTER_ASSERT(reporter, p.contains(halfway.fX, halfway.fY));
+ // test cubic end points
+ REPORTER_ASSERT(reporter, p.contains(pts[i].fX, pts[i].fY));
+ REPORTER_ASSERT(reporter, p.contains(pts[i + 3].fX, pts[i + 3].fY));
+ REPORTER_ASSERT(reporter, p.contains(pts[i + 6].fX, pts[i + 6].fY));
}
}
« src/core/SkPath.cpp ('K') | « src/core/SkPath.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698