OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
| 7 #include "PathOpsTestCommon.h" |
7 #include "SkPathOpsQuad.h" | 8 #include "SkPathOpsQuad.h" |
8 #include "Test.h" | 9 #include "Test.h" |
9 | 10 |
10 static const SkDQuad tests[] = { | 11 static const SkDQuad tests[] = { |
11 {{{1, 1}, {2, 1}, {0, 2}}}, | 12 {{{1, 1}, {2, 1}, {0, 2}}}, |
12 {{{0, 0}, {1, 1}, {3, 1}}}, | 13 {{{0, 0}, {1, 1}, {3, 1}}}, |
13 {{{2, 0}, {1, 1}, {2, 2}}}, | 14 {{{2, 0}, {1, 1}, {2, 2}}}, |
14 {{{4, 0}, {0, 1}, {4, 2}}}, | 15 {{{4, 0}, {0, 1}, {4, 2}}}, |
15 {{{0, 0}, {0, 1}, {1, 1}}}, | 16 {{{0, 0}, {0, 1}, {1, 1}}}, |
16 }; | 17 }; |
(...skipping 12 matching lines...) Expand all Loading... |
29 {2.2, 1}, | 30 {2.2, 1}, |
30 {1.5, 1.5}, | 31 {1.5, 1.5}, |
31 {1.1, 0.5}, | 32 {1.1, 0.5}, |
32 }; | 33 }; |
33 | 34 |
34 static const size_t tests_count = SK_ARRAY_COUNT(tests); | 35 static const size_t tests_count = SK_ARRAY_COUNT(tests); |
35 | 36 |
36 static void PathOpsDQuadTest(skiatest::Reporter* reporter) { | 37 static void PathOpsDQuadTest(skiatest::Reporter* reporter) { |
37 for (size_t index = 0; index < tests_count; ++index) { | 38 for (size_t index = 0; index < tests_count; ++index) { |
38 const SkDQuad& quad = tests[index]; | 39 const SkDQuad& quad = tests[index]; |
| 40 SkASSERT(ValidQuad(quad)); |
39 bool result = quad.pointInHull(inPoint[index]); | 41 bool result = quad.pointInHull(inPoint[index]); |
40 if (!result) { | 42 if (!result) { |
41 SkDebugf("%s [%d] expected in hull\n", __FUNCTION__, index); | 43 SkDebugf("%s [%d] expected in hull\n", __FUNCTION__, index); |
42 REPORTER_ASSERT(reporter, 0); | 44 REPORTER_ASSERT(reporter, 0); |
43 } | 45 } |
44 result = quad.pointInHull(outPoint[index]); | 46 result = quad.pointInHull(outPoint[index]); |
45 if (result) { | 47 if (result) { |
46 SkDebugf("%s [%d] expected outside hull\n", __FUNCTION__, index); | 48 SkDebugf("%s [%d] expected outside hull\n", __FUNCTION__, index); |
47 REPORTER_ASSERT(reporter, 0); | 49 REPORTER_ASSERT(reporter, 0); |
48 } | 50 } |
49 } | 51 } |
50 } | 52 } |
51 | 53 |
52 #include "TestClassDef.h" | 54 #include "TestClassDef.h" |
53 DEFINE_TESTCLASS_SHORT(PathOpsDQuadTest) | 55 DEFINE_TESTCLASS_SHORT(PathOpsDQuadTest) |
OLD | NEW |