Chromium Code Reviews| 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); |