static void TestGeometry(skiatest::Reporter* reporter) { SkPoint pts[3], dst[5]; pts[0].set(0, 0); pts[1].set(100, 50); pts[2].set(0, 100); int count = SkChopQuadAtMaxCurvature(pts, dst); REPORTER_ASSERT(reporter, count == 1 || count == 2); pts[0].set(0, 0); pts[1].set(SkIntToScalar(3), 0); pts[2].set(SkIntToScalar(3), SkIntToScalar(3)); SkConvertQuadToCubic(pts, dst); const SkPoint cubic[] = { { 0, 0, }, { SkIntToScalar(2), 0, }, { SkIntToScalar(3), SkIntToScalar(1), }, { SkIntToScalar(3), SkIntToScalar(3) }, }; for (int i = 0; i < 4; ++i) { REPORTER_ASSERT(reporter, nearly_equal(cubic[i], dst[i])); } testChopCubic(reporter); }
DEF_TEST(Geometry, reporter) { SkPoint pts[3], dst[5]; pts[0].set(0, 0); pts[1].set(100, 50); pts[2].set(0, 100); int count = SkChopQuadAtMaxCurvature(pts, dst); REPORTER_ASSERT(reporter, count == 1 || count == 2); pts[0].set(0, 0); pts[1].set(3, 0); pts[2].set(3, 3); SkConvertQuadToCubic(pts, dst); const SkPoint cubic[] = { { 0, 0, }, { 2, 0, }, { 3, 1, }, { 3, 3 }, }; for (int i = 0; i < 4; ++i) { REPORTER_ASSERT(reporter, nearly_equal(cubic[i], dst[i])); } testChopCubic(reporter); test_evalquadat(reporter); test_conic(reporter); test_cubic_tangents(reporter); test_quad_tangents(reporter); test_conic_tangents(reporter); }