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 "PathOpsTestCommon.h" |
8 #include "SkPathOpsTriangle.h" | 8 #include "SkPathOpsTriangle.h" |
9 #include "Test.h" | 9 #include "Test.h" |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... |
38 REPORTER_ASSERT(reporter, 0); | 38 REPORTER_ASSERT(reporter, 0); |
39 } | 39 } |
40 result = triangle.contains(outPoint[index]); | 40 result = triangle.contains(outPoint[index]); |
41 if (result) { | 41 if (result) { |
42 SkDebugf("%s [%d] expected point outside triangle\n", __FUNCTION__,
index); | 42 SkDebugf("%s [%d] expected point outside triangle\n", __FUNCTION__,
index); |
43 REPORTER_ASSERT(reporter, 0); | 43 REPORTER_ASSERT(reporter, 0); |
44 } | 44 } |
45 } | 45 } |
46 } | 46 } |
47 | 47 |
| 48 static const SkDTriangle oneOff[] = { |
| 49 {{{271.03291625750461, 5.0402503630087025e-05}, {275.21652430019037, 3.69973
00650817753}, |
| 50 {279.25839233398438, 7.7416000366210938}}}, |
| 51 |
| 52 {{{271.03291625750461, 5.0402503617874572e-05}, {275.21652430019037, 3.69973
00650817877}, |
| 53 {279.25839233398438, 7.7416000366210938}}} |
| 54 }; |
| 55 |
| 56 static const size_t oneOff_count = SK_ARRAY_COUNT(oneOff); |
| 57 |
| 58 static void PathOpsTriangleOneOffTest(skiatest::Reporter* reporter) { |
| 59 for (size_t index = 0; index < oneOff_count; ++index) { |
| 60 const SkDTriangle& triangle = oneOff[index]; |
| 61 SkASSERT(ValidTriangle(triangle)); |
| 62 for (int inner = 0; inner < 3; ++inner) { |
| 63 bool result = triangle.contains(triangle.fPts[inner]); |
| 64 if (result) { |
| 65 SkDebugf("%s [%d][%d] point on triangle is not in\n", __FUNCTION
__, index, inner); |
| 66 REPORTER_ASSERT(reporter, 0); |
| 67 } |
| 68 } |
| 69 } |
| 70 } |
| 71 |
48 #include "TestClassDef.h" | 72 #include "TestClassDef.h" |
49 DEFINE_TESTCLASS_SHORT(PathOpsTriangleUtilitiesTest) | 73 DEFINE_TESTCLASS_SHORT(PathOpsTriangleUtilitiesTest) |
| 74 |
| 75 DEFINE_TESTCLASS_SHORT(PathOpsTriangleOneOffTest) |
OLD | NEW |