| 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 "SkPathOps.h" | 7 #include "SkPathOps.h" |
| 8 #include "SkPath.h" | 8 #include "SkPath.h" |
| 9 #include "SkPoint.h" | 9 #include "SkPoint.h" |
| 10 #include "Test.h" | 10 #include "Test.h" |
| 11 #include "TestClassDef.h" |
| 11 | 12 |
| 12 static const SkPoint nonFinitePts[] = { | 13 static const SkPoint nonFinitePts[] = { |
| 13 { SK_ScalarInfinity, 0 }, | 14 { SK_ScalarInfinity, 0 }, |
| 14 { 0, SK_ScalarInfinity }, | 15 { 0, SK_ScalarInfinity }, |
| 15 { SK_ScalarInfinity, SK_ScalarInfinity }, | 16 { SK_ScalarInfinity, SK_ScalarInfinity }, |
| 16 { SK_ScalarNegativeInfinity, 0}, | 17 { SK_ScalarNegativeInfinity, 0}, |
| 17 { 0, SK_ScalarNegativeInfinity }, | 18 { 0, SK_ScalarNegativeInfinity }, |
| 18 { SK_ScalarNegativeInfinity, SK_ScalarNegativeInfinity }, | 19 { SK_ScalarNegativeInfinity, SK_ScalarNegativeInfinity }, |
| 19 { SK_ScalarNegativeInfinity, SK_ScalarInfinity }, | 20 { SK_ScalarNegativeInfinity, SK_ScalarInfinity }, |
| 20 { SK_ScalarInfinity, SK_ScalarNegativeInfinity }, | 21 { SK_ScalarInfinity, SK_ScalarNegativeInfinity }, |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 case 10: path.moveTo(finitePts[f]); break; | 85 case 10: path.moveTo(finitePts[f]); break; |
| 85 } | 86 } |
| 86 SkPath result; | 87 SkPath result; |
| 87 result.setFillType(SkPath::kWinding_FillType); | 88 result.setFillType(SkPath::kWinding_FillType); |
| 88 bool success = Simplify(path, &result); | 89 bool success = Simplify(path, &result); |
| 89 REPORTER_ASSERT(reporter, success); | 90 REPORTER_ASSERT(reporter, success); |
| 90 REPORTER_ASSERT(reporter, result.getFillType() != SkPath::kWinding_FillType)
; | 91 REPORTER_ASSERT(reporter, result.getFillType() != SkPath::kWinding_FillType)
; |
| 91 reporter->bumpTestCount(); | 92 reporter->bumpTestCount(); |
| 92 } | 93 } |
| 93 | 94 |
| 94 static void PathOpsSimplifyFailTest(skiatest::Reporter* reporter) { | 95 DEF_TEST(PathOpsSimplifyFail, reporter) { |
| 95 for (int index = 0; index < (int) (13 * nonFinitePtsCount * finitePtsCount);
++index) { | 96 for (int index = 0; index < (int) (13 * nonFinitePtsCount * finitePtsCount);
++index) { |
| 96 failOne(reporter, index); | 97 failOne(reporter, index); |
| 97 } | 98 } |
| 98 for (int index = 0; index < (int) (11 * finitePtsCount); ++index) { | 99 for (int index = 0; index < (int) (11 * finitePtsCount); ++index) { |
| 99 dontFailOne(reporter, index); | 100 dontFailOne(reporter, index); |
| 100 } | 101 } |
| 101 } | 102 } |
| 102 | 103 |
| 103 static void PathOpsSimplifyFailOneTest(skiatest::Reporter* reporter) { | 104 DEF_TEST(PathOpsSimplifyFailOne, reporter) { |
| 104 int index = 0; | 105 int index = 0; |
| 105 failOne(reporter, index); | 106 failOne(reporter, index); |
| 106 } | 107 } |
| 107 | 108 |
| 108 static void PathOpsSimplifyDontFailOneTest(skiatest::Reporter* reporter) { | 109 DEF_TEST(PathOpsSimplifyDontFailOne, reporter) { |
| 109 int index = 6; | 110 int index = 6; |
| 110 dontFailOne(reporter, index); | 111 dontFailOne(reporter, index); |
| 111 } | 112 } |
| 112 | |
| 113 #include "TestClassDef.h" | |
| 114 DEFINE_TESTCLASS_SHORT(PathOpsSimplifyFailTest) | |
| 115 | |
| 116 DEFINE_TESTCLASS_SHORT(PathOpsSimplifyFailOneTest) | |
| 117 | |
| 118 DEFINE_TESTCLASS_SHORT(PathOpsSimplifyDontFailOneTest) | |
| OLD | NEW |