OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkPath.h" | 7 #include "SkPath.h" |
8 #include "SkPathOps.h" | 8 #include "SkPathOps.h" |
9 #include "SkPoint.h" | 9 #include "SkPoint.h" |
10 #include "Test.h" | 10 #include "Test.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 case 5: path.cubicTo(finitePts[f], finitePts[f], finitePts[g]); break; | 79 case 5: path.cubicTo(finitePts[f], finitePts[f], finitePts[g]); break; |
80 case 6: path.cubicTo(finitePts[f], finitePts[g], finitePts[f]); break; | 80 case 6: path.cubicTo(finitePts[f], finitePts[g], finitePts[f]); break; |
81 case 7: path.cubicTo(finitePts[f], finitePts[g], finitePts[g]); break; | 81 case 7: path.cubicTo(finitePts[f], finitePts[g], finitePts[g]); break; |
82 case 8: path.cubicTo(finitePts[g], finitePts[f], finitePts[f]); break; | 82 case 8: path.cubicTo(finitePts[g], finitePts[f], finitePts[f]); break; |
83 case 9: path.cubicTo(finitePts[g], finitePts[f], finitePts[g]); break; | 83 case 9: path.cubicTo(finitePts[g], finitePts[f], finitePts[g]); break; |
84 case 10: path.moveTo(finitePts[f]); break; | 84 case 10: path.moveTo(finitePts[f]); break; |
85 } | 85 } |
86 SkPath result; | 86 SkPath result; |
87 result.setFillType(SkPath::kWinding_FillType); | 87 result.setFillType(SkPath::kWinding_FillType); |
88 bool success = Simplify(path, &result); | 88 bool success = Simplify(path, &result); |
89 // linux 32 debug fails test 13 because the quad is not treated as linear | 89 REPORTER_ASSERT(reporter, success); |
90 // there's no error in the math that I can find -- it looks like a processor | |
91 // or compiler bug -- so for now, allow either to work | |
92 REPORTER_ASSERT(reporter, success || index == 13); | |
93 REPORTER_ASSERT(reporter, result.getFillType() != SkPath::kWinding_FillType)
; | 90 REPORTER_ASSERT(reporter, result.getFillType() != SkPath::kWinding_FillType)
; |
94 reporter->bumpTestCount(); | 91 reporter->bumpTestCount(); |
95 } | 92 } |
96 | 93 |
97 DEF_TEST(PathOpsSimplifyFail, reporter) { | 94 DEF_TEST(PathOpsSimplifyFail, reporter) { |
98 for (int index = 0; index < (int) (13 * nonFinitePtsCount * finitePtsCount);
++index) { | 95 for (int index = 0; index < (int) (13 * nonFinitePtsCount * finitePtsCount);
++index) { |
99 failOne(reporter, index); | 96 failOne(reporter, index); |
100 } | 97 } |
101 for (int index = 0; index < (int) (11 * finitePtsCount); ++index) { | 98 for (int index = 0; index < (int) (11 * finitePtsCount); ++index) { |
102 dontFailOne(reporter, index); | 99 dontFailOne(reporter, index); |
103 } | 100 } |
104 } | 101 } |
105 | 102 |
106 DEF_TEST(PathOpsSimplifyFailOne, reporter) { | 103 DEF_TEST(PathOpsSimplifyFailOne, reporter) { |
107 int index = 0; | 104 int index = 0; |
108 failOne(reporter, index); | 105 failOne(reporter, index); |
109 } | 106 } |
110 | 107 |
111 DEF_TEST(PathOpsSimplifyDontFailOne, reporter) { | 108 DEF_TEST(PathOpsSimplifyDontFailOne, reporter) { |
112 int index = 13; | 109 int index = 13; |
113 dontFailOne(reporter, index); | 110 dontFailOne(reporter, index); |
114 } | 111 } |
OLD | NEW |