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

Unified Diff: tests/PathTest.cpp

Issue 2175923002: Fix misdetection of rectangles in SkPath::IsSimpleClosedRect. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « 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 8f98e6abaa05a1e03e377014144ef24c3eb3391d..cb330c58fe3d0a64ea0cc36fe601489c5ef1b2d7 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -2094,6 +2094,42 @@ static void test_is_simple_closed_rect(skiatest::Reporter* reporter) {
check_simple_closed_rect(reporter, path2, testRect, swapDir, kYSwapStarts[start]);
}
}
+ // down, up, left, close
+ path.reset();
+ path.moveTo(1, 1);
+ path.lineTo(1, 2);
+ path.lineTo(1, 1);
+ path.lineTo(0, 1);
+ SkRect rect;
+ SkPath::Direction dir;
+ unsigned start;
+ path.close();
+ REPORTER_ASSERT(reporter, !SkPathPriv::IsSimpleClosedRect(path, &rect, &dir, &start));
+ // right, left, up, close
+ path.reset();
+ path.moveTo(1, 1);
+ path.lineTo(2, 1);
+ path.lineTo(1, 1);
+ path.lineTo(1, 0);
+ path.close();
+ REPORTER_ASSERT(reporter, !SkPathPriv::IsSimpleClosedRect(path, &rect, &dir, &start));
+ // parallelogram with horizontal edges
+ path.reset();
+ path.moveTo(1, 0);
+ path.lineTo(3, 0);
+ path.lineTo(2, 1);
+ path.lineTo(0, 1);
+ path.close();
+ REPORTER_ASSERT(reporter, !SkPathPriv::IsSimpleClosedRect(path, &rect, &dir, &start));
+ // parallelogram with vertical edges
+ path.reset();
+ path.moveTo(0, 1);
+ path.lineTo(0, 3);
+ path.lineTo(1, 2);
+ path.lineTo(1, 0);
+ path.close();
+ REPORTER_ASSERT(reporter, !SkPathPriv::IsSimpleClosedRect(path, &rect, &dir, &start));
+
}
static void test_isNestedFillRects(skiatest::Reporter* reporter) {
« no previous file with comments | « src/core/SkPath.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698