2 * Copyright 2012 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
7 #include "PathOpsTestCommon.h"
9 #include "SkPathOpsQuad.h"
13 static const SkDQuad tests[] = {
14 {{{1, 1}, {2, 1}, {0, 2}}},
15 {{{0, 0}, {1, 1}, {3, 1}}},
16 {{{2, 0}, {1, 1}, {2, 2}}},
17 {{{4, 0}, {0, 1}, {4, 2}}},
18 {{{0, 0}, {0, 1}, {1, 1}}},
21 static const SkDPoint inPoint[]= {
26 {0.4999, 0.5}, // was 0.5, 0.5; points on the hull are considered outside
29 static const SkDPoint outPoint[]= {
37 static const size_t tests_count = SK_ARRAY_COUNT(tests);
39 DEF_TEST(PathOpsDQuad, reporter) {
40 for (size_t index = 0; index < tests_count; ++index) {
41 const SkDQuad& quad = tests[index];
42 SkASSERT(ValidQuad(quad));
43 bool result = quad.pointInHull(inPoint[index]);
45 SkDebugf("%s [%d] expected in hull\n", __FUNCTION__, index);
46 REPORTER_ASSERT(reporter, 0);
48 result = quad.pointInHull(outPoint[index]);
50 SkDebugf("%s [%d] expected outside hull\n", __FUNCTION__, index);
51 REPORTER_ASSERT(reporter, 0);
56 DEF_TEST(PathOpsRRect, reporter) {
59 SkRect rect = {135, 143, 250, 177};
60 SkVector radii[4] = {{8, 8}, {8, 8}, {0, 0}, {0, 0}};
61 rRect.setRectRadii(rect, radii);