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

Unified Diff: tests/PathTest.cpp

Issue 151353006: Adding new 'extend' mode to SkPath::addPath (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: further improvements Created 6 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
« 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 e872b0c839699f307c70f2e3ace1b3c3256da35a..4b50c70ab3b3fa1e7f1f5ef86406081346202878 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -3060,6 +3060,46 @@ static void test_addPath(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, p.getBounds() == reverseExpected);
}
+static void test_addPathJoin(skiatest::Reporter* reporter, bool explicitMoveTo) {
reed1 2014/02/07 18:05:50 addPathExtend?
+ SkPath p, q;
+ if (explicitMoveTo) {
+ p.moveTo(1, 1);
+ }
+ p.lineTo(1, 2);
+ if (explicitMoveTo) {
+ q.moveTo(2, 1);
+ }
+ q.lineTo(2, 2);
+ p.addPath(q, SkPath::kJoin_AddPathMode);
+ uint8_t verbs[4];
+ int verbcount = p.getVerbs(verbs, 4);
+ REPORTER_ASSERT(reporter, verbcount == 4);
+ REPORTER_ASSERT(reporter, verbs[0] == SkPath::kMove_Verb);
+ REPORTER_ASSERT(reporter, verbs[1] == SkPath::kLine_Verb);
+ REPORTER_ASSERT(reporter, verbs[2] == SkPath::kLine_Verb);
+ REPORTER_ASSERT(reporter, verbs[3] == SkPath::kLine_Verb);
+}
+
+static void test_addPathAppend(skiatest::Reporter* reporter, bool explicitMoveTo) {
+ SkPath p, q;
+ if (explicitMoveTo) {
+ p.moveTo(1, 1);
+ }
+ p.lineTo(1, 2);
+ if (explicitMoveTo) {
+ q.moveTo(2, 1);
+ }
+ q.lineTo(2, 2);
+ p.addPath(q, SkPath::kAppend_AddPathMode);
+ uint8_t verbs[4];
+ int verbcount = p.getVerbs(verbs, 4);
+ REPORTER_ASSERT(reporter, verbcount == 4);
+ REPORTER_ASSERT(reporter, verbs[0] == SkPath::kMove_Verb);
+ REPORTER_ASSERT(reporter, verbs[1] == SkPath::kLine_Verb);
+ REPORTER_ASSERT(reporter, verbs[2] == SkPath::kMove_Verb);
reed1 2014/02/07 18:05:50 I wonder if we can make these new test more compac
+ REPORTER_ASSERT(reporter, verbs[3] == SkPath::kLine_Verb);
+}
+
static void test_conicTo_special_case(skiatest::Reporter* reporter) {
SkPath p;
p.conicTo(1, 2, 3, 4, -1);
@@ -3377,6 +3417,10 @@ DEF_TEST(Paths, reporter) {
test_arc(reporter);
test_arcTo(reporter);
test_addPath(reporter);
+ test_addPathJoin(reporter, false);
+ test_addPathJoin(reporter, true);
+ test_addPathAppend(reporter, false);
+ test_addPathAppend(reporter, true);
test_conicTo_special_case(reporter);
test_get_point(reporter);
test_contains(reporter);
« 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