Lines Matching refs:reporter

20 static void testChopCubic(skiatest::Reporter* reporter) {
37 REPORTER_ASSERT(reporter, count);
47 REPORTER_ASSERT(reporter, pts[i].fX == pts[i].fY);
48 REPORTER_ASSERT(reporter, pts[i].fX == i * .5f);
75 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(allChops[i].x(), expectedPt.x()));
76 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(allChops[i].y(), expectedPt.y()));
78 REPORTER_ASSERT(reporter, allChops[i] == pts[0]);
81 REPORTER_ASSERT(reporter, allChops[i] == pts[3]);
88 REPORTER_ASSERT(reporter, localChops[3] == localChops[4]);
89 REPORTER_ASSERT(reporter, localChops[3] == localChops[5]);
90 REPORTER_ASSERT(reporter, localChops[3] == localChops[6]);
93 REPORTER_ASSERT(reporter, localChops[0] == pts[0]);
94 REPORTER_ASSERT(reporter, localChops[1] == pts[0]);
95 REPORTER_ASSERT(reporter, localChops[2] == pts[0]);
96 REPORTER_ASSERT(reporter, localChops[3] == pts[0]);
100 REPORTER_ASSERT(reporter, localChops[6] == pts[3]);
101 REPORTER_ASSERT(reporter, localChops[7] == pts[3]);
102 REPORTER_ASSERT(reporter, localChops[8] == pts[3]);
103 REPORTER_ASSERT(reporter, localChops[9] == pts[3]);
110 REPORTER_ASSERT(reporter, oneChops[0] == pts[0]);
111 REPORTER_ASSERT(reporter, oneChops[1] == pts[1]);
112 REPORTER_ASSERT(reporter, oneChops[2] == pts[2]);
114 REPORTER_ASSERT(reporter, oneChops[index] == pts[3]);
119 static void check_pairs(skiatest::Reporter* reporter, int index, SkScalar t, const char name[],
125 REPORTER_ASSERT(reporter, eq);
129 static void test_evalquadat(skiatest::Reporter* reporter) {
142 check_pairs(reporter, i, t, "quad-pos", r0.fX, r0.fY, r1.fX, r1.fY);
147 check_pairs(reporter, i, t, "quad-tan", v0.fX, v0.fY, v1.fX, v1.fY);
154 static void test_conic_eval_pos(skiatest::Reporter* reporter, const SkConic& conic, SkScalar t) {
158 check_pairs(reporter, 0, t, "conic-pos", p0.fX, p0.fY, p1.fX, p1.fY);
161 static void test_conic_eval_tan(skiatest::Reporter* reporter, const SkConic& conic, SkScalar t) {
165 check_pairs(reporter, 0, t, "conic-tan", v0.fX, v0.fY, v1.fX, v1.fY);
168 static void test_conic(skiatest::Reporter* reporter) {
182 test_conic_eval_pos(reporter, conic, t);
183 test_conic_eval_tan(reporter, conic, t);
190 static void test_quad_tangents(skiatest::Reporter* reporter) {
202 REPORTER_ASSERT(reporter, start.fX && start.fY);
203 REPORTER_ASSERT(reporter, mid.fX && mid.fY);
204 REPORTER_ASSERT(reporter, end.fX && end.fY);
205 REPORTER_ASSERT(reporter, SkScalarNearlyZero(start.cross(mid)));
206 REPORTER_ASSERT(reporter, SkScalarNearlyZero(mid.cross(end)));
210 static void test_conic_tangents(skiatest::Reporter* reporter) {
222 REPORTER_ASSERT(reporter, start.fX && start.fY);
223 REPORTER_ASSERT(reporter, mid.fX && mid.fY);
224 REPORTER_ASSERT(reporter, end.fX && end.fY);
225 REPORTER_ASSERT(reporter, SkScalarNearlyZero(start.cross(mid)));
226 REPORTER_ASSERT(reporter, SkScalarNearlyZero(mid.cross(end)));
245 static void test_conic_to_quads(skiatest::Reporter* reporter) {
260 test_this_conic_to_quad(reporter, pts, w);
262 test_this_conic_to_quad(reporter, pts, SK_ScalarNaN);
266 static void test_cubic_tangents(skiatest::Reporter* reporter) {
279 REPORTER_ASSERT(reporter, start.fX && start.fY);
280 REPORTER_ASSERT(reporter, mid.fX && mid.fY);
281 REPORTER_ASSERT(reporter, end.fX && end.fY);
282 REPORTER_ASSERT(reporter, SkScalarNearlyZero(start.cross(mid)));
283 REPORTER_ASSERT(reporter, SkScalarNearlyZero(mid.cross(end)));
287 static void check_cubic_type(skiatest::Reporter* reporter,
293 REPORTER_ASSERT(reporter, actualType == expectedType);
297 static void check_cubic_around_rect(skiatest::Reporter* reporter,
344 check_cubic_type(reporter, bezier, expectations[i*6 + j*2 + k], undefined);
359 check_cubic_type(reporter, bezier, SkCubicType::kSerpentine, undefined);
388 static void test_classify_cubic(skiatest::Reporter* reporter) {
390 check_cubic_type(reporter, serp, SkCubicType::kSerpentine);
393 check_cubic_type(reporter, loop, SkCubicType::kLoop);
396 check_cubic_type(reporter, loop, SkCubicType::kLineOrPoint);
398 check_cubic_around_rect(reporter, 0, 0, 1, 1);
399 check_cubic_around_rect(reporter,
404 check_cubic_around_rect(reporter, 1, 1,
407 check_cubic_around_rect(reporter,
412 check_cubic_around_rect(reporter, +1, -std::numeric_limits<float>::min(), -1, -1);
413 check_cubic_around_rect(reporter,
419 check_cubic_around_rect(reporter, 0, 0, 1, +std::numeric_limits<float>::infinity(), true);
420 check_cubic_around_rect(reporter,
426 check_cubic_around_rect(reporter, 0, 0, 1, +std::numeric_limits<float>::quiet_NaN(), true);
436 static void test_cubic_cusps(skiatest::Reporter* reporter) {
444 REPORTER_ASSERT(reporter, SkFindCubicCusp(noCusp.data()) < 0);
447 REPORTER_ASSERT(reporter, SkFindCubicCusp(cusp.data()) > 0);
457 static void test_chop_quad_at_midtangent(skiatest::Reporter* reporter, const SkPoint pts[3]) {
467 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(leftRotation, fullRotation/2, kTolerance));
468 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(rightRotation, fullRotation/2, kTolerance));
472 static void test_chop_cubic_at_midtangent(skiatest::Reporter* reporter, const SkPoint pts[4],
496 REPORTER_ASSERT(reporter, std::abs(leftRotation) - kTolerance <= SK_ScalarPI);
497 REPORTER_ASSERT(reporter, std::abs(rightRotation) - kTolerance <= SK_ScalarPI);
507 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(leftRotation, expectedChoppedRotation,
509 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(rightRotation, expectedChoppedRotation,
526 static void test_measure_rotation(skiatest::Reporter* reporter) {
528 REPORTER_ASSERT(reporter, SkScalarNearlyZero(SkMeasureNonInflectCubicRotation(kFlatCubic)));
531 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(SkMeasureNonInflectCubicRotation(kFlatCubic180_1),
535 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(SkMeasureNonInflectCubicRotation(kFlatCubic180_2),
539 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(SkMeasureNonInflectCubicRotation(kFlatCubic360),
543 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(SkMeasureNonInflectCubicRotation(kSquare180),
548 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(r, expectedRotation));
551 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(SkMeasureNonInflectCubicRotation(cubic1),
555 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(SkMeasureNonInflectCubicRotation(cubic2),
559 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(SkMeasureNonInflectCubicRotation(cubic3),
576 static void test_chop_at_midtangent(skiatest::Reporter* reporter) {
579 REPORTER_ASSERT(reporter, SkClassifyCubic(serp.data()) == SkCubicType::kSerpentine);
582 test_chop_cubic_at_midtangent(reporter, chops + i*3, SkCubicType::kSerpentine);
586 REPORTER_ASSERT(reporter, SkClassifyCubic(loop.data()) == SkCubicType::kLoop);
587 test_chop_cubic_at_midtangent(reporter, loop.data(), SkCubicType::kLoop);
590 REPORTER_ASSERT(reporter, SkClassifyCubic(line.data()) == SkCubicType::kLineOrPoint);
591 test_chop_cubic_at_midtangent(reporter, line.data(), SkCubicType::kLineOrPoint);
594 REPORTER_ASSERT(reporter, SkClassifyCubic(cusp.data()) == SkCubicType::kLocalCusp);
595 test_chop_cubic_at_midtangent(reporter, cusp.data(), SkCubicType::kLocalCusp);
598 test_chop_quad_at_midtangent(reporter, quad.data());
601 test_chop_cubic_at_midtangent(reporter, asCubic, SkCubicType::kQuadratic);
605 REPORTER_ASSERT(reporter, SkClassifyCubic(kExactQuad) == SkCubicType::kQuadratic);
606 test_chop_cubic_at_midtangent(reporter, kExactQuad, SkCubicType::kQuadratic);
609 REPORTER_ASSERT(reporter, SkClassifyCubic(kExactCuspAtInf) == SkCubicType::kCuspAtInfinity);
612 test_chop_cubic_at_midtangent(reporter, chops + i*3, SkCubicType::kCuspAtInfinity);
616 DEF_TEST(Geometry, reporter) {
624 REPORTER_ASSERT(reporter, count == 1 || count == 2);
641 REPORTER_ASSERT(reporter, nearly_equal(cubic[i], pts[i]));
644 testChopCubic(reporter);
645 test_evalquadat(reporter);
646 test_conic(reporter);
647 test_cubic_tangents(reporter);
648 test_quad_tangents(reporter);
649 test_conic_tangents(reporter);
650 test_conic_to_quads(reporter);
651 test_classify_cubic(reporter);
652 test_cubic_cusps(reporter);
653 test_measure_rotation(reporter);
654 test_chop_at_midtangent(reporter);