Lines Matching refs:reporter

38 static void test_add_rrect(skiatest::Reporter* reporter, const SkRect& bounds,
42 REPORTER_ASSERT(reporter, bounds == rrect.rect());
47 REPORTER_ASSERT(reporter, bounds == path.getBounds());
50 static void test_skbug_3469(skiatest::Reporter* reporter) {
55 REPORTER_ASSERT(reporter, !path.isConvex());
58 static void test_skbug_3239(skiatest::Reporter* reporter) {
71 test_add_rrect(reporter, rectx, radii);
72 test_add_rrect(reporter, recty, radii);
231 static void make_path_crbugskia2820(SkPath* path, skiatest::Reporter* reporter) {
244 static void test_path_crbugskia2820(skiatest::Reporter* reporter) {
246 make_path_crbugskia2820(&path, reporter);
286 static void test_path_to_region(skiatest::Reporter* reporter) {
312 static void test_path_close_issue1474(skiatest::Reporter* reporter) {
325 REPORTER_ASSERT(reporter, 50 == last.fX);
326 REPORTER_ASSERT(reporter, 50 == last.fY);
336 REPORTER_ASSERT(reporter, 75 == last.fX);
337 REPORTER_ASSERT(reporter, 75 == last.fY);
347 REPORTER_ASSERT(reporter, 85 == last.fX);
348 REPORTER_ASSERT(reporter, 85 == last.fY);
358 REPORTER_ASSERT(reporter, 95 == last.fX);
359 REPORTER_ASSERT(reporter, 95 == last.fY);
362 static void test_gen_id(skiatest::Reporter* reporter) {
364 REPORTER_ASSERT(reporter, a.getGenerationID() == b.getGenerationID());
368 REPORTER_ASSERT(reporter, z != b.getGenerationID());
371 REPORTER_ASSERT(reporter, a.getGenerationID() == b.getGenerationID());
375 REPORTER_ASSERT(reporter, z != y);
379 REPORTER_ASSERT(reporter, x != y && x != z);
382 REPORTER_ASSERT(reporter, b.getGenerationID() == y && a.getGenerationID() == x);
385 REPORTER_ASSERT(reporter, b.getGenerationID() == x);
388 REPORTER_ASSERT(reporter, c.getGenerationID() == x);
392 REPORTER_ASSERT(reporter, b.getGenerationID() == x);
393 REPORTER_ASSERT(reporter, a.getGenerationID() == x);
394 REPORTER_ASSERT(reporter, w != x);
404 REPORTER_ASSERT(reporter, (v == w) == kExpectGenIDToIgnoreFill);
407 REPORTER_ASSERT(reporter, v != c.getGenerationID());
540 static void test_tiny_path_convexity(skiatest::Reporter* reporter, const char* pathBug,
553 REPORTER_ASSERT(reporter, smallConvex == largeConvex);
556 static void test_crbug_493450(skiatest::Reporter* reporter) {
564 test_tiny_path_convexity(reporter, reducedCase, 100, 100, 100000);
571 test_tiny_path_convexity(reporter, originalFiddleData, 280081.4116670522f, 93268.04618493588f,
575 static void test_crbug_495894(skiatest::Reporter* reporter) {
597 test_tiny_path_convexity(reporter, originalFiddleData, 22682.240000000005f,7819.72220766405f,
612 static void test_addrect(skiatest::Reporter* reporter) {
616 REPORTER_ASSERT(reporter, path.isRect(nullptr));
621 REPORTER_ASSERT(reporter, !path.isRect(nullptr));
626 REPORTER_ASSERT(reporter, !path.isRect(nullptr));
631 REPORTER_ASSERT(reporter, !path.isRect(nullptr));
636 REPORTER_ASSERT(reporter, !path.isRect(nullptr));
640 static void test_addrect_isfinite(skiatest::Reporter* reporter) {
644 REPORTER_ASSERT(reporter, path.isFinite());
648 REPORTER_ASSERT(reporter, !path.isFinite());
651 REPORTER_ASSERT(reporter, !path.isFinite());
654 REPORTER_ASSERT(reporter, path.isFinite());
657 REPORTER_ASSERT(reporter, path.isFinite());
699 static void dump_if_ne(skiatest::Reporter* reporter, const SkRect& expected, const SkRect& bounds) {
701 ERRORF(reporter, "path.getBounds() returned [%g %g %g %g], but expected [%g %g %g %g]",
707 static void test_bounds_crbug_513799(skiatest::Reporter* reporter) {
712 REPORTER_ASSERT(reporter, SkRect::MakeLTRB(0, 0, 0, 0) == path.getBounds());
715 REPORTER_ASSERT(reporter, SkRect::MakeLTRB(-5, -8, -5, -8) == path.getBounds());
718 REPORTER_ASSERT(reporter, SkRect::MakeLTRB(-5, -8, 3, 4) == path.getBounds());
721 REPORTER_ASSERT(reporter, SkRect::MakeLTRB(-5, -8, 3, 4) == path.getBounds());
723 dump_if_ne(reporter, SkRect::MakeLTRB(0, 0, 0, 0), path.getBounds());
726 dump_if_ne(reporter, SkRect::MakeLTRB(-5, -8, -5, -8), path.getBounds());
729 dump_if_ne(reporter, SkRect::MakeLTRB(-5, -8, 3, 4), path.getBounds());
732 dump_if_ne(reporter, SkRect::MakeLTRB(-5, -8, 3, 4), path.getBounds());
737 static void test_fuzz_crbug_627414(skiatest::Reporter* reporter) {
764 static void test_isfinite_after_transform(skiatest::Reporter* reporter) {
777 REPORTER_ASSERT(reporter, path.getBounds().isFinite());
778 REPORTER_ASSERT(reporter, !path.getBounds().isEmpty());
781 REPORTER_ASSERT(reporter, path.getBounds().isEmpty());
786 REPORTER_ASSERT(reporter, !path.isFinite());
787 REPORTER_ASSERT(reporter, path.getBounds().isEmpty());
834 static void test_arb_round_rect_is_convex(skiatest::Reporter* reporter) {
853 REPORTER_ASSERT(reporter, temp.isConvex());
861 static void test_arb_zero_rad_round_rect_is_rect(skiatest::Reporter* reporter) {
881 REPORTER_ASSERT(reporter, temp.isRect(&result));
882 REPORTER_ASSERT(reporter, r == result);
886 static void test_rect_isfinite(skiatest::Reporter* reporter) {
893 REPORTER_ASSERT(reporter, r.isFinite());
895 REPORTER_ASSERT(reporter, !r.isFinite());
897 REPORTER_ASSERT(reporter, !r.isFinite());
906 REPORTER_ASSERT(reporter, isFine);
907 REPORTER_ASSERT(reporter, !r.isEmpty());
911 REPORTER_ASSERT(reporter, !isFine);
912 REPORTER_ASSERT(reporter, r.isEmpty());
916 REPORTER_ASSERT(reporter, !isFine);
917 REPORTER_ASSERT(reporter, r.isEmpty());
920 static void test_path_isfinite(skiatest::Reporter* reporter) {
926 REPORTER_ASSERT(reporter, path.isFinite());
929 REPORTER_ASSERT(reporter, path.isFinite());
933 REPORTER_ASSERT(reporter, path.isFinite());
937 REPORTER_ASSERT(reporter, !path.isFinite());
941 REPORTER_ASSERT(reporter, !path.isFinite());
944 static void test_isfinite(skiatest::Reporter* reporter) {
945 test_rect_isfinite(reporter);
946 test_path_isfinite(reporter);
949 static void test_islastcontourclosed(skiatest::Reporter* reporter) {
951 REPORTER_ASSERT(reporter, !path.isLastContourClosed());
953 REPORTER_ASSERT(reporter, !path.isLastContourClosed());
955 REPORTER_ASSERT(reporter, path.isLastContourClosed());
957 REPORTER_ASSERT(reporter, !path.isLastContourClosed());
959 REPORTER_ASSERT(reporter, !path.isLastContourClosed());
961 REPORTER_ASSERT(reporter, path.isLastContourClosed());
963 REPORTER_ASSERT(reporter, !path.isLastContourClosed());
973 static void test_poly(skiatest::Reporter* reporter, const SkPath& path,
980 REPORTER_ASSERT(reporter, firstTime);
981 REPORTER_ASSERT(reporter, pts[0] == srcPts[0]);
986 REPORTER_ASSERT(reporter, !firstTime);
987 REPORTER_ASSERT(reporter, pts[1] == srcPts[0]);
991 REPORTER_ASSERT(reporter, false, "unexpected quad verb");
994 REPORTER_ASSERT(reporter, false, "unexpected conic verb");
997 REPORTER_ASSERT(reporter, false, "unexpected cubic verb");
1000 REPORTER_ASSERT(reporter, !firstTime);
1001 REPORTER_ASSERT(reporter, !foundClose);
1002 REPORTER_ASSERT(reporter, expectClose);
1007 REPORTER_ASSERT(reporter, foundClose == expectClose);
1010 static void test_addPoly(skiatest::Reporter* reporter) {
1023 test_poly(reporter, path, pts, SkToBool(doClose));
1028 static void test_strokerec(skiatest::Reporter* reporter) {
1030 REPORTER_ASSERT(reporter, rec.isFillStyle());
1033 REPORTER_ASSERT(reporter, rec.isHairlineStyle());
1036 REPORTER_ASSERT(reporter, SkStrokeRec::kStroke_Style == rec.getStyle());
1039 REPORTER_ASSERT(reporter, SkStrokeRec::kStrokeAndFill_Style == rec.getStyle());
1042 REPORTER_ASSERT(reporter, SkStrokeRec::kHairline_Style == rec.getStyle());
1045 REPORTER_ASSERT(reporter, SkStrokeRec::kFill_Style == rec.getStyle());
1053 static void check_direction(skiatest::Reporter* reporter, const SkPath& path,
1063 REPORTER_ASSERT(reporter, dir == expected);
1067 static void test_direction(skiatest::Reporter* reporter) {
1070 REPORTER_ASSERT(reporter,
1084 REPORTER_ASSERT(reporter, valid);
1085 REPORTER_ASSERT(reporter,
1101 REPORTER_ASSERT(reporter, valid);
1102 check_direction(reporter, path, SkPathFirstDirection::kCW);
1117 REPORTER_ASSERT(reporter, valid);
1118 check_direction(reporter, path, SkPathFirstDirection::kCCW);
1126 check_direction(reporter, path, SkPathFirstDirection::kCW);
1131 check_direction(reporter, path, SkPathFirstDirection::kCCW);
1139 check_direction(reporter, path, SkPathFirstDirection::kCCW);
1144 check_direction(reporter, path, SkPathFirstDirection::kCW);
1150 REPORTER_ASSERT(reporter, path.isConvex());
1151 check_direction(reporter, path, SkPathFirstDirection::kCCW);
1162 static void test_bounds(skiatest::Reporter* reporter) {
1176 REPORTER_ASSERT(reporter, path0.getBounds() == path1.getBounds());
1215 static void check_close(skiatest::Reporter* reporter, const SkPath& path) {
1231 REPORTER_ASSERT(reporter, mv == pts[0]);
1240 REPORTER_ASSERT(reporter, !i || nMT == nCL);
1244 static void test_close(skiatest::Reporter* reporter) {
1248 check_close(reporter, closePt);
1252 check_close(reporter, openPt);
1255 check_close(reporter, empty);
1257 check_close(reporter, empty);
1261 check_close(reporter, rect);
1263 check_close(reporter, rect);
1267 check_close(reporter, quad);
1269 check_close(reporter, quad);
1274 check_close(reporter, cubic);
1276 check_close(reporter, cubic);
1281 check_close(reporter, line);
1283 check_close(reporter, line);
1289 check_close(reporter, rect2);
1291 check_close(reporter, rect2);
1297 check_close(reporter, oval3);
1299 check_close(reporter, oval3);
1306 check_close(reporter, moves);
1311 static void check_convexity(skiatest::Reporter* reporter, const SkPath& path,
1316 REPORTER_ASSERT(reporter, convexity == expectedConvexity);
1319 static void test_path_crbug389050(skiatest::Reporter* reporter) {
1327 check_direction(reporter, tinyConvexPolygon, SkPathFirstDirection::kCW);
1335 check_direction(reporter, platTriangle, SkPathFirstDirection::kCW);
1343 check_direction(reporter, platTriangle, SkPathFirstDirection::kCW);
1346 static void test_convexity2(skiatest::Reporter* reporter) {
1350 check_convexity(reporter, pt, true);
1351 check_direction(reporter, pt, SkPathFirstDirection::kUnknown);
1357 check_convexity(reporter, line, true);
1358 check_direction(reporter, line, SkPathFirstDirection::kUnknown);
1365 check_convexity(reporter, triLeft, true);
1366 check_direction(reporter, triLeft, SkPathFirstDirection::kCW);
1373 check_convexity(reporter, triRight, true);
1374 check_direction(reporter, triRight, SkPathFirstDirection::kCCW);
1382 check_convexity(reporter, square, true);
1383 check_direction(reporter, square, SkPathFirstDirection::kCW);
1399 check_convexity(reporter, redundantSquare, true);
1400 check_direction(reporter, redundantSquare, SkPathFirstDirection::kCW);
1416 check_convexity(reporter, bowTie, false);
1417 check_direction(reporter, bowTie, kDontCheckDir);
1428 check_convexity(reporter, spiral, false);
1429 check_direction(reporter, spiral, kDontCheckDir);
1438 check_convexity(reporter, dent, false);
1439 check_direction(reporter, dent, SkPathFirstDirection::kCW);
1455 check_convexity(reporter, strokedSin, false);
1456 check_direction(reporter, strokedSin, kDontCheckDir);
1466 check_convexity(reporter, degenerateConcave, false);
1467 check_direction(reporter, degenerateConcave, SkPathFirstDirection::kUnknown);
1481 check_convexity(reporter, badFirstVector, false);
1496 check_convexity(reporter, falseBackEdge, false);
1499 static void test_convexity_doubleback(skiatest::Reporter* reporter) {
1502 check_convexity(reporter, doubleback, true);
1504 check_convexity(reporter, doubleback, true);
1507 check_convexity(reporter, doubleback, true);
1509 check_convexity(reporter, doubleback, true);
1511 check_convexity(reporter, doubleback, true);
1514 check_convexity(reporter, doubleback, true);
1517 check_convexity(reporter, doubleback, true);
1519 check_convexity(reporter, doubleback, true);
1522 static void check_convex_bounds(skiatest::Reporter* reporter, const SkPath& p,
1524 REPORTER_ASSERT(reporter, p.isConvex());
1525 REPORTER_ASSERT(reporter, p.getBounds() == bounds);
1528 REPORTER_ASSERT(reporter, p2.isConvex());
1529 REPORTER_ASSERT(reporter, p2.getBounds() == bounds);
1533 REPORTER_ASSERT(reporter, other.isConvex());
1534 REPORTER_ASSERT(reporter, other.getBounds() == bounds);
1556 static void test_convexity(skiatest::Reporter* reporter) {
1559 check_convexity(reporter, path, true);
1561 check_convexity(reporter, path, true);
1563 check_convexity(reporter, path, false);
1567 check_convexity(reporter, path, true);
1568 REPORTER_ASSERT(reporter, SkPathPriv::ComputeFirstDirection(path) == SkPathFirstDirection::kCCW);
1572 check_convexity(reporter, path, true);
1573 REPORTER_ASSERT(reporter, SkPathPriv::ComputeFirstDirection(path) == SkPathFirstDirection::kCW);
1577 check_convexity(reporter, path, true);
1597 check_convexity(reporter, path, gRec[i].fExpectedIsConvex);
1598 check_direction(reporter, path, gRec[i].fExpectedDirection);
1605 REPORTER_ASSERT(reporter, (gRec[i].fExpectedDirection == SkPathFirstDirection::kUnknown)
1607 REPORTER_ASSERT(reporter, !foundDir || gRec[i].fExpectedDirection == dir);
1608 check_convexity(reporter, copy, gRec[i].fExpectedIsConvex);
1610 REPORTER_ASSERT(reporter, gRec[i].fExpectedIsConvex == path.isConvex());
1611 check_direction(reporter, path, gRec[i].fExpectedDirection);
1659 REPORTER_ASSERT(reporter,
1682 check_convexity(reporter, path, true);
1686 REPORTER_ASSERT(reporter, !copy.isConvex());
1716 check_convexity(reporter, path, true);
1720 REPORTER_ASSERT(reporter, !copy.isConvex());
1733 check_convexity(reporter, path, false);
1737 static void test_isLine(skiatest::Reporter* reporter) {
1742 REPORTER_ASSERT(reporter, !path.isLine(nullptr));
1747 REPORTER_ASSERT(reporter, !path.isLine(pts));
1749 REPORTER_ASSERT(reporter, pts[0].equals(value, value));
1750 REPORTER_ASSERT(reporter, pts[1].equals(value, value));
1754 REPORTER_ASSERT(reporter, value != moveX && value != moveY);
1757 REPORTER_ASSERT(reporter, !path.isLine(nullptr));
1758 REPORTER_ASSERT(reporter, !path.isLine(pts));
1760 REPORTER_ASSERT(reporter, pts[0].equals(value, value));
1761 REPORTER_ASSERT(reporter, pts[1].equals(value, value));
1765 REPORTER_ASSERT(reporter, value != lineX && value != lineY);
1768 REPORTER_ASSERT(reporter, path.isLine(nullptr));
1770 REPORTER_ASSERT(reporter, !pts[0].equals(moveX, moveY));
1771 REPORTER_ASSERT(reporter, !pts[1].equals(lineX, lineY));
1772 REPORTER_ASSERT(reporter, path.isLine(pts));
1773 REPORTER_ASSERT(reporter, pts[0].equals(moveX, moveY));
1774 REPORTER_ASSERT(reporter, pts[1].equals(lineX, lineY));
1777 REPORTER_ASSERT(reporter, !path.isLine(nullptr));
1778 REPORTER_ASSERT(reporter, !path.isLine(pts));
1779 REPORTER_ASSERT(reporter, pts[0].equals(moveX, moveY));
1780 REPORTER_ASSERT(reporter, pts[1].equals(lineX, lineY));
1784 REPORTER_ASSERT(reporter, !path.isLine(nullptr));
1787 static void test_conservativelyContains(skiatest::Reporter* reporter) {
1892 REPORTER_ASSERT(reporter, kQueries[q].fInRect ==
1897 REPORTER_ASSERT(reporter, kQueries[q].fInCircle ==
1902 REPORTER_ASSERT(reporter, kQueries[q].fInRR ==
1914 REPORTER_ASSERT(reporter, kQueries[q].fInCubicRR ==
1926 REPORTER_ASSERT(reporter, !path.conservativelyContainsRect(qRect));
1937 REPORTER_ASSERT(reporter, path.conservativelyContainsRect(SkRect::MakeXYWH(SkIntToScalar(50), 0,
1941 REPORTER_ASSERT(reporter, !path.conservativelyContainsRect(
1947 REPORTER_ASSERT(reporter, !path.conservativelyContainsRect(SkRect::MakeXYWH(SkIntToScalar(-10),
1953 REPORTER_ASSERT(reporter, !path.conservativelyContainsRect(SkRect::MakeXYWH(SkIntToScalar(10),
1961 REPORTER_ASSERT(reporter, path.conservativelyContainsRect(SkRect::MakeXYWH(SkIntToScalar(50), 0,
1973 REPORTER_ASSERT(reporter, path.conservativelyContainsRect(
1986 REPORTER_ASSERT(reporter, path.conservativelyContainsRect(SkRect::MakeXYWH(SkIntToScalar(50), 0,
2000 REPORTER_ASSERT(reporter, !path.conservativelyContainsRect(
2007 REPORTER_ASSERT(reporter, !path.conservativelyContainsRect(SkRect::MakeXYWH(0, 0, 1, 1)));
2013 REPORTER_ASSERT(reporter, !path.conservativelyContainsRect(SkRect::MakeWH(1,1)));
2014 REPORTER_ASSERT(reporter, !path.conservativelyContainsRect(SkRect::MakeWH(0,0)));
2017 static void test_isRect_open_close(skiatest::Reporter* reporter) {
2024 REPORTER_ASSERT(reporter, path.isRect(nullptr, &isClosed, nullptr));
2025 REPORTER_ASSERT(reporter, isClosed);
2030 static void test_isRect(skiatest::Reporter* reporter) {
2031 test_isRect_open_close(reporter);
2128 REPORTER_ASSERT(reporter, tests[testIndex].fIsRect == path.isRect(nullptr));
2137 REPORTER_ASSERT(reporter, cheapDirection != SkPathFirstDirection::kUnknown);
2138 REPORTER_ASSERT(reporter, path.isRect(&computed, &isClosed, &direction));
2139 REPORTER_ASSERT(reporter, expected == computed);
2140 REPORTER_ASSERT(reporter, isClosed == tests[testIndex].fClose);
2141 REPORTER_ASSERT(reporter, SkPathPriv::AsFirstDirection(direction) == cheapDirection);
2149 REPORTER_ASSERT(reporter, !path.isRect(&computed, &isClosed, &direction));
2150 REPORTER_ASSERT(reporter, computed.fLeft == 123 && computed.fTop == 456);
2151 REPORTER_ASSERT(reporter, computed.fRight == 789 && computed.fBottom == 1011);
2152 REPORTER_ASSERT(reporter, isClosed == c);
2153 REPORTER_ASSERT(reporter, direction == d);
2166 REPORTER_ASSERT(reporter, !path1.isRect(nullptr));
2178 REPORTER_ASSERT(reporter, !path1.isRect(nullptr));
2187 REPORTER_ASSERT(reporter, !path1.isRect(nullptr));
2199 REPORTER_ASSERT(reporter, !path1.isRect(nullptr));
2211 REPORTER_ASSERT(reporter, !path1.isRect(nullptr));
2214 static void check_simple_rect(skiatest::Reporter* reporter, const SkPath& path, bool isClosed,
2220 REPORTER_ASSERT(reporter, SkPathPriv::IsSimpleRect(path, false, &r, &d, &s) == isClosed);
2221 REPORTER_ASSERT(reporter, SkPathPriv::IsSimpleRect(path, true, &r, &d, &s));
2222 REPORTER_ASSERT(reporter, r == rect);
2223 REPORTER_ASSERT(reporter, d == dir);
2224 REPORTER_ASSERT(reporter, s == start);
2227 static void test_is_closed_rect(skiatest::Reporter* reporter) {
2239 check_simple_rect(reporter, path, true, testRect, dir, start);
2241 check_simple_rect(reporter, path, true, testRect, dir, start);
2244 REPORTER_ASSERT(reporter, !SkPathPriv::IsSimpleRect(path2, false, &r, &d, &s));
2245 REPORTER_ASSERT(reporter, !SkPathPriv::IsSimpleRect(path2, true, &r, &d, &s));
2248 REPORTER_ASSERT(reporter, !SkPathPriv::IsSimpleRect(path2, false, &r, &d, &s));
2249 REPORTER_ASSERT(reporter, !SkPathPriv::IsSimpleRect(path2, true, &r, &d, &s));
2252 REPORTER_ASSERT(reporter, !SkPathPriv::IsSimpleRect(path2, false, &r, &d, &s));
2253 REPORTER_ASSERT(reporter, !SkPathPriv::IsSimpleRect(path2, true, &r, &d, &s));
2271 REPORTER_ASSERT(reporter, !SkPathPriv::IsSimpleRect(path2, false, &r, &d, &s));
2272 REPORTER_ASSERT(reporter, !SkPathPriv::IsSimpleRect(path2, true, &r, &d, &s));
2275 check_simple_rect(reporter, path2, false, testRect, dir, start);
2278 check_simple_rect(reporter, path2, true, testRect, dir, start);
2282 REPORTER_ASSERT(reporter, !SkPathPriv::IsSimpleRect(path2, false, &r, &d, &s));
2283 REPORTER_ASSERT(reporter, !SkPathPriv::IsSimpleRect(path2, true, &r, &d, &s));
2288 REPORTER_ASSERT(reporter, !SkPathPriv::IsSimpleRect(path2, false, &r, &d, &s));
2289 REPORTER_ASSERT(reporter, !SkPathPriv::IsSimpleRect(path2, true, &r, &d, &s));
2294 REPORTER_ASSERT(reporter, !SkPathPriv::IsSimpleRect(path2, false, &r, &d, &s));
2295 REPORTER_ASSERT(reporter, !SkPathPriv::IsSimpleRect(path2, true, &r, &d, &s));
2306 check_simple_rect(reporter, path2, true, testRect, swapDir, kXSwapStarts[start]);
2311 check_simple_rect(reporter, path2, true, testRect, swapDir, kYSwapStarts[start]);
2324 REPORTER_ASSERT(reporter, !SkPathPriv::IsSimpleRect(path, false, &rect, &dir, &start));
2325 REPORTER_ASSERT(reporter, !SkPathPriv::IsSimpleRect(path, true, &rect, &dir, &start));
2333 REPORTER_ASSERT(reporter, !SkPathPriv::IsSimpleRect(path, false, &rect, &dir, &start));
2334 REPORTER_ASSERT(reporter, !SkPathPriv::IsSimpleRect(path, true, &rect, &dir, &start));
2342 REPORTER_ASSERT(reporter, !SkPathPriv::IsSimpleRect(path, false, &rect, &dir, &start));
2343 REPORTER_ASSERT(reporter, !SkPathPriv::IsSimpleRect(path, true, &rect, &dir, &start));
2351 REPORTER_ASSERT(reporter, !SkPathPriv::IsSimpleRect(path, false, &rect, &dir, &start));
2352 REPORTER_ASSERT(reporter, !SkPathPriv::IsSimpleRect(path, true, &rect, &dir, &start));
2356 static void test_isNestedFillRects(skiatest::Reporter* reporter) {
2440 REPORTER_ASSERT(reporter,
2456 REPORTER_ASSERT(reporter, SkPathPriv::IsNestedFillRects(path, computed, computedDirs));
2457 REPORTER_ASSERT(reporter, expected[0] == computed[0]);
2458 REPORTER_ASSERT(reporter, expected[1] == computed[1]);
2459 REPORTER_ASSERT(reporter, expectedDirs[0] == SkPathPriv::AsFirstDirection(computedDirs[0]));
2460 REPORTER_ASSERT(reporter, expectedDirs[1] == SkPathPriv::AsFirstDirection(computedDirs[1]));
2478 REPORTER_ASSERT(reporter, !SkPathPriv::IsNestedFillRects(path1, nullptr));
2496 REPORTER_ASSERT(reporter, !SkPathPriv::IsNestedFillRects(path1, nullptr));
2511 REPORTER_ASSERT(reporter, !SkPathPriv::IsNestedFillRects(path1, nullptr));
2529 REPORTER_ASSERT(reporter, !SkPathPriv::IsNestedFillRects(path1, nullptr));
2547 REPORTER_ASSERT(reporter, !SkPathPriv::IsNestedFillRects(path1, nullptr));
2553 REPORTER_ASSERT(reporter, !SkPathPriv::IsNestedFillRects(path1, nullptr));
2568 REPORTER_ASSERT(reporter, SkPathPriv::IsNestedFillRects(path, nullptr));
2577 REPORTER_ASSERT(reporter, SkPathPriv::IsNestedFillRects(dst, nullptr));
2580 static void write_and_read_back(skiatest::Reporter* reporter,
2590 REPORTER_ASSERT(reporter, readBack != p);
2592 REPORTER_ASSERT(reporter, readBack == p);
2594 REPORTER_ASSERT(reporter, SkPathPriv::GetConvexityOrUnknown(readBack) ==
2600 REPORTER_ASSERT(reporter, readBack.isOval(nullptr) == p.isOval(nullptr));
2603 REPORTER_ASSERT(reporter, oval0 == oval1);
2604 REPORTER_ASSERT(reporter, dir0 == dir1);
2605 REPORTER_ASSERT(reporter, start0 == start1);
2607 REPORTER_ASSERT(reporter, readBack.isRRect(nullptr) == p.isRRect(nullptr));
2611 REPORTER_ASSERT(reporter, rrect0 == rrect1);
2612 REPORTER_ASSERT(reporter, dir0 == dir1);
2613 REPORTER_ASSERT(reporter, start0 == start1);
2618 REPORTER_ASSERT(reporter, origBounds == readBackBounds);
2621 static void test_flattening(skiatest::Reporter* reporter) {
2635 write_and_read_back(reporter, p);
2642 REPORTER_ASSERT(reporter, size1 == size2);
2646 REPORTER_ASSERT(reporter, size1 == size3);
2647 REPORTER_ASSERT(reporter, p == p2);
2650 REPORTER_ASSERT(reporter, !size3);
2654 REPORTER_ASSERT(reporter, tooShort.isEmpty());
2658 REPORTER_ASSERT(reporter, size1 == size3);
2659 REPORTER_ASSERT(reporter, memcmp(buffer, buffer2, size1) == 0);
2667 write_and_read_back(reporter, oval);
2671 static void test_transform(skiatest::Reporter* reporter) {
2700 REPORTER_ASSERT(reporter, p == p1);
2713 REPORTER_ASSERT(reporter, kPtCount == count);
2716 REPORTER_ASSERT(reporter, newPt == pts1[i]);
2729 REPORTER_ASSERT(reporter, matrix.invert(&matrix));
2733 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(pBounds.fLeft, p1Bounds.fLeft));
2734 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(pBounds.fTop, p1Bounds.fTop));
2735 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(pBounds.fRight, p1Bounds.fRight));
2736 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(pBounds.fBottom, p1Bounds.fBottom));
2749 REPORTER_ASSERT(reporter, SkPathPriv::ComputeFirstDirection(p1) == SkPathFirstDirection::kCW);
2761 REPORTER_ASSERT(reporter, SkPathPriv::ComputeFirstDirection(p1) == SkPathFirstDirection::kCCW);
2771 REPORTER_ASSERT(reporter, SkPathPriv::ComputeFirstDirection(p1) == SkPathFirstDirection::kUnknown);
2781 REPORTER_ASSERT(reporter, id1 != id2);
2785 REPORTER_ASSERT(reporter, id1 == p1.getGenerationID());
2786 REPORTER_ASSERT(reporter, id2 != p2.getGenerationID());
2788 REPORTER_ASSERT(reporter, id1 != p1.getGenerationID());
2792 static void test_zero_length_paths(skiatest::Reporter* reporter) {
2852 REPORTER_ASSERT(reporter, valid);
2853 REPORTER_ASSERT(reporter, !p.isEmpty());
2854 REPORTER_ASSERT(reporter, gZeroLengthTests[i].numResultPts == (size_t)p.countPoints());
2855 REPORTER_ASSERT(reporter, gZeroLengthTests[i].resultBound == p.getBounds());
2856 REPORTER_ASSERT(reporter, gZeroLengthTests[i].numResultVerbs == (size_t)p.getVerbs(verbs, SK_ARRAY_COUNT(verbs)));
2858 REPORTER_ASSERT(reporter, gZeroLengthTests[i].resultVerbs[j] == verbs[j]);
2870 static void test_segment_masks(skiatest::Reporter* reporter) {
2875 REPORTER_ASSERT(reporter, SkPath::kQuad_SegmentMask == p.getSegmentMasks());
2876 REPORTER_ASSERT(reporter, !p.isEmpty());
2878 REPORTER_ASSERT(reporter, p2.getSegmentMasks() == p.getSegmentMasks());
2880 REPORTER_ASSERT(reporter, kCurveSegmentMask == p.getSegmentMasks());
2881 REPORTER_ASSERT(reporter, !p.isEmpty());
2883 REPORTER_ASSERT(reporter, p2.getSegmentMasks() == p.getSegmentMasks());
2888 REPORTER_ASSERT(reporter, SkPath::kCubic_SegmentMask == p.getSegmentMasks());
2890 REPORTER_ASSERT(reporter, p2.getSegmentMasks() == p.getSegmentMasks());
2892 REPORTER_ASSERT(reporter, !p.isEmpty());
2895 static void test_iter(skiatest::Reporter* reporter) {
2901 REPORTER_ASSERT(reporter, noPathIter.next(pts) == SkPath::kDone_Verb);
2905 REPORTER_ASSERT(reporter, noPathIter.next(pts) == SkPath::kDone_Verb);
2909 REPORTER_ASSERT(reporter, noPathIter.next(pts) == SkPath::kDone_Verb);
2913 REPORTER_ASSERT(reporter, iter.next(pts) == SkPath::kDone_Verb);
2917 REPORTER_ASSERT(reporter, iter.next(pts) == SkPath::kDone_Verb);
2957 REPORTER_ASSERT(reporter, valid);
2961 REPORTER_ASSERT(reporter, iter.next(pts) == gIterTests[i].resultVerbs[j]);
2963 REPORTER_ASSERT(reporter, pts[k] == gIterTests[i].resultPts[l++]);
2966 REPORTER_ASSERT(reporter, j == (int)gIterTests[i].numResultVerbs);
2971 REPORTER_ASSERT(reporter, !iter.isClosedContour());
2975 REPORTER_ASSERT(reporter, iter.isClosedContour());
2978 REPORTER_ASSERT(reporter, !iter.isClosedContour());
2981 REPORTER_ASSERT(reporter, iter.isClosedContour());
2985 REPORTER_ASSERT(reporter, !iter.isClosedContour());
2996 REPORTER_ASSERT(reporter, SkPath::kClose_Verb == iter.next(pts));
3003 REPORTER_ASSERT(reporter, SkPath::kQuad_Verb == iter.next(pts));
3009 REPORTER_ASSERT(reporter, SkPath::kConic_Verb == iter.next(pts));
3015 REPORTER_ASSERT(reporter, SkPath::kCubic_Verb == iter.next(pts));
3020 REPORTER_ASSERT(reporter, SkPath::kCubic_Verb == iter.next(pts));
3032 REPORTER_ASSERT(reporter, SkPath::kMove_Verb == iter.next(pts));
3033 REPORTER_ASSERT(reporter, SkPath::kLine_Verb == iter.next(pts));
3035 REPORTER_ASSERT(reporter, SkPath::kLine_Verb == iter.next(pts));
3036 REPORTER_ASSERT(reporter, SkPath::kConic_Verb == iter.next(pts));
3037 REPORTER_ASSERT(reporter, SK_ScalarRoot2Over2 == iter.conicWeight());
3040 static void test_range_iter(skiatest::Reporter* reporter) {
3045 REPORTER_ASSERT(reporter, iterate.begin() == iterate.end());
3053 REPORTER_ASSERT(reporter, verb == SkPathVerb::kMove);
3054 REPORTER_ASSERT(reporter, pts[0].fX == SK_Scalar1);
3055 REPORTER_ASSERT(reporter, pts[0].fY == 0);
3057 REPORTER_ASSERT(reporter, iter == iterate.end());
3066 REPORTER_ASSERT(reporter, verb == SkPathVerb::kMove);
3067 REPORTER_ASSERT(reporter, pts[0].fX == SK_Scalar1);
3068 REPORTER_ASSERT(reporter, pts[0].fY == 0);
3072 REPORTER_ASSERT(reporter, verb == SkPathVerb::kMove);
3073 REPORTER_ASSERT(reporter, pts[0].fX == SK_Scalar1*2);
3074 REPORTER_ASSERT(reporter, pts[0].fY == SK_Scalar1);
3078 REPORTER_ASSERT(reporter, verb == SkPathVerb::kMove);
3079 REPORTER_ASSERT(reporter, pts[0].fX == SK_Scalar1*3);
3080 REPORTER_ASSERT(reporter, pts[0].fY == SK_Scalar1*2);
3082 REPORTER_ASSERT(reporter, iter == iterate.end());
3088 REPORTER_ASSERT(reporter, iterate.begin() == iterate.end());
3105 REPORTER_ASSERT(reporter, verb == SkPathVerb::kMove);
3106 REPORTER_ASSERT(reporter, pts[0].fX == SK_Scalar1);
3107 REPORTER_ASSERT(reporter, pts[0].fY == 0);
3111 REPORTER_ASSERT(reporter, verb == SkPathVerb::kClose);
3115 REPORTER_ASSERT(reporter, verb == SkPathVerb::kMove);
3116 REPORTER_ASSERT(reporter, pts[0].fX == SK_Scalar1*2);
3117 REPORTER_ASSERT(reporter, pts[0].fY == SK_Scalar1);
3121 REPORTER_ASSERT(reporter, verb == SkPathVerb::kClose);
3125 REPORTER_ASSERT(reporter, verb == SkPathVerb::kMove);
3126 REPORTER_ASSERT(reporter, pts[0].fX == SK_Scalar1*3);
3127 REPORTER_ASSERT(reporter, pts[0].fY == SK_Scalar1*2);
3131 REPORTER_ASSERT(reporter, verb == SkPathVerb::kMove);
3132 REPORTER_ASSERT(reporter, pts[0].fX == SK_Scalar1*4);
3133 REPORTER_ASSERT(reporter, pts[0].fY == SK_Scalar1*3);
3137 REPORTER_ASSERT(reporter, verb == SkPathVerb::kClose);
3139 REPORTER_ASSERT(reporter, iter == iterate.end());
3245 REPORTER_ASSERT(reporter, verb == expectedVerbs[numIterVerbs]);
3249 REPORTER_ASSERT(reporter, numIterPts < numPoints);
3250 REPORTER_ASSERT(reporter, pts[0] == expectedPts[numIterPts]);
3255 REPORTER_ASSERT(reporter, numIterPts < numPoints + 1);
3256 REPORTER_ASSERT(reporter, pts[0] == lastPt);
3257 REPORTER_ASSERT(reporter, pts[1] == expectedPts[numIterPts]);
3263 REPORTER_ASSERT(reporter, numIterPts < numPoints + 2);
3264 REPORTER_ASSERT(reporter, pts[0] == lastPt);
3265 REPORTER_ASSERT(reporter, pts[1] == expectedPts[numIterPts]);
3266 REPORTER_ASSERT(reporter, pts[2] == expectedPts[numIterPts + 1]);
3271 REPORTER_ASSERT(reporter, numIterPts < numPoints + 3);
3272 REPORTER_ASSERT(reporter, pts[0] == lastPt);
3273 REPORTER_ASSERT(reporter, pts[1] == expectedPts[numIterPts]);
3274 REPORTER_ASSERT(reporter, pts[2] == expectedPts[numIterPts + 1]);
3275 REPORTER_ASSERT(reporter, pts[3] == expectedPts[numIterPts + 2]);
3286 REPORTER_ASSERT(reporter, numIterPts == numPoints);
3287 REPORTER_ASSERT(reporter, numIterVerbs == numVerbs);
3291 static void check_for_circle(skiatest::Reporter* reporter,
3296 REPORTER_ASSERT(reporter, path.isOval(&rect) == expectedCircle);
3300 REPORTER_ASSERT(reporter, rect.height() == rect.width());
3301 REPORTER_ASSERT(reporter, SkPathPriv::AsFirstDirection(isOvalDir) == expectedDir);
3304 REPORTER_ASSERT(reporter, path == tmpPath);
3306 REPORTER_ASSERT(reporter, SkPathPriv::ComputeFirstDirection(path) == expectedDir);
3309 static void test_circle_skew(skiatest::Reporter* reporter,
3321 REPORTER_ASSERT(reporter, SkPathFirstDirection::kCW == dir);
3324 check_for_circle(reporter, tmp, false, dir);
3327 static void test_circle_translate(skiatest::Reporter* reporter,
3336 check_for_circle(reporter, tmp, true, dir);
3344 check_for_circle(reporter, tmp, true, dir);
3347 static void test_circle_rotate(skiatest::Reporter* reporter,
3360 check_for_circle(reporter, tmp, true, dir);
3362 check_for_circle(reporter, tmp, false, dir);
3367 static void test_circle_mirror_x(skiatest::Reporter* reporter,
3378 REPORTER_ASSERT(reporter, SkPathFirstDirection::kCCW == dir);
3381 check_for_circle(reporter, tmp, true, dir);
3384 static void test_circle_mirror_y(skiatest::Reporter* reporter,
3396 REPORTER_ASSERT(reporter, SkPathFirstDirection::kCCW == dir);
3400 check_for_circle(reporter, tmp, true, dir);
3403 static void test_circle_mirror_xy(skiatest::Reporter* reporter,
3413 check_for_circle(reporter, tmp, true, dir);
3416 static void test_circle_with_direction(skiatest::Reporter* reporter,
3424 check_for_circle(reporter, path, true, dir);
3425 test_circle_rotate(reporter, path, dir);
3426 test_circle_translate(reporter, path, dir);
3427 test_circle_skew(reporter, path, dir);
3428 test_circle_mirror_x(reporter, path, dir);
3429 test_circle_mirror_y(reporter, path, dir);
3430 test_circle_mirror_xy(reporter, path, dir);
3437 check_for_circle(reporter, path, true, dir);
3438 test_circle_rotate(reporter, path, dir);
3439 test_circle_translate(reporter, path, dir);
3440 test_circle_skew(reporter, path, dir);
3441 test_circle_mirror_x(reporter, path, dir);
3442 test_circle_mirror_y(reporter, path, dir);
3443 test_circle_mirror_xy(reporter, path, dir);
3449 test_circle_rotate(reporter, path, dir);
3450 test_circle_translate(reporter, path, dir);
3451 test_circle_skew(reporter, path, dir);
3452 test_circle_mirror_x(reporter, path, dir);
3453 test_circle_mirror_y(reporter, path, dir);
3454 test_circle_mirror_xy(reporter, path, dir);
3458 static void test_circle_with_add_paths(skiatest::Reporter* reporter) {
3480 check_for_circle(reporter, path, false, SkPathPriv::AsFirstDirection(kCircleDir));
3486 check_for_circle(reporter, path, true, SkPathPriv::AsFirstDirection(kCircleDir));
3491 check_for_circle(reporter, path, false, SkPathPriv::AsFirstDirection(kCircleDirOpposite));
3494 static void test_circle(skiatest::Reporter* reporter) {
3495 test_circle_with_direction(reporter, SkPathDirection::kCW);
3496 test_circle_with_direction(reporter, SkPathDirection::kCCW);
3502 check_for_circle(reporter, path, false, SkPathFirstDirection::kCW);
3508 check_for_circle(reporter, path, false, SkPathFirstDirection::kCW);
3514 check_for_circle(reporter, path, false, SkPathFirstDirection::kCW);
3516 test_circle_with_add_paths(reporter);
3521 REPORTER_ASSERT(reporter, path.isEmpty());
3524 static void test_oval(skiatest::Reporter* reporter) {
3535 REPORTER_ASSERT(reporter, path.isOval(nullptr));
3542 REPORTER_ASSERT(reporter, SkPathPriv::IsOval(tmp, nullptr, &dir, &start));
3543 REPORTER_ASSERT(reporter, 2 == start);
3544 REPORTER_ASSERT(reporter, SkPathDirection::kCW == dir);
3551 REPORTER_ASSERT(reporter, !tmp.isOval(nullptr));
3558 REPORTER_ASSERT(reporter, !tmp.isOval(nullptr));
3562 REPORTER_ASSERT(reporter, !tmp.isOval(nullptr));
3568 REPORTER_ASSERT(reporter, !tmp.isOval(nullptr));
3575 REPORTER_ASSERT(reporter, path.isOval(nullptr));
3582 REPORTER_ASSERT(reporter, SkPathPriv::IsOval(path, nullptr, &dir, &start));
3583 REPORTER_ASSERT(reporter, SkPathDirection::kCW == dir);
3584 REPORTER_ASSERT(reporter, 1 == start);
3587 static void test_empty(skiatest::Reporter* reporter, const SkPath& p) {
3590 REPORTER_ASSERT(reporter, p.isEmpty());
3591 REPORTER_ASSERT(reporter, 0 == p.countPoints());
3592 REPORTER_ASSERT(reporter, 0 == p.countVerbs());
3593 REPORTER_ASSERT(reporter, 0 == p.getSegmentMasks());
3594 REPORTER_ASSERT(reporter, p.isConvex());
3595 REPORTER_ASSERT(reporter, p.getFillType() == SkPathFillType::kWinding);
3596 REPORTER_ASSERT(reporter, !p.isInverseFillType());
3597 REPORTER_ASSERT(reporter, p == empty);
3598 REPORTER_ASSERT(reporter, !(p != empty));
3601 static void test_rrect_is_convex(skiatest::Reporter* reporter, SkPath* path,
3603 REPORTER_ASSERT(reporter, path->isConvex());
3604 REPORTER_ASSERT(reporter,
3607 REPORTER_ASSERT(reporter, path->isConvex());
3611 static void test_rrect_convexity_is_unknown(skiatest::Reporter* reporter, SkPath* path,
3613 REPORTER_ASSERT(reporter, path->isConvex());
3614 REPORTER_ASSERT(reporter,
3617 REPORTER_ASSERT(reporter, !path->isConvex());
3621 static void test_rrect(skiatest::Reporter* reporter) {
3628 test_rrect_is_convex(reporter, &p, SkPathDirection::kCW);
3630 test_rrect_is_convex(reporter, &p, SkPathDirection::kCCW);
3632 test_rrect_is_convex(reporter, &p, SkPathDirection::kCW);
3634 test_rrect_is_convex(reporter, &p, SkPathDirection::kCCW);
3636 test_rrect_is_convex(reporter, &p, SkPathDirection::kCW);
3638 test_rrect_is_convex(reporter, &p, SkPathDirection::kCCW);
3644 test_rrect_is_convex(reporter, &p, SkPathDirection::kCW);
3649 REPORTER_ASSERT(reporter, p.isRect(&returnedRect));
3650 REPORTER_ASSERT(reporter, returnedRect == r);
3651 test_rrect_is_convex(reporter, &p, SkPathDirection::kCW);
3657 REPORTER_ASSERT(reporter, p.isRect(nullptr, &closed, &dir));
3658 REPORTER_ASSERT(reporter, closed);
3659 REPORTER_ASSERT(reporter, SkPathDirection::kCW == dir);
3660 test_rrect_is_convex(reporter, &p, SkPathDirection::kCW);
3663 REPORTER_ASSERT(reporter, !p.isConvex());
3667 REPORTER_ASSERT(reporter, !p.isConvex());
3674 REPORTER_ASSERT(reporter, !p.isEmpty());
3679 test_rrect_convexity_is_unknown(reporter, &p, SkPathDirection::kCW);
3684 REPORTER_ASSERT(reporter, rr.isEmpty());
3687 static void test_arc(skiatest::Reporter* reporter) {
3690 REPORTER_ASSERT(reporter, emptyOval.isEmpty());
3692 REPORTER_ASSERT(reporter, p.isEmpty());
3696 REPORTER_ASSERT(reporter, p.isEmpty());
3701 REPORTER_ASSERT(reporter, p == cwOval);
3706 REPORTER_ASSERT(reporter, p == ccwOval);
3712 REPORTER_ASSERT(reporter, p.isConvex());
3713 REPORTER_ASSERT(reporter, SkPathPriv::ComputeFirstDirection(p) == SkPathFirstDirection::kCW);
3715 REPORTER_ASSERT(reporter, p.isConvex());
3743 static void check_oval_arc(skiatest::Reporter* reporter, SkScalar start, SkScalar sweep,
3749 REPORTER_ASSERT(reporter, isOval);
3752 REPORTER_ASSERT(reporter, path == recreatedPath);
3753 REPORTER_ASSERT(reporter, oval_start_index_to_angle(s) == canonical_start_angle(start));
3754 REPORTER_ASSERT(reporter, (SkPathDirection::kCW == d) == (sweep > 0.f));
3757 static void test_arc_ovals(skiatest::Reporter* reporter) {
3766 check_oval_arc(reporter, start, sweep, path);
3768 REPORTER_ASSERT(reporter, !path.isOval(nullptr));
3776 check_oval_arc(reporter, start, sweep, path);
3782 static void check_move(skiatest::Reporter* reporter, SkPathPriv::RangeIter* iter,
3785 REPORTER_ASSERT(reporter, v == SkPathVerb::kMove);
3786 REPORTER_ASSERT(reporter, pts[0].fX == x0);
3787 REPORTER_ASSERT(reporter, pts[0].fY == y0);
3790 static void check_line(skiatest::Reporter* reporter, SkPathPriv::RangeIter* iter,
3793 REPORTER_ASSERT(reporter, v == SkPathVerb::kLine);
3794 REPORTER_ASSERT(reporter, pts[1].fX == x1);
3795 REPORTER_ASSERT(reporter, pts[1].fY == y1);
3798 static void check_quad(skiatest::Reporter* reporter, SkPathPriv::RangeIter* iter,
3801 REPORTER_ASSERT(reporter, v == SkPathVerb::kQuad);
3802 REPORTER_ASSERT(reporter, pts[1].fX == x1);
3803 REPORTER_ASSERT(reporter, pts[1].fY == y1);
3804 REPORTER_ASSERT(reporter, pts[2].fX == x2);
3805 REPORTER_ASSERT(reporter, pts[2].fY == y2);
3808 static void check_close(skiatest::Reporter* reporter, SkPathPriv::RangeIter* iter) {
3810 REPORTER_ASSERT(reporter, v == SkPathVerb::kClose);
3813 static void check_done(skiatest::Reporter* reporter, SkPath* p, SkPathPriv::RangeIter* iter) {
3814 REPORTER_ASSERT(reporter, *iter == SkPathPriv::Iterate(*p).end());
3817 static void check_done_and_reset(skiatest::Reporter* reporter, SkPath* p,
3819 check_done(reporter, p, iter);
3823 static void check_path_is_move_and_reset(skiatest::Reporter* reporter, SkPath* p,
3826 check_move(reporter, &iter, x0, y0);
3827 check_done_and_reset(reporter, p, &iter);
3830 static void check_path_is_line_and_reset(skiatest::Reporter* reporter, SkPath* p,
3833 check_move(reporter, &iter, 0, 0);
3834 check_line(reporter, &iter, x1, y1);
3835 check_done_and_reset(reporter, p, &iter);
3838 static void check_path_is_line(skiatest::Reporter* reporter, SkPath* p,
3841 check_move(reporter, &iter, 0, 0);
3842 check_line(reporter, &iter, x1, y1);
3843 check_done(reporter, p, &iter);
3846 static void check_path_is_line_pair_and_reset(skiatest::Reporter* reporter, SkPath* p,
3849 check_move(reporter, &iter, 0, 0);
3850 check_line(reporter, &iter, x1, y1);
3851 check_line(reporter, &iter, x2, y2);
3852 check_done_and_reset(reporter, p, &iter);
3855 static void check_path_is_quad_and_reset(skiatest::Reporter* reporter, SkPath* p,
3858 check_move(reporter, &iter, 0, 0);
3859 check_quad(reporter, &iter, x1, y1, x2, y2);
3860 check_done_and_reset(reporter, p, &iter);
3870 static void test_rMoveTo(skiatest::Reporter* reporter) {
3877 check_move(reporter, &iter, 10, 11);
3878 check_line(reporter, &iter, 20, 21);
3879 check_close(reporter, &iter);
3880 check_move(reporter, &iter, 10 + 30, 11 + 31);
3881 check_done_and_reset(reporter, &p, &iter);
3887 check_move(reporter, &iter, 10, 11);
3888 check_line(reporter, &iter, 20, 21);
3889 check_move(reporter, &iter, 20 + 30, 21 + 31);
3890 check_done_and_reset(reporter, &p, &iter);
3894 check_move(reporter, &iter, 30, 31);
3895 check_done_and_reset(reporter, &p, &iter);
3898 static void test_arcTo(skiatest::Reporter* reporter) {
3901 check_path_is_line_and_reset(reporter, &p, 0, 0);
3903 check_path_is_line_and_reset(reporter, &p, 1, 2);
3905 check_path_is_line_and_reset(reporter, &p, 1, 2);
3907 check_path_is_line_and_reset(reporter, &p, 1, 2);
3910 REPORTER_ASSERT(reporter, p.getLastPt(&pt) && pt.fX == 1 && pt.fY == 1);
3913 REPORTER_ASSERT(reporter, p.getLastPt(&pt) && pt.fX == 1 && pt.fY == -1);
3917 check_path_is_move_and_reset(reporter, &p, oval.fRight, oval.centerY());
3919 check_path_is_move_and_reset(reporter, &p, oval.fRight, oval.centerY());
3921 check_path_is_move_and_reset(reporter, &p, oval.fRight, oval.centerY());
3923 check_path_is_move_and_reset(reporter, &p, oval.fRight, oval.centerY());
3927 REPORTER_ASSERT(reporter, nearly_equal(p.getBounds(), oval));
3933 REPORTER_ASSERT(reporter, nearly_equal(p.getBounds(), oval));
3940 REPORTER_ASSERT(reporter, p.isEmpty());
3945 REPORTER_ASSERT(reporter, p.isEmpty());
3957 REPORTER_ASSERT(reporter, p.getPoint(0) == p.getPoint(n - 1));
3962 static void test_addPath(skiatest::Reporter* reporter) {
3973 REPORTER_ASSERT(reporter, p.getBounds() == expected);
3977 REPORTER_ASSERT(reporter, p.getBounds() == reverseExpected);
3980 static void test_addPathMode(skiatest::Reporter* reporter, bool explicitMoveTo, bool extend) {
3993 REPORTER_ASSERT(reporter, verbcount == 4);
3994 REPORTER_ASSERT(reporter, verbs[0] == SkPath::kMove_Verb);
3995 REPORTER_ASSERT(reporter, verbs[1] == SkPath::kLine_Verb);
3996 REPORTER_ASSERT(reporter, verbs[2] == (extend ? SkPath::kLine_Verb : SkPath::kMove_Verb));
3997 REPORTER_ASSERT(reporter, verbs[3] == SkPath::kLine_Verb);
4000 static void test_extendClosedPath(skiatest::Reporter* reporter) {
4011 REPORTER_ASSERT(reporter, verbcount == 7);
4012 REPORTER_ASSERT(reporter, verbs[0] == SkPath::kMove_Verb);
4013 REPORTER_ASSERT(reporter, verbs[1] == SkPath::kLine_Verb);
4014 REPORTER_ASSERT(reporter, verbs[2] == SkPath::kLine_Verb);
4015 REPORTER_ASSERT(reporter, verbs[3] == SkPath::kClose_Verb);
4016 REPORTER_ASSERT(reporter, verbs[4] == SkPath::kMove_Verb);
4017 REPORTER_ASSERT(reporter, verbs[5] == SkPath::kLine_Verb);
4018 REPORTER_ASSERT(reporter, verbs[6] == SkPath::kLine_Verb);
4021 REPORTER_ASSERT(reporter, p.getLastPt(&pt));
4022 REPORTER_ASSERT(reporter, pt == SkPoint::Make(2, 3));
4023 REPORTER_ASSERT(reporter, p.getPoint(3) == SkPoint::Make(1, 1));
4026 static void test_addEmptyPath(skiatest::Reporter* reporter, SkPath::AddPathMode mode) {
4032 REPORTER_ASSERT(reporter, q == p);
4035 REPORTER_ASSERT(reporter, q == p);
4039 REPORTER_ASSERT(reporter, q.isEmpty());
4042 static void test_conicTo_special_case(skiatest::Reporter* reporter) {
4045 check_path_is_line_and_reset(reporter, &p, 3, 4);
4047 check_path_is_line_pair_and_reset(reporter, &p, 1, 2, 3, 4);
4049 check_path_is_quad_and_reset(reporter, &p, 1, 2, 3, 4);
4052 static void test_get_point(skiatest::Reporter* reporter) {
4055 REPORTER_ASSERT(reporter, pt == SkPoint::Make(0, 0));
4056 REPORTER_ASSERT(reporter, !p.getLastPt(nullptr));
4057 REPORTER_ASSERT(reporter, !p.getLastPt(&pt) && pt == SkPoint::Make(0, 0));
4060 REPORTER_ASSERT(reporter, pt == SkPoint::Make(10, 10));
4061 REPORTER_ASSERT(reporter, p.getLastPt(nullptr));
4063 REPORTER_ASSERT(reporter, p.getLastPt(&pt) && pt == SkPoint::Make(20, 20));
4066 static void test_contains(skiatest::Reporter* reporter) {
4079 REPORTER_ASSERT(reporter, p.contains(0, 0));
4081 REPORTER_ASSERT(reporter, !p.contains(0, 0));
4086 REPORTER_ASSERT(reporter, p.contains(6, 4));
4087 REPORTER_ASSERT(reporter, p.contains(5, 6));
4088 REPORTER_ASSERT(reporter, p.contains(7, 6));
4090 REPORTER_ASSERT(reporter, !p.contains(4, 0));
4091 REPORTER_ASSERT(reporter, !p.contains(0, 4));
4092 REPORTER_ASSERT(reporter, !p.contains(4, 10));
4093 REPORTER_ASSERT(reporter, !p.contains(10, 4));
4095 REPORTER_ASSERT(reporter, !p.contains(5, 7));
4096 REPORTER_ASSERT(reporter, p.contains(6, 7));
4097 REPORTER_ASSERT(reporter, !p.contains(7, 7));
4103 REPORTER_ASSERT(reporter, p.contains(4, 6));
4104 REPORTER_ASSERT(reporter, p.contains(6, 5));
4105 REPORTER_ASSERT(reporter, p.contains(6, 7));
4107 REPORTER_ASSERT(reporter, !p.contains(7, 5));
4108 REPORTER_ASSERT(reporter, p.contains(7, 6));
4109 REPORTER_ASSERT(reporter, !p.contains(7, 7));
4116 REPORTER_ASSERT(reporter, p.contains(4, 4));
4117 REPORTER_ASSERT(reporter, p.contains(8, 4));
4118 REPORTER_ASSERT(reporter, p.contains(8, 8));
4119 REPORTER_ASSERT(reporter, p.contains(4, 8));
4125 REPORTER_ASSERT(reporter, p.contains(5, 6));
4126 REPORTER_ASSERT(reporter, p.contains(4, 8));
4127 REPORTER_ASSERT(reporter, p.contains(3, 6));
4133 REPORTER_ASSERT(reporter, p.contains(2, 5));
4134 REPORTER_ASSERT(reporter, p.contains(2, 7));
4135 REPORTER_ASSERT(reporter, p.contains(4, 6));
4144 REPORTER_ASSERT(reporter, !p.contains(1, 2));
4145 REPORTER_ASSERT(reporter, !p.contains(3, 2));
4146 REPORTER_ASSERT(reporter, !p.contains(4, 0));
4147 REPORTER_ASSERT(reporter, p.contains(4, 4));
4155 REPORTER_ASSERT(reporter, p.contains(5, 6));
4156 REPORTER_ASSERT(reporter, !p.contains(6, 5));
4158 REPORTER_ASSERT(reporter, p.contains(5, 5));
4159 REPORTER_ASSERT(reporter, p.contains(5, 8));
4160 REPORTER_ASSERT(reporter, p.contains(4, 5));
4162 REPORTER_ASSERT(reporter, p.contains(4, 4));
4163 REPORTER_ASSERT(reporter, p.contains(8, 8));
4164 REPORTER_ASSERT(reporter, p.contains(4, 8));
4172 REPORTER_ASSERT(reporter, p.contains(5, 6));
4173 REPORTER_ASSERT(reporter, !p.contains(6, 5));
4178 REPORTER_ASSERT(reporter, p.contains(halfway.fX, halfway.fY));
4188 REPORTER_ASSERT(reporter, p.contains(5, 6));
4189 REPORTER_ASSERT(reporter, !p.contains(6, 5));
4194 REPORTER_ASSERT(reporter, p.contains(halfway.fX, halfway.fY));
4197 REPORTER_ASSERT(reporter, p.contains(4, 4));
4198 REPORTER_ASSERT(reporter, p.contains(8, 8));
4199 REPORTER_ASSERT(reporter, p.contains(4, 8));
4210 REPORTER_ASSERT(reporter, p.contains(5.5f, 5.5f));
4211 REPORTER_ASSERT(reporter, !p.contains(4.5f, 5.5f));
4214 REPORTER_ASSERT(reporter, p.contains(halfway.fX, halfway.fY));
4216 REPORTER_ASSERT(reporter, p.contains(halfway.fX, halfway.fY));
4218 REPORTER_ASSERT(reporter, p.contains(pts[i].fX, pts[i].fY));
4219 REPORTER_ASSERT(reporter, p.contains(pts[i + 3].fX, pts[i + 3].fY));
4220 REPORTER_ASSERT(reporter, p.contains(pts[i + 6].fX, pts[i + 6].fY));
4231 static void TestPathRef(skiatest::Reporter* reporter) {
4240 REPORTER_ASSERT(reporter, kRepeatCnt == pathRef->countVerbs());
4241 REPORTER_ASSERT(reporter, kRepeatCnt == pathRef->countPoints());
4242 REPORTER_ASSERT(reporter, 0 == pathRef->getSegmentMasks());
4244 REPORTER_ASSERT(reporter, SkPath::kMove_Verb == pathRef->atVerb(i));
4251 REPORTER_ASSERT(reporter, kRepeatCnt == pathRef->countVerbs());
4252 REPORTER_ASSERT(reporter, kRepeatCnt == pathRef->countPoints());
4253 REPORTER_ASSERT(reporter, SkPath::kLine_SegmentMask == pathRef->getSegmentMasks());
4255 REPORTER_ASSERT(reporter, SkPath::kLine_Verb == pathRef->atVerb(i));
4262 REPORTER_ASSERT(reporter, kRepeatCnt == pathRef->countVerbs());
4263 REPORTER_ASSERT(reporter, 2*kRepeatCnt == pathRef->countPoints());
4264 REPORTER_ASSERT(reporter, SkPath::kQuad_SegmentMask == pathRef->getSegmentMasks());
4266 REPORTER_ASSERT(reporter, SkPath::kQuad_Verb == pathRef->atVerb(i));
4274 REPORTER_ASSERT(reporter, kRepeatCnt == pathRef->countVerbs());
4275 REPORTER_ASSERT(reporter, 2*kRepeatCnt == pathRef->countPoints());
4276 REPORTER_ASSERT(reporter, kRepeatCnt == pathRef->countWeights());
4277 REPORTER_ASSERT(reporter, SkPath::kConic_SegmentMask == pathRef->getSegmentMasks());
4278 REPORTER_ASSERT(reporter, weights);
4280 REPORTER_ASSERT(reporter, SkPath::kConic_Verb == pathRef->atVerb(i));
4287 REPORTER_ASSERT(reporter, kRepeatCnt == pathRef->countVerbs());
4288 REPORTER_ASSERT(reporter, 3*kRepeatCnt == pathRef->countPoints());
4289 REPORTER_ASSERT(reporter, SkPath::kCubic_SegmentMask == pathRef->getSegmentMasks());
4291 REPORTER_ASSERT(reporter, SkPath::kCubic_Verb == pathRef->atVerb(i));
4298 static void test_operatorEqual(skiatest::Reporter* reporter) {
4301 REPORTER_ASSERT(reporter, a == a);
4302 REPORTER_ASSERT(reporter, a == b);
4304 REPORTER_ASSERT(reporter, a != b);
4306 REPORTER_ASSERT(reporter, a == b);
4308 REPORTER_ASSERT(reporter, a != b);
4310 REPORTER_ASSERT(reporter, a == b);
4313 REPORTER_ASSERT(reporter, a != b);
4316 REPORTER_ASSERT(reporter, a == b);
4319 static void compare_dump(skiatest::Reporter* reporter, const SkPath& path, bool dumpAsHex,
4324 REPORTER_ASSERT(reporter, data->size() == strlen(str));
4326 REPORTER_ASSERT(reporter, !memcmp(data->data(), str, strlen(str)));
4328 REPORTER_ASSERT(reporter, data->data() == nullptr || !memcmp(data->data(), str, strlen(str)));
4332 static void test_dump(skiatest::Reporter* reporter) {
4334 compare_dump(reporter, p, false, "path.setFillType(SkPathFillType::kWinding);\n");
4337 compare_dump(reporter, p, false, "path.setFillType(SkPathFillType::kWinding);\n"
4344 compare_dump(reporter, p, false, "path.setFillType(SkPathFillType::kEvenOdd);\n"
4351 compare_dump(reporter, p, false, "path.setFillType(SkPathFillType::kInverseWinding);\n"
4358 compare_dump(reporter, p, false, "path.setFillType(SkPathFillType::kInverseEvenOdd);\n"
4365 compare_dump(reporter, p, true,
4372 compare_dump(reporter, p, false, "path.setFillType(SkPathFillType::kWinding);\n"
4397 static void TestPathTo(skiatest::Reporter* reporter) {
4401 check_path_is_line(reporter, &p, 4, 4);
4404 check_path_is_line(reporter, &p, 4, 4);
4412 REPORTER_ASSERT(reporter, p.getBounds() == reverseExpected);
4415 static void TestPathrefListeners(skiatest::Reporter* reporter) {
4424 REPORTER_ASSERT(reporter, !changed);
4426 REPORTER_ASSERT(reporter, changed);
4430 REPORTER_ASSERT(reporter, !changed);
4432 REPORTER_ASSERT(reporter, changed);
4436 REPORTER_ASSERT(reporter, !changed);
4438 REPORTER_ASSERT(reporter, changed);
4444 REPORTER_ASSERT(reporter, !changed);
4446 REPORTER_ASSERT(reporter, changed);
4453 REPORTER_ASSERT(reporter, !changed);
4457 REPORTER_ASSERT(reporter, changed);
4465 REPORTER_ASSERT(reporter, !changed);
4468 REPORTER_ASSERT(reporter, changed);
4472 static void test_crbug_629455(skiatest::Reporter* reporter) {
4483 static void test_fuzz_crbug_662952(skiatest::Reporter* reporter) {
4522 static void test_fuzz_crbug_662730(skiatest::Reporter* reporter) {
4755 static void test_interp(skiatest::Reporter* reporter) {
4757 REPORTER_ASSERT(reporter, p1.isInterpolatable(p2));
4758 REPORTER_ASSERT(reporter, p1.interpolate(p2, 0, &out));
4759 REPORTER_ASSERT(reporter, p1 == out);
4760 REPORTER_ASSERT(reporter, p1.interpolate(p2, 1, &out));
4761 REPORTER_ASSERT(reporter, p1 == out);
4764 REPORTER_ASSERT(reporter, !p1.isInterpolatable(p2));
4765 REPORTER_ASSERT(reporter, !p1.interpolate(p2, 1, &out));
4768 REPORTER_ASSERT(reporter, p1.isInterpolatable(p2));
4769 REPORTER_ASSERT(reporter, p1.interpolate(p2, 0, &out));
4770 REPORTER_ASSERT(reporter, p2 == out);
4771 REPORTER_ASSERT(reporter, p1.interpolate(p2, 1, &out));
4772 REPORTER_ASSERT(reporter, p1 == out);
4773 REPORTER_ASSERT(reporter, p1.interpolate(p2, 0.5f, &out));
4774 REPORTER_ASSERT(reporter, out.getBounds() == SkRect::MakeLTRB(3, 1, 4, 2));
4781 REPORTER_ASSERT(reporter, p1.isInterpolatable(p2));
4782 REPORTER_ASSERT(reporter, p1.interpolate(p2, 0.5f, &out));
4783 REPORTER_ASSERT(reporter, out.getBounds() == SkRect::MakeLTRB(4, 3, 6, 5));
4787 REPORTER_ASSERT(reporter, !p1.isInterpolatable(p2));
4791 REPORTER_ASSERT(reporter, !p1.isInterpolatable(p2));
4794 DEF_TEST(PathInterp, reporter) {
4795 test_interp(reporter);
4799 DEF_TEST(PathBigCubic, reporter) {
4810 DEF_TEST(PathContains, reporter) {
4811 test_contains(reporter);
4814 DEF_TEST(Paths, reporter) {
4818 test_crbug_629455(reporter);
4819 test_fuzz_crbug_627414(reporter);
4821 test_fuzz_crbug_662952(reporter);
4822 test_fuzz_crbug_662730(reporter);
4836 test_empty(reporter, p);
4838 REPORTER_ASSERT(reporter, p.getBounds().isEmpty());
4850 check_convex_bounds(reporter, p, bounds);
4852 REPORTER_ASSERT(reporter,
4854 REPORTER_ASSERT(reporter, !p.isEmpty());
4857 test_empty(reporter, p);
4860 check_convex_bounds(reporter, p, bounds);
4861 REPORTER_ASSERT(reporter, !p.isEmpty());
4864 test_empty(reporter, p);
4867 check_convex_bounds(reporter, p, bounds);
4869 REPORTER_ASSERT(reporter, SkPath::kLine_SegmentMask == p.getSegmentMasks());
4870 REPORTER_ASSERT(reporter, !p.isEmpty());
4872 REPORTER_ASSERT(reporter, p != empty);
4873 REPORTER_ASSERT(reporter, !(p == empty));
4876 REPORTER_ASSERT(reporter, p.getPoints(nullptr, 0) == 4);
4877 REPORTER_ASSERT(reporter, p.getVerbs(nullptr, 0) == 5);
4880 REPORTER_ASSERT(reporter, count == 4);
4884 REPORTER_ASSERT(reporter, SkPath::kMove_Verb == verbs[0]);
4885 REPORTER_ASSERT(reporter, SkPath::kLine_Verb == verbs[1]);
4886 REPORTER_ASSERT(reporter, SkPath::kLine_Verb == verbs[2]);
4887 REPORTER_ASSERT(reporter, SkPath::kLine_Verb == verbs[3]);
4888 REPORTER_ASSERT(reporter, SkPath::kClose_Verb == verbs[4]);
4889 REPORTER_ASSERT(reporter, 0xff == verbs[5]);
4891 REPORTER_ASSERT(reporter, bounds == bounds2);
4895 REPORTER_ASSERT(reporter, bounds == p.getBounds());
4897 REPORTER_ASSERT(reporter, p.isRect(nullptr));
4899 REPORTER_ASSERT(reporter, p.isRect(&bounds2));
4900 REPORTER_ASSERT(reporter, bounds == bounds2);
4905 REPORTER_ASSERT(reporter, !p.isRect(nullptr));
4913 REPORTER_ASSERT(reporter, p.isRect(&r));
4914 REPORTER_ASSERT(reporter, r == bounds);
4917 REPORTER_ASSERT(reporter, p.isRect(&r));
4918 REPORTER_ASSERT(reporter, r == bounds);
4921 test_operatorEqual(reporter);
4922 test_isLine(reporter);
4923 test_isRect(reporter);
4924 test_is_closed_rect(reporter);
4925 test_isNestedFillRects(reporter);
4926 test_zero_length_paths(reporter);
4927 test_direction(reporter);
4928 test_convexity(reporter);
4929 test_convexity2(reporter);
4930 test_convexity_doubleback(reporter);
4931 test_conservativelyContains(reporter);
4932 test_close(reporter);
4933 test_segment_masks(reporter);
4934 test_flattening(reporter);
4935 test_transform(reporter);
4936 test_bounds(reporter);
4937 test_iter(reporter);
4938 test_range_iter(reporter);
4939 test_circle(reporter);
4940 test_oval(reporter);
4941 test_strokerec(reporter);
4942 test_addPoly(reporter);
4943 test_isfinite(reporter);
4944 test_isfinite_after_transform(reporter);
4945 test_islastcontourclosed(reporter);
4946 test_arb_round_rect_is_convex(reporter);
4947 test_arb_zero_rad_round_rect_is_rect(reporter);
4948 test_addrect(reporter);
4949 test_addrect_isfinite(reporter);
4953 test_crbug_493450(reporter);
4954 test_crbug_495894(reporter);
4958 test_gen_id(reporter);
4959 test_path_close_issue1474(reporter);
4960 test_path_to_region(reporter);
4961 test_rrect(reporter);
4962 test_rMoveTo(reporter);
4963 test_arc(reporter);
4964 test_arc_ovals(reporter);
4965 test_arcTo(reporter);
4966 test_addPath(reporter);
4967 test_addPathMode(reporter, false, false);
4968 test_addPathMode(reporter, true, false);
4969 test_addPathMode(reporter, false, true);
4970 test_addPathMode(reporter, true, true);
4971 test_extendClosedPath(reporter);
4972 test_addEmptyPath(reporter, SkPath::kExtend_AddPathMode);
4973 test_addEmptyPath(reporter, SkPath::kAppend_AddPathMode);
4974 test_conicTo_special_case(reporter);
4975 test_get_point(reporter);
4976 test_contains(reporter);
4977 PathTest_Private::TestPathTo(reporter);
4978 PathRefTest_Private::TestPathRef(reporter);
4979 PathTest_Private::TestPathrefListeners(reporter);
4980 test_dump(reporter);
4981 test_path_crbug389050(reporter);
4982 test_path_crbugskia2820(reporter);
4984 test_skbug_3469(reporter);
4985 test_skbug_3239(reporter);
4986 test_bounds_crbug_513799(reporter);
4990 DEF_TEST(conservatively_contains_rect, reporter) {
5032 DEF_TEST(path_tight_bounds, reporter) {
5045 REPORTER_ASSERT(reporter, bounds.contains(tight));
5049 REPORTER_ASSERT(reporter, nearly_equal(tight, tight2));
5077 DEF_TEST(PathRefSerialization, reporter) {
5085 REPORTER_ASSERT(reporter, path.countPoints() == numPoints);
5086 REPORTER_ASSERT(reporter, path.countVerbs() == numVerbs);
5094 REPORTER_ASSERT(reporter, readBack != path);
5096 REPORTER_ASSERT(reporter, bytesRead == bytesWritten);
5097 REPORTER_ASSERT(reporter, readBack == path);
5105 REPORTER_ASSERT(reporter, !bytesRead);
5109 DEF_TEST(NonFinitePathIteration, reporter) {
5113 REPORTER_ASSERT(reporter, iterate.begin() == iterate.end());
5116 DEF_TEST(AndroidArc, reporter) {
5147 DEF_TEST(HugeGeometry, reporter) {
5179 DEF_TEST(ClipPath_nonfinite, reporter) {
5183 REPORTER_ASSERT(reporter, !canvas->isClipEmpty());
5201 REPORTER_ASSERT(reporter, canvas->isClipEmpty() == !path.isInverseFillType());
5207 REPORTER_ASSERT(reporter, !canvas->isClipEmpty());
5211 DEF_TEST(Path_isRect, reporter) {
5245 REPORTER_ASSERT(reporter, path.isRect(&rect));
5248 REPORTER_ASSERT(reporter, rect == compare);
5252 REPORTER_ASSERT(reporter, !path.isRect(&rect));
5256 REPORTER_ASSERT(reporter, path.isRect(&rect));
5258 REPORTER_ASSERT(reporter, rect == compare);
5264 REPORTER_ASSERT(reporter, path.isRect(&rect));
5266 REPORTER_ASSERT(reporter, rect == compare);
5275 REPORTER_ASSERT(reporter, !path.isRect(&rect));
5281 REPORTER_ASSERT(reporter, path.isRect(&rect));
5283 REPORTER_ASSERT(reporter, rect == compare);
5287 REPORTER_ASSERT(reporter, !path.isRect(&rect));
5296 REPORTER_ASSERT(reporter, !path.isRect(&rect));
5304 REPORTER_ASSERT(reporter, path.isRect(&rect));
5306 REPORTER_ASSERT(reporter, rect == compare);
5313 REPORTER_ASSERT(reporter, !path.isRect(&rect));
5320 REPORTER_ASSERT(reporter, path.isRect(&rect));
5322 REPORTER_ASSERT(reporter, rect == compare);
5328 REPORTER_ASSERT(reporter, !path.isRect(&rect));
5334 REPORTER_ASSERT(reporter, !path.isRect(&rect));
5342 REPORTER_ASSERT(reporter, path.isRect(&rect));
5344 REPORTER_ASSERT(reporter, rect == compare);
5351 REPORTER_ASSERT(reporter, path.isRect(&rect));
5353 REPORTER_ASSERT(reporter, rect == compare);
5360 REPORTER_ASSERT(reporter, path.isRect(&rect));
5362 REPORTER_ASSERT(reporter, rect == compare);
5366 DEF_TEST(Path_self_add, reporter) {
5403 DEF_TEST(triangle_onehalf, reporter) {
5414 DEF_TEST(triangle_big, reporter) {
5444 DEF_TEST(Path_shrinkToFit, reporter) {
5453 REPORTER_ASSERT(reporter, shared_path == unique_path);
5454 REPORTER_ASSERT(reporter, shared_path == copy);
5459 REPORTER_ASSERT(reporter, sID == cID);
5466 REPORTER_ASSERT(reporter, shared_path == unique_path);
5467 REPORTER_ASSERT(reporter, shared_path == copy);
5471 REPORTER_ASSERT(reporter, uID == unique_path.getGenerationID());
5473 REPORTER_ASSERT(reporter, cID == copy.getGenerationID());
5478 REPORTER_ASSERT(reporter, sID != shared_path.getGenerationID());
5482 REPORTER_ASSERT(reporter, before >= after);
5486 REPORTER_ASSERT(reporter, after == after2);
5548 void survive(SkPath* path, const Xforms& x, bool isAxisAligned, skiatest::Reporter* reporter,
5550 REPORTER_ASSERT(reporter, isa_proc(*path));
5552 REPORTER_ASSERT(reporter, path->isConvex());
5558 REPORTER_ASSERT(reporter, isa_proc(path2));
5559 REPORTER_ASSERT(reporter, SkPathPriv::GetConvexityOrUnknown(path2) == SkPathConvexity::kConvex);
5564 REPORTER_ASSERT(reporter, isa_proc(path2));
5565 REPORTER_ASSERT(reporter, SkPathPriv::GetConvexityOrUnknown(path2) == SkPathConvexity::kConvex);
5566 REPORTER_ASSERT(reporter, isa_proc(*path));
5567 REPORTER_ASSERT(reporter, SkPathPriv::GetConvexityOrUnknown(*path) == SkPathConvexity::kConvex);
5572 REPORTER_ASSERT(reporter, isa_proc(path2));
5573 REPORTER_ASSERT(reporter, isa_proc(*path));
5574 REPORTER_ASSERT(reporter, conditional_convex(path2, isAxisAligned));
5575 REPORTER_ASSERT(reporter, conditional_convex(*path, isAxisAligned));
5580 REPORTER_ASSERT(reporter, isa_proc(path2));
5581 REPORTER_ASSERT(reporter, isa_proc(*path));
5582 REPORTER_ASSERT(reporter, conditional_convex(path2, isAxisAligned));
5583 REPORTER_ASSERT(reporter, conditional_convex(*path, isAxisAligned));
5590 REPORTER_ASSERT(reporter, SkPathPriv::GetConvexityOrUnknown(path2) != SkPathConvexity::kConvex);
5591 REPORTER_ASSERT(reporter, SkPathPriv::GetConvexityOrUnknown(*path) != SkPathConvexity::kConvex);
5594 REPORTER_ASSERT(reporter, !isa_proc(path2));
5595 REPORTER_ASSERT(reporter, !isa_proc(*path));
5671 static void assert_points(skiatest::Reporter* reporter,
5679 REPORTER_ASSERT(reporter, i == list.size());
5682 REPORTER_ASSERT(reporter, pts[0] == expected[i]);
5686 REPORTER_ASSERT(reporter, pts[1] == expected[i]);
5695 static void test_addRect_and_trailing_lineTo(skiatest::Reporter* reporter) {
5716 assert_points(reporter, path, {
5722 assert_points(reporter, path, {
5736 assert_points(reporter, path, {
5757 static void test_addPath_and_injected_moveTo(skiatest::Reporter* reporter) {
5763 auto test_before_after_lineto = [reporter](SkPath& path,
5767 REPORTER_ASSERT(reporter, p == expectedLastPt);
5773 REPORTER_ASSERT(reporter, p == expectedMoveTo); // this was injected by lineTo()
5776 REPORTER_ASSERT(reporter, p == newLineTo);