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 3753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3764 } | 3764 } |
3765 | 3765 |
3766 static void bufferOverflow(skiatest::Reporter* reporter, const char* filename) { | 3766 static void bufferOverflow(skiatest::Reporter* reporter, const char* filename) { |
3767 SkPath path; | 3767 SkPath path; |
3768 path.addRect(0,0, 300,170141183460469231731687303715884105728.f); | 3768 path.addRect(0,0, 300,170141183460469231731687303715884105728.f); |
3769 SkPath pathB; | 3769 SkPath pathB; |
3770 pathB.addRect(0,0, 300,16); | 3770 pathB.addRect(0,0, 300,16); |
3771 testPathFailOp(reporter, path, pathB, kUnion_PathOp, filename); | 3771 testPathFailOp(reporter, path, pathB, kUnion_PathOp, filename); |
3772 } | 3772 } |
3773 | 3773 |
| 3774 // m 100,0 60,170 -160,-110 200,0 -170,11000000000 z |
| 3775 static void fuzz433(skiatest::Reporter* reporter, const char* filename) { |
| 3776 SkPath path1, path2; |
| 3777 path1.moveTo(100,0); |
| 3778 path1.lineTo(60,170); |
| 3779 path1.lineTo(-160,-110); |
| 3780 path1.lineTo(200,0); |
| 3781 path1.lineTo(-170,11000000000.0f); |
| 3782 path1.close(); |
| 3783 |
| 3784 path2.moveTo(100 + 20,0 + 20); |
| 3785 path2.lineTo(60 + 20,170 + 20); |
| 3786 path2.lineTo(-160 + 20,-110 + 20); |
| 3787 path2.lineTo(200 + 20,0 + 20); |
| 3788 path2.lineTo(-170 + 20,11000000000.0f + 20); |
| 3789 path2.close(); |
| 3790 |
| 3791 testPathFailOp(reporter, path1, path2, kIntersect_PathOp, filename); |
| 3792 } |
| 3793 |
| 3794 static void fuzz433b(skiatest::Reporter* reporter, const char* filename) { |
| 3795 SkPath path1, path2; |
| 3796 path1.setFillType(SkPath::kEvenOdd_FillType); |
| 3797 path1.moveTo(140, 40); |
| 3798 path1.lineTo(200, 210); |
| 3799 path1.lineTo(40, 100); |
| 3800 path1.lineTo(240, 100); |
| 3801 path1.lineTo(70, 1.1e+10f); |
| 3802 path1.lineTo(140, 40); |
| 3803 path1.close(); |
| 3804 |
| 3805 path1.setFillType(SkPath::kWinding_FillType); |
| 3806 path2.moveTo(190, 60); |
| 3807 path2.lineTo(250, 230); |
| 3808 path2.lineTo(90, 120); |
| 3809 path2.lineTo(290, 120); |
| 3810 path2.lineTo(120, 1.1e+10f); |
| 3811 path2.lineTo(190, 60); |
| 3812 path2.close(); |
| 3813 |
| 3814 testPathFailOp(reporter, path1, path2, kUnion_PathOp, filename); |
| 3815 } |
| 3816 |
3774 static struct TestDesc failTests[] = { | 3817 static struct TestDesc failTests[] = { |
| 3818 TEST(fuzz433b), |
| 3819 TEST(fuzz433), |
3775 TEST(bufferOverflow), | 3820 TEST(bufferOverflow), |
3776 }; | 3821 }; |
3777 | 3822 |
3778 static const size_t failTestCount = SK_ARRAY_COUNT(failTests); | 3823 static const size_t failTestCount = SK_ARRAY_COUNT(failTests); |
3779 | 3824 |
3780 DEF_TEST(PathOpsFailOp, reporter) { | 3825 DEF_TEST(PathOpsFailOp, reporter) { |
3781 #if DEBUG_SHOW_TEST_NAME | 3826 #if DEBUG_SHOW_TEST_NAME |
3782 strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH); | 3827 strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH); |
3783 #endif | 3828 #endif |
3784 RunTestSet(reporter, failTests, failTestCount, 0, 0, false); | 3829 RunTestSet(reporter, failTests, failTestCount, 0, 0, false); |
3785 } | 3830 } |
OLD | NEW |