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

Unified Diff: tests/PathTest.cpp

Issue 975523002: add double precision convex test (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add this-> for directionChange Created 5 years, 10 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 aeab7e6e25edad85b0c7351f1c52d49eebfe3b8a..08de5b3e48e29ad80293f7275ef6213398057ac0 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -39,10 +39,10 @@ static void test_add_rrect(skiatest::Reporter* reporter, const SkRect& bounds,
}
static void test_skbug_3469(skiatest::Reporter* reporter) {
- SkPath path;
- path.moveTo(20, 20);
- path.quadTo(20, 50, 80, 50);
- path.quadTo(20, 50, 20, 80);
+ SkPath path;
+ path.moveTo(20, 20);
+ path.quadTo(20, 50, 80, 50);
+ path.quadTo(20, 50, 20, 80);
REPORTER_ASSERT(reporter, !path.isConvex());
}
@@ -1076,6 +1076,34 @@ static void check_convexity(skiatest::Reporter* reporter, const SkPath& path,
REPORTER_ASSERT(reporter, c == expected);
}
+static void test_path_crbug389050(skiatest::Reporter* reporter) {
+ SkPath tinyConvexPolygon;
+ tinyConvexPolygon.moveTo(600.131559f, 800.112512f);
+ tinyConvexPolygon.lineTo(600.161735f, 800.118627f);
+ tinyConvexPolygon.lineTo(600.148962f, 800.142338f);
+ tinyConvexPolygon.lineTo(600.134891f, 800.137724f);
+ tinyConvexPolygon.close();
+ tinyConvexPolygon.getConvexity();
+ check_convexity(reporter, tinyConvexPolygon, SkPath::kConvex_Convexity);
+ check_direction(reporter, tinyConvexPolygon, SkPath::kCW_Direction);
+
+ SkPath platTriangle;
+ platTriangle.moveTo(0, 0);
+ platTriangle.lineTo(200, 0);
+ platTriangle.lineTo(100, 0.04f);
+ platTriangle.close();
+ platTriangle.getConvexity();
+ check_direction(reporter, platTriangle, SkPath::kCW_Direction);
+
+ platTriangle.reset();
+ platTriangle.moveTo(0, 0);
+ platTriangle.lineTo(200, 0);
+ platTriangle.lineTo(100, 0.03f);
+ platTriangle.close();
+ platTriangle.getConvexity();
+ check_direction(reporter, platTriangle, SkPath::kCW_Direction);
+}
+
static void test_convexity2(skiatest::Reporter* reporter) {
SkPath pt;
pt.moveTo(0, 0);
@@ -3739,6 +3767,7 @@ DEF_TEST(Paths, reporter) {
PathTest_Private::TestPathTo(reporter);
PathRefTest_Private::TestPathRef(reporter);
test_dump(reporter);
+ test_path_crbug389050(reporter);
test_path_crbugskia2820(reporter);
test_skbug_3469(reporter);
test_skbug_3239(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