Chromium Code Reviews| Index: tests/PathTest.cpp |
| diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp |
| index 1048fcd97920242d667ac10df1e4050b87aee478..9b066c62c2af6689b04178d313a609dfd73c02c2 100644 |
| --- a/tests/PathTest.cpp |
| +++ b/tests/PathTest.cpp |
| @@ -3904,6 +3904,45 @@ public: |
| } |
| }; |
| +static void test_interp(skiatest::Reporter* reporter) { |
| + SkPath p1, p2, out; |
| + REPORTER_ASSERT(reporter, p1.isInterpolatable(p2)); |
| + REPORTER_ASSERT(reporter, p1.interpolate(p2, 0, &out)); |
| + REPORTER_ASSERT(reporter, p1 == out); |
| + REPORTER_ASSERT(reporter, p1.interpolate(p2, 1, &out)); |
| + REPORTER_ASSERT(reporter, p1 == out); |
| + p1.moveTo(0, 2); |
| + p1.lineTo(0, 4); |
| + REPORTER_ASSERT(reporter, !p1.isInterpolatable(p2)); |
| + REPORTER_ASSERT(reporter, !p1.interpolate(p2, 1, &out)); |
| + p2.moveTo(6, 0); |
| + p2.lineTo(8, 0); |
| + REPORTER_ASSERT(reporter, p1.isInterpolatable(p2)); |
| + REPORTER_ASSERT(reporter, p1.interpolate(p2, 0, &out)); |
| + REPORTER_ASSERT(reporter, p2 == out); |
| + REPORTER_ASSERT(reporter, p1.interpolate(p2, 1, &out)); |
| + REPORTER_ASSERT(reporter, p1 == out); |
| + REPORTER_ASSERT(reporter, p1.interpolate(p2, 0.5f, &out)); |
| + REPORTER_ASSERT(reporter, out.getBounds() == SkRect::MakeLTRB(3, 1, 4, 2)); |
| + p1.reset(); |
| + p1.moveTo(4, 4); |
| + p1.conicTo(5, 4, 5, 5, 1 / SkScalarSqrt(2)); |
| + p2.reset(); |
| + p2.moveTo(4, 2); |
| + p2.conicTo(7, 2, 7, 5, 1 / SkScalarSqrt(2)); |
|
robertphillips
2016/02/17 21:08:49
add a test with a conic with the same points in ea
caryclark
2016/02/17 21:39:21
I intentionally didn't address this. I don't know
caryclark
2016/02/17 21:47:06
I misunderstood the feedback. I added a test that
|
| + REPORTER_ASSERT(reporter, p1.isInterpolatable(p2)); |
| + REPORTER_ASSERT(reporter, p1.interpolate(p2, 0.5f, &out)); |
| + REPORTER_ASSERT(reporter, out.getBounds() == SkRect::MakeLTRB(4, 3, 6, 5)); |
| + p2.reset(); |
| + p2.moveTo(4, 2); |
| + p2.conicTo(6, 3, 6, 5, 1); |
| + REPORTER_ASSERT(reporter, !p1.isInterpolatable(p2)); |
| +} |
| + |
| +DEF_TEST(PathInterp, reporter) { |
| + test_interp(reporter); |
| +} |
| + |
| DEF_TEST(PathContains, reporter) { |
| test_contains(reporter); |
| } |