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 "PathOpsExtendedTest.h" | 7 #include "PathOpsExtendedTest.h" |
8 #include "PathOpsTestCommon.h" | 8 #include "PathOpsTestCommon.h" |
9 | 9 |
10 #define TEST(name) { name, #name } | 10 #define TEST(name) { name, #name } |
(...skipping 3443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3454 SkPath path, pathB; | 3454 SkPath path, pathB; |
3455 path.setFillType(SkPath::kEvenOdd_FillType); | 3455 path.setFillType(SkPath::kEvenOdd_FillType); |
3456 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction); | 3456 path.addRect(0, 0, 1, 1, SkPath::kCW_Direction); |
3457 path.addRect(0, 0, 2, 2, SkPath::kCW_Direction); | 3457 path.addRect(0, 0, 2, 2, SkPath::kCW_Direction); |
3458 pathB.setFillType(SkPath::kWinding_FillType); | 3458 pathB.setFillType(SkPath::kWinding_FillType); |
3459 pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction); | 3459 pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction); |
3460 pathB.addRect(0, 0, 3, 3, SkPath::kCW_Direction); | 3460 pathB.addRect(0, 0, 3, 3, SkPath::kCW_Direction); |
3461 testPathOp(reporter, path, pathB, kDifference_PathOp, filename); | 3461 testPathOp(reporter, path, pathB, kDifference_PathOp, filename); |
3462 } | 3462 } |
3463 | 3463 |
| 3464 #define TEST_ISSUE_2753 0 |
| 3465 #if TEST_ISSUE_2753 |
| 3466 static void issue2753(skiatest::Reporter* reporter, const char* filename) { |
| 3467 SkPath path1; |
| 3468 path1.moveTo(142.701f, 110.568f); |
| 3469 path1.lineTo(142.957f, 100); |
| 3470 path1.lineTo(153.835f, 100); |
| 3471 path1.lineTo(154.592f, 108.188f); |
| 3472 path1.cubicTo(154.592f, 108.188f, 153.173f, 108.483f, 152.83f, 109.412f); |
| 3473 path1.cubicTo(152.83f, 109.412f, 142.701f, 110.568f, 142.701f, 110.568f); |
| 3474 path1.close(); |
| 3475 |
| 3476 SkPath path2; |
| 3477 path2.moveTo(39, 124.001f); |
| 3478 path2.cubicTo(39, 124.001f, 50.6f, 117.001f, 50.6f, 117.001f); |
| 3479 path2.cubicTo(50.6f, 117.001f, 164.601f, 85.2f, 188.201f, 117.601f); |
| 3480 path2.cubicTo(188.201f, 117.601f, 174.801f, 93, 39, 124.001f); |
| 3481 path2.close(); |
| 3482 |
| 3483 testPathOp(reporter, path1, path2, kUnion_PathOp, filename); |
| 3484 } |
| 3485 #endif |
| 3486 |
3464 static void (*firstTest)(skiatest::Reporter* , const char* filename) = 0; | 3487 static void (*firstTest)(skiatest::Reporter* , const char* filename) = 0; |
3465 static void (*stopTest)(skiatest::Reporter* , const char* filename) = 0; | 3488 static void (*stopTest)(skiatest::Reporter* , const char* filename) = 0; |
3466 | 3489 |
3467 static struct TestDesc tests[] = { | 3490 static struct TestDesc tests[] = { |
| 3491 #if TEST_ISSUE_2753 // FIXME: pair of cubics miss intersection |
| 3492 TEST(issue2753), |
| 3493 #endif |
3468 #if CUBIC_OP_114 // FIXME: curve with inflection is ordered the wrong way | 3494 #if CUBIC_OP_114 // FIXME: curve with inflection is ordered the wrong way |
3469 TEST(cubicOp114), | 3495 TEST(cubicOp114), |
3470 #endif | 3496 #endif |
3471 TEST(cubicOp114asQuad), | 3497 TEST(cubicOp114asQuad), |
3472 TEST(rects4), | 3498 TEST(rects4), |
3473 TEST(rects3), | 3499 TEST(rects3), |
3474 TEST(rects2), | 3500 TEST(rects2), |
3475 TEST(rects1), | 3501 TEST(rects1), |
3476 TEST(issue2540), | 3502 TEST(issue2540), |
3477 TEST(issue2504), | 3503 TEST(issue2504), |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3721 }; | 3747 }; |
3722 | 3748 |
3723 static const size_t failTestCount = SK_ARRAY_COUNT(failTests); | 3749 static const size_t failTestCount = SK_ARRAY_COUNT(failTests); |
3724 | 3750 |
3725 DEF_TEST(PathOpsFailOp, reporter) { | 3751 DEF_TEST(PathOpsFailOp, reporter) { |
3726 #if DEBUG_SHOW_TEST_NAME | 3752 #if DEBUG_SHOW_TEST_NAME |
3727 strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH); | 3753 strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH); |
3728 #endif | 3754 #endif |
3729 RunTestSet(reporter, failTests, failTestCount, 0, 0, false); | 3755 RunTestSet(reporter, failTests, failTestCount, 0, 0, false); |
3730 } | 3756 } |
OLD | NEW |