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 class PathTest_Private { | 10 class PathTest_Private { |
(...skipping 3641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3652 #include "SkParsePath.h" | 3652 #include "SkParsePath.h" |
3653 | 3653 |
3654 static void issue3517(skiatest::Reporter* reporter, const char* filename) { | 3654 static void issue3517(skiatest::Reporter* reporter, const char* filename) { |
3655 SkPath path, pathB; | 3655 SkPath path, pathB; |
3656 | 3656 |
3657 const char str[] = "M31.35 57.75L31.35 57.75C31.9 57.7486 32.45 57.7948 33 5
7.7413C33.55 57.6878 34.1 57.5014 34.65 57.4291C35.2 57.3569 35.75 57.3223 36.3
57.3079C36.85 57.2935 37.4 57.3143 37.95 57.3428C38.5 57.3712 39.05 57.4112 39.6
57.4786C40.15 57.546 40.7 57.7029 41.25 57.7472C41.8 57.7916 42.35 57.7962 42.9
57.7445C43.45 57.6928 44 57.5345 44.55 57.4373C45.1 57.34 45.65 57.2115 46.2 57
.1611C46.75 57.1107 47.3 57.1371 47.85 57.1349C48.4 57.1327 48.95 57.144 49.5 57
.1478C50.05 57.1516 50.6 57.1553 51.15 57.1579C51.7 57.1605 52.25 57.1601 52.8 5
7.1634C53.35 57.1667 53.9 57.1731 54.45 57.1776C55 57.182 55.55 57.1916 56.1 57.
19C56.65 57.1884 57.2 57.178 57.75 57.168C58.3 57.158 58.85 57.1355 59.4 57.1299
C59.95 57.1243 60.5 57.1338 61.05 57.1345C61.6 57.1352 62.15 57.124 62.7 57.134C
63.25 57.1441 63.8 57.1731 64.35 57.195C64.9 57.2169 65.45 57.2532 66 57.2655C66
.55 57.2778 67.1 57.2647 67.65 57.2687C68.2 57.2728 68.75 57.267 69.3 57.2896C69
.85 57.3122 70.4 57.371 70.95 57.4044C71.5 57.4377 72.05 57.4668 72.6 57.4896C73
.15 57.5123 73.7 57.545 74.25 57.5408C74.8 57.5365 75.35 57.5068 75.9 57.4641C76
.45 57.4213 77 57.3244 77.55 57.2842C78.1 57.244 78.65 57.2163 79.2 57.2228C79.7
5 57.2293 80.3 57.29 80.85 57.3232C81.4 57.3563 81.95 57.396 82.5 57.4219C83.05
57.4478 83.6 57.4637 84.15 57.4787C84.7 57.4937 85.25 57.5011 85.8 57.5121C86.35
57.523 86.9 57.5411 87.45 57.5444C88 57.5477 88.55 57.5663 89.1 57.5318C89.65 5
7.4972 90.2 57.3126 90.75 57.337C91.3 57.3613 91.85 57.6088 92.4 57.6776C92.95 5
7.7465 93.5 57.7379 94.05 57.75C94.6 57.7621 95.15 57.75 95.7 57.75L95.7 57.75L3
1.35 57.75Z"; | 3657 const char str[] = "M31.35 57.75L31.35 57.75C31.9 57.7486 32.45 57.7948 33 5
7.7413C33.55 57.6878 34.1 57.5014 34.65 57.4291C35.2 57.3569 35.75 57.3223 36.3
57.3079C36.85 57.2935 37.4 57.3143 37.95 57.3428C38.5 57.3712 39.05 57.4112 39.6
57.4786C40.15 57.546 40.7 57.7029 41.25 57.7472C41.8 57.7916 42.35 57.7962 42.9
57.7445C43.45 57.6928 44 57.5345 44.55 57.4373C45.1 57.34 45.65 57.2115 46.2 57
.1611C46.75 57.1107 47.3 57.1371 47.85 57.1349C48.4 57.1327 48.95 57.144 49.5 57
.1478C50.05 57.1516 50.6 57.1553 51.15 57.1579C51.7 57.1605 52.25 57.1601 52.8 5
7.1634C53.35 57.1667 53.9 57.1731 54.45 57.1776C55 57.182 55.55 57.1916 56.1 57.
19C56.65 57.1884 57.2 57.178 57.75 57.168C58.3 57.158 58.85 57.1355 59.4 57.1299
C59.95 57.1243 60.5 57.1338 61.05 57.1345C61.6 57.1352 62.15 57.124 62.7 57.134C
63.25 57.1441 63.8 57.1731 64.35 57.195C64.9 57.2169 65.45 57.2532 66 57.2655C66
.55 57.2778 67.1 57.2647 67.65 57.2687C68.2 57.2728 68.75 57.267 69.3 57.2896C69
.85 57.3122 70.4 57.371 70.95 57.4044C71.5 57.4377 72.05 57.4668 72.6 57.4896C73
.15 57.5123 73.7 57.545 74.25 57.5408C74.8 57.5365 75.35 57.5068 75.9 57.4641C76
.45 57.4213 77 57.3244 77.55 57.2842C78.1 57.244 78.65 57.2163 79.2 57.2228C79.7
5 57.2293 80.3 57.29 80.85 57.3232C81.4 57.3563 81.95 57.396 82.5 57.4219C83.05
57.4478 83.6 57.4637 84.15 57.4787C84.7 57.4937 85.25 57.5011 85.8 57.5121C86.35
57.523 86.9 57.5411 87.45 57.5444C88 57.5477 88.55 57.5663 89.1 57.5318C89.65 5
7.4972 90.2 57.3126 90.75 57.337C91.3 57.3613 91.85 57.6088 92.4 57.6776C92.95 5
7.7465 93.5 57.7379 94.05 57.75C94.6 57.7621 95.15 57.75 95.7 57.75L95.7 57.75L3
1.35 57.75Z"; |
3658 SkParsePath::FromSVGString(str, &path); | 3658 SkParsePath::FromSVGString(str, &path); |
3659 | 3659 |
3660 const char strB[] = "M31.35 57.75L31.35 57.75C31.9 57.7514 32.45 57.7052 33
57.7587C33.55 57.8122 34.1 57.9986 34.65 58.0709C35.2 58.1431 35.75 58.1777 36.3
58.1921C36.85 58.2065 37.4 58.1857 37.95 58.1572C38.5 58.1288 39.05 58.0888 39.
6 58.0214C40.15 57.954 40.7 57.7971 41.25 57.7528C41.8 57.7084 42.35 57.7038 42.
9 57.7555C43.45 57.8072 44 57.9655 44.55 58.0627C45.1 58.16 45.65 58.2885 46.2 5
8.3389C46.75 58.3893 47.3 58.3629 47.85 58.3651C48.4 58.3673 48.95 58.356 49.5 5
8.3522C50.05 58.3484 50.6 58.3447 51.15 58.3421C51.7 58.3395 52.25 58.3399 52.8
58.3366C53.35 58.3333 53.9 58.3269 54.45 58.3224C55 58.318 55.55 58.3084 56.1 58
.31C56.65 58.3116 57.2 58.322 57.75 58.332C58.3 58.342 58.85 58.3645 59.4 58.370
1C59.95 58.3757 60.5 58.3662 61.05 58.3655C61.6 58.3648 62.15 58.376 62.7 58.366
C63.25 58.3559 63.8 58.3269 64.35 58.305C64.9 58.2831 65.45 58.2468 66 58.2345C6
6.55 58.2222 67.1 58.2353 67.65 58.2313C68.2 58.2272 68.75 58.233 69.3 58.2104C6
9.85 58.1878 70.4 58.129 70.95 58.0956C71.5 58.0623 72.05 58.0332 72.6 58.0104C7
3.15 57.9877 73.7 57.955 74.25 57.9592C74.8 57.9635 75.35 57.9932 75.9 58.0359C7
6.45 58.0787 77 58.1756 77.55 58.2158C78.1 58.256 78.65 58.2837 79.2 58.2772C79.
75 58.2707 80.3 58.21 80.85 58.1768C81.4 58.1437 81.95 58.104 82.5 58.0781C83.05
58.0522 83.6 58.0363 84.15 58.0213C84.7 58.0063 85.25 57.9989 85.8 57.9879C86.3
5 57.977 86.9 57.9589 87.45 57.9556C88 57.9523 88.55 57.9337 89.1 57.9682C89.65
58.0028 90.2 58.1874 90.75 58.163C91.3 58.1387 91.85 57.8912 92.4 57.8224C92.95
57.7535 93.5 57.7621 94.05 57.75C94.6 57.7379 95.15 57.75 95.7 57.75L95.7 57.75L
31.35 57.75Z"; | 3660 const char strB[] = "M31.35 57.75L31.35 57.75C31.9 57.7514 32.45 57.7052 33
57.7587C33.55 57.8122 34.1 57.9986 34.65 58.0709C35.2 58.1431 35.75 58.1777 36.3
58.1921C36.85 58.2065 37.4 58.1857 37.95 58.1572C38.5 58.1288 39.05 58.0888 39.
6 58.0214C40.15 57.954 40.7 57.7971 41.25 57.7528C41.8 57.7084 42.35 57.7038 42.
9 57.7555C43.45 57.8072 44 57.9655 44.55 58.0627C45.1 58.16 45.65 58.2885 46.2 5
8.3389C46.75 58.3893 47.3 58.3629 47.85 58.3651C48.4 58.3673 48.95 58.356 49.5 5
8.3522C50.05 58.3484 50.6 58.3447 51.15 58.3421C51.7 58.3395 52.25 58.3399 52.8
58.3366C53.35 58.3333 53.9 58.3269 54.45 58.3224C55 58.318 55.55 58.3084 56.1 58
.31C56.65 58.3116 57.2 58.322 57.75 58.332C58.3 58.342 58.85 58.3645 59.4 58.370
1C59.95 58.3757 60.5 58.3662 61.05 58.3655C61.6 58.3648 62.15 58.376 62.7 58.366
C63.25 58.3559 63.8 58.3269 64.35 58.305C64.9 58.2831 65.45 58.2468 66 58.2345C6
6.55 58.2222 67.1 58.2353 67.65 58.2313C68.2 58.2272 68.75 58.233 69.3 58.2104C6
9.85 58.1878 70.4 58.129 70.95 58.0956C71.5 58.0623 72.05 58.0332 72.6 58.0104C7
3.15 57.9877 73.7 57.955 74.25 57.9592C74.8 57.9635 75.35 57.9932 75.9 58.0359C7
6.45 58.0787 77 58.1756 77.55 58.2158C78.1 58.256 78.65 58.2837 79.2 58.2772C79.
75 58.2707 80.3 58.21 80.85 58.1768C81.4 58.1437 81.95 58.104 82.5 58.0781C83.05
58.0522 83.6 58.0363 84.15 58.0213C84.7 58.0063 85.25 57.9989 85.8 57.9879C86.3
5 57.977 86.9 57.9589 87.45 57.9556C88 57.9523 88.55 57.9337 89.1 57.9682C89.65
58.0028 90.2 58.1874 90.75 58.163C91.3 58.1387 91.85 57.8912 92.4 57.8224C92.95
57.7535 93.5 57.7621 94.05 57.75C94.6 57.7379 95.15 57.75 95.7 57.75L95.7 57.75L
31.35 57.75Z"; |
3661 SkParsePath::FromSVGString(strB, &pathB); | 3661 SkParsePath::FromSVGString(strB, &pathB); |
3662 testPathOpCheck(reporter, path, pathB, kUnion_SkPathOp, filename, FLAGS_runF
ail); | 3662 testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename); |
3663 } | 3663 } |
3664 | 3664 |
3665 static void cubicOp119(skiatest::Reporter* reporter, const char* filename) { | 3665 static void cubicOp119(skiatest::Reporter* reporter, const char* filename) { |
3666 SkPath path, pathB; | 3666 SkPath path, pathB; |
3667 path.setFillType(SkPath::kWinding_FillType); | 3667 path.setFillType(SkPath::kWinding_FillType); |
3668 path.moveTo(0,1); | 3668 path.moveTo(0,1); |
3669 path.cubicTo(3,5, 2,1, 3,1); | 3669 path.cubicTo(3,5, 2,1, 3,1); |
3670 path.close(); | 3670 path.close(); |
3671 pathB.setFillType(SkPath::kWinding_FillType); | 3671 pathB.setFillType(SkPath::kWinding_FillType); |
3672 pathB.moveTo(1,2); | 3672 pathB.moveTo(1,2); |
(...skipping 1418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5091 void loops61i(skiatest::Reporter* reporter, const char* filename) { | 5091 void loops61i(skiatest::Reporter* reporter, const char* filename) { |
5092 SkPath path, pathB; | 5092 SkPath path, pathB; |
5093 path.setFillType(SkPath::kWinding_FillType); | 5093 path.setFillType(SkPath::kWinding_FillType); |
5094 path.moveTo(0, 1); | 5094 path.moveTo(0, 1); |
5095 path.cubicTo(1, 5, -6.33333302f, 0.666666627f, 8, -1); | 5095 path.cubicTo(1, 5, -6.33333302f, 0.666666627f, 8, -1); |
5096 path.close(); | 5096 path.close(); |
5097 pathB.setFillType(SkPath::kWinding_FillType); | 5097 pathB.setFillType(SkPath::kWinding_FillType); |
5098 pathB.moveTo(1, 5); | 5098 pathB.moveTo(1, 5); |
5099 pathB.cubicTo(-6.33333302f, 0.666666627f, 8, -1, 0, 1); | 5099 pathB.cubicTo(-6.33333302f, 0.666666627f, 8, -1, 0, 1); |
5100 pathB.close(); | 5100 pathB.close(); |
5101 testPathOpCheck(reporter, path, pathB, kIntersect_SkPathOp, filename, FLAGS_
runFail); | 5101 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename); |
5102 } | 5102 } |
5103 | 5103 |
5104 static void loops62i(skiatest::Reporter* reporter, const char* filename) { | 5104 static void loops62i(skiatest::Reporter* reporter, const char* filename) { |
5105 SkPath path, pathB; | 5105 SkPath path, pathB; |
5106 path.setFillType(SkPath::kWinding_FillType); | 5106 path.setFillType(SkPath::kWinding_FillType); |
5107 path.moveTo(0, 2); | 5107 path.moveTo(0, 2); |
5108 path.cubicTo(1, 6, -6.33333302f, 1.66666663f, 8, 0); | 5108 path.cubicTo(1, 6, -6.33333302f, 1.66666663f, 8, 0); |
5109 path.close(); | 5109 path.close(); |
5110 pathB.setFillType(SkPath::kWinding_FillType); | 5110 pathB.setFillType(SkPath::kWinding_FillType); |
5111 pathB.moveTo(1, 6); | 5111 pathB.moveTo(1, 6); |
5112 pathB.cubicTo(-6.33333302f, 1.66666663f, 8, 0, 0, 2); | 5112 pathB.cubicTo(-6.33333302f, 1.66666663f, 8, 0, 0, 2); |
5113 pathB.close(); | 5113 pathB.close(); |
5114 testPathOpCheck(reporter, path, pathB, kIntersect_SkPathOp, filename, FLAGS_
runFail); | 5114 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename); |
5115 } | 5115 } |
5116 | 5116 |
5117 static void loops63i(skiatest::Reporter* reporter, const char* filename) { | 5117 static void loops63i(skiatest::Reporter* reporter, const char* filename) { |
5118 SkPath path, pathB; | 5118 SkPath path, pathB; |
5119 path.setFillType(SkPath::kWinding_FillType); | 5119 path.setFillType(SkPath::kWinding_FillType); |
5120 path.moveTo(0, 1); | 5120 path.moveTo(0, 1); |
5121 path.cubicTo(2, 4, -4, -0.833333254f, 6, -3); | 5121 path.cubicTo(2, 4, -4, -0.833333254f, 6, -3); |
5122 path.close(); | 5122 path.close(); |
5123 pathB.setFillType(SkPath::kWinding_FillType); | 5123 pathB.setFillType(SkPath::kWinding_FillType); |
5124 pathB.moveTo(2, 4); | 5124 pathB.moveTo(2, 4); |
5125 pathB.cubicTo(-4, -0.833333254f, 6, -3, 0, 1); | 5125 pathB.cubicTo(-4, -0.833333254f, 6, -3, 0, 1); |
5126 pathB.close(); | 5126 pathB.close(); |
5127 testPathOpCheck(reporter, path, pathB, kIntersect_SkPathOp, filename, FLAGS_
runFail); | 5127 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename); |
5128 } | 5128 } |
5129 | 5129 |
5130 static void cubics44d(skiatest::Reporter* reporter, const char* filename) { | 5130 static void cubics44d(skiatest::Reporter* reporter, const char* filename) { |
5131 SkPath path, pathB; | 5131 SkPath path, pathB; |
5132 path.setFillType(SkPath::kWinding_FillType); | 5132 path.setFillType(SkPath::kWinding_FillType); |
5133 path.moveTo(3, 4); | 5133 path.moveTo(3, 4); |
5134 path.cubicTo(2, 5, 3, 1, 6, 2); | 5134 path.cubicTo(2, 5, 3, 1, 6, 2); |
5135 path.close(); | 5135 path.close(); |
5136 pathB.setFillType(SkPath::kWinding_FillType); | 5136 pathB.setFillType(SkPath::kWinding_FillType); |
5137 pathB.moveTo(1, 3); | 5137 pathB.moveTo(1, 3); |
5138 pathB.cubicTo(2, 6, 4, 3, 5, 2); | 5138 pathB.cubicTo(2, 6, 4, 3, 5, 2); |
5139 pathB.close(); | 5139 pathB.close(); |
5140 testPathOpCheck(reporter, path, pathB, kDifference_SkPathOp, filename, FLAGS
_runFail); | 5140 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); |
5141 } | 5141 } |
5142 | 5142 |
5143 static void cubics45u(skiatest::Reporter* reporter, const char* filename) { | 5143 static void cubics45u(skiatest::Reporter* reporter, const char* filename) { |
5144 SkPath path, pathB; | 5144 SkPath path, pathB; |
5145 path.setFillType(SkPath::kWinding_FillType); | 5145 path.setFillType(SkPath::kWinding_FillType); |
5146 path.moveTo(1, 3); | 5146 path.moveTo(1, 3); |
5147 path.cubicTo(2, 6, 4, 3, 5, 2); | 5147 path.cubicTo(2, 6, 4, 3, 5, 2); |
5148 path.close(); | 5148 path.close(); |
5149 pathB.setFillType(SkPath::kWinding_FillType); | 5149 pathB.setFillType(SkPath::kWinding_FillType); |
5150 pathB.moveTo(3, 4); | 5150 pathB.moveTo(3, 4); |
5151 pathB.cubicTo(2, 5, 3, 1, 6, 2); | 5151 pathB.cubicTo(2, 5, 3, 1, 6, 2); |
5152 pathB.close(); | 5152 pathB.close(); |
5153 testPathOpCheck(reporter, path, pathB, kUnion_SkPathOp, filename, FLAGS_runF
ail); | 5153 testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename); |
5154 } | 5154 } |
5155 | 5155 |
5156 static void (*skipTest)(skiatest::Reporter* , const char* filename) = 0; | 5156 static void (*skipTest)(skiatest::Reporter* , const char* filename) = 0; |
5157 static void (*firstTest)(skiatest::Reporter* , const char* filename) = 0; | 5157 static void (*firstTest)(skiatest::Reporter* , const char* filename) = loops63i; |
5158 static void (*stopTest)(skiatest::Reporter* , const char* filename) = 0; | 5158 static void (*stopTest)(skiatest::Reporter* , const char* filename) = 0; |
5159 | 5159 |
5160 #define TEST(name) { name, #name } | 5160 #define TEST(name) { name, #name } |
5161 | 5161 |
5162 static struct TestDesc tests[] = { | 5162 static struct TestDesc tests[] = { |
5163 TEST(cubics44d), | 5163 TEST(cubics44d), |
5164 TEST(cubics45u), | 5164 TEST(cubics45u), |
5165 TEST(loops61i), | 5165 TEST(loops61i), |
5166 TEST(loops62i), | 5166 TEST(loops62i), |
5167 TEST(loops63i), | 5167 TEST(loops63i), |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5490 TEST(cubicOp6d), | 5490 TEST(cubicOp6d), |
5491 TEST(cubicOp5d), | 5491 TEST(cubicOp5d), |
5492 TEST(cubicOp3d), | 5492 TEST(cubicOp3d), |
5493 TEST(cubicOp2d), | 5493 TEST(cubicOp2d), |
5494 TEST(cubicOp1d), | 5494 TEST(cubicOp1d), |
5495 }; | 5495 }; |
5496 | 5496 |
5497 static const size_t testCount = SK_ARRAY_COUNT(tests); | 5497 static const size_t testCount = SK_ARRAY_COUNT(tests); |
5498 | 5498 |
5499 static struct TestDesc subTests[] = { | 5499 static struct TestDesc subTests[] = { |
5500 TEST(cubics45u), | 5500 TEST(loops47i), |
5501 TEST(loops61i), | 5501 TEST(loops61i), |
5502 TEST(loops62i), | 5502 TEST(loops62i), |
| 5503 TEST(issue3517), |
5503 }; | 5504 }; |
5504 | 5505 |
5505 static const size_t subTestCount = SK_ARRAY_COUNT(subTests); | 5506 static const size_t subTestCount = SK_ARRAY_COUNT(subTests); |
5506 | 5507 |
5507 static void (*firstSubTest)(skiatest::Reporter* , const char* filename) = 0; | 5508 static void (*firstSubTest)(skiatest::Reporter* , const char* filename) = 0; |
5508 | 5509 |
5509 static bool runSubTests = true; | 5510 static bool runSubTests = false; |
5510 static bool runSubTestsFirst = true; | 5511 static bool runSubTestsFirst = true; |
5511 static bool runReverse = false; | 5512 static bool runReverse = false; |
5512 | 5513 |
5513 DEF_TEST(PathOpsOp, reporter) { | 5514 DEF_TEST(PathOpsOp, reporter) { |
5514 #if DEBUG_SHOW_TEST_NAME | 5515 #if DEBUG_SHOW_TEST_NAME |
5515 strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH); | 5516 strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH); |
5516 #endif | 5517 #endif |
5517 if (runSubTests && runSubTestsFirst) { | 5518 if (runSubTests && runSubTestsFirst) { |
5518 RunTestSet(reporter, subTests, subTestCount, firstSubTest, NULL, stopTes
t, runReverse); | 5519 RunTestSet(reporter, subTests, subTestCount, firstSubTest, NULL, stopTes
t, runReverse); |
5519 } | 5520 } |
5520 RunTestSet(reporter, tests, testCount, firstTest, skipTest, stopTest, runRev
erse); | 5521 RunTestSet(reporter, tests, testCount, firstTest, skipTest, stopTest, runRev
erse); |
5521 if (runSubTests && !runSubTestsFirst) { | 5522 if (runSubTests && !runSubTestsFirst) { |
5522 RunTestSet(reporter, subTests, subTestCount, firstSubTest, NULL, stopTes
t, runReverse); | 5523 RunTestSet(reporter, subTests, subTestCount, firstSubTest, NULL, stopTes
t, runReverse); |
5523 } | 5524 } |
5524 } | 5525 } |
5525 | 5526 |
5526 static void bufferOverflow(skiatest::Reporter* reporter, const char* filename) { | 5527 static void bufferOverflow(skiatest::Reporter* reporter, const char* filename) { |
5527 SkPath path; | 5528 SkPath path; |
5528 path.addRect(0,0, 300,170141183460469231731687303715884105728.f); | 5529 path.addRect(0,0, 300,170141183460469231731687303715884105728.f); |
5529 SkPath pathB; | 5530 SkPath pathB; |
5530 pathB.addRect(0,0, 300,16); | 5531 pathB.addRect(0,0, 300,16); |
5531 testPathOpFailCheck(reporter, path, pathB, kUnion_SkPathOp, filename); | 5532 testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename); |
5532 } | 5533 } |
5533 | 5534 |
5534 // m 100,0 60,170 -160,-110 200,0 -170,11000000000 z | 5535 // m 100,0 60,170 -160,-110 200,0 -170,11000000000 z |
5535 static void fuzz433(skiatest::Reporter* reporter, const char* filename) { | 5536 static void fuzz433(skiatest::Reporter* reporter, const char* filename) { |
5536 SkPath path1, path2; | 5537 SkPath path1, path2; |
5537 path1.moveTo(100,0); | 5538 path1.moveTo(100,0); |
5538 path1.lineTo(60,170); | 5539 path1.lineTo(60,170); |
5539 path1.lineTo(-160,-110); | 5540 path1.lineTo(-160,-110); |
5540 path1.lineTo(200,0); | 5541 path1.lineTo(200,0); |
5541 path1.lineTo(-170,11000000000.0f); | 5542 path1.lineTo(-170,11000000000.0f); |
5542 path1.close(); | 5543 path1.close(); |
5543 | 5544 |
5544 path2.moveTo(100 + 20,0 + 20); | 5545 path2.moveTo(100 + 20,0 + 20); |
5545 path2.lineTo(60 + 20,170 + 20); | 5546 path2.lineTo(60 + 20,170 + 20); |
5546 path2.lineTo(-160 + 20,-110 + 20); | 5547 path2.lineTo(-160 + 20,-110 + 20); |
5547 path2.lineTo(200 + 20,0 + 20); | 5548 path2.lineTo(200 + 20,0 + 20); |
5548 path2.lineTo(-170 + 20,11000000000.0f + 20); | 5549 path2.lineTo(-170 + 20,11000000000.0f + 20); |
5549 path2.close(); | 5550 path2.close(); |
5550 | 5551 |
5551 testPathOpFailCheck(reporter, path1, path2, kIntersect_SkPathOp, filename); | 5552 testPathOpCheck(reporter, path1, path2, kIntersect_SkPathOp, filename, FLAGS
_runFail); |
5552 } | 5553 } |
5553 | 5554 |
5554 static void fuzz433b(skiatest::Reporter* reporter, const char* filename) { | 5555 static void fuzz433b(skiatest::Reporter* reporter, const char* filename) { |
5555 SkPath path1, path2; | 5556 SkPath path1, path2; |
5556 path1.setFillType(SkPath::kEvenOdd_FillType); | 5557 path1.setFillType(SkPath::kEvenOdd_FillType); |
5557 path1.moveTo(140, 40); | 5558 path1.moveTo(140, 40); |
5558 path1.lineTo(200, 210); | 5559 path1.lineTo(200, 210); |
5559 path1.lineTo(40, 100); | 5560 path1.lineTo(40, 100); |
5560 path1.lineTo(240, 100); | 5561 path1.lineTo(240, 100); |
5561 path1.lineTo(70, 1.1e+10f); | 5562 path1.lineTo(70, 1.1e+10f); |
5562 path1.lineTo(140, 40); | 5563 path1.lineTo(140, 40); |
5563 path1.close(); | 5564 path1.close(); |
5564 | 5565 |
5565 path1.setFillType(SkPath::kWinding_FillType); | 5566 path1.setFillType(SkPath::kWinding_FillType); |
5566 path2.moveTo(190, 60); | 5567 path2.moveTo(190, 60); |
5567 path2.lineTo(250, 230); | 5568 path2.lineTo(250, 230); |
5568 path2.lineTo(90, 120); | 5569 path2.lineTo(90, 120); |
5569 path2.lineTo(290, 120); | 5570 path2.lineTo(290, 120); |
5570 path2.lineTo(120, 1.1e+10f); | 5571 path2.lineTo(120, 1.1e+10f); |
5571 path2.lineTo(190, 60); | 5572 path2.lineTo(190, 60); |
5572 path2.close(); | 5573 path2.close(); |
5573 | 5574 |
5574 testPathOpFailCheck(reporter, path1, path2, kUnion_SkPathOp, filename); | 5575 testPathOpCheck(reporter, path1, path2, kUnion_SkPathOp, filename, FLAGS_run
Fail); |
5575 } | 5576 } |
5576 | 5577 |
5577 static void fuzz487a(skiatest::Reporter* reporter, const char* filename) { | 5578 static void fuzz487a(skiatest::Reporter* reporter, const char* filename) { |
5578 SkPath path; | 5579 SkPath path; |
5579 path.setFillType((SkPath::FillType) 0); | 5580 path.setFillType((SkPath::FillType) 0); |
5580 path.moveTo(SkBits2Float(0x432c8000), SkBits2Float(0x42c00000)); | 5581 path.moveTo(SkBits2Float(0x432c8000), SkBits2Float(0x42c00000)); |
5581 path.lineTo(SkBits2Float(0x4309999a), SkBits2Float(0x42c00000)); | 5582 path.lineTo(SkBits2Float(0x4309999a), SkBits2Float(0x42c00000)); |
5582 path.cubicTo(SkBits2Float(0x4309999a), SkBits2Float(0x429a6666), SkBits2Float(0x
42f9999a), SkBits2Float(0x4275999a), SkBits2Float(0x42d70001), SkBits2Float(0x42
633333)); | 5583 path.cubicTo(SkBits2Float(0x4309999a), SkBits2Float(0x429a6666), SkBits2Float(0x
42f9999a), SkBits2Float(0x4275999a), SkBits2Float(0x42d70001), SkBits2Float(0x42
633333)); |
5583 path.lineTo(SkBits2Float(0x42e90001), SkBits2Float(0x41b8cccc)); | 5584 path.lineTo(SkBits2Float(0x42e90001), SkBits2Float(0x41b8cccc)); |
5584 path.cubicTo(SkBits2Float(0x42dc6667), SkBits2Float(0x41ab3332), SkBits2Float(0x
42cf3334), SkBits2Float(0x41a3ffff), SkBits2Float(0x42c20001), SkBits2Float(0x41
a3ffff)); | 5585 path.cubicTo(SkBits2Float(0x42dc6667), SkBits2Float(0x41ab3332), SkBits2Float(0x
42cf3334), SkBits2Float(0x41a3ffff), SkBits2Float(0x42c20001), SkBits2Float(0x41
a3ffff)); |
(...skipping 25 matching lines...) Expand all Loading... |
5610 path.cubicTo(SkBits2Float(0x4272cccc), SkBits2Float(0x4303199a), SkBits2Float(0x
423d3332), SkBits2Float(0x430de667), SkBits2Float(0x422d9999), SkBits2Float(0x43
1cb334)); | 5611 path.cubicTo(SkBits2Float(0x4272cccc), SkBits2Float(0x4303199a), SkBits2Float(0x
423d3332), SkBits2Float(0x430de667), SkBits2Float(0x422d9999), SkBits2Float(0x43
1cb334)); |
5611 path.lineTo(SkBits2Float(0x7086a1dc), SkBits2Float(0x42eecccd)); | 5612 path.lineTo(SkBits2Float(0x7086a1dc), SkBits2Float(0x42eecccd)); |
5612 path.lineTo(SkBits2Float(0x41eb3333), SkBits2Float(0xc12ccccd)); | 5613 path.lineTo(SkBits2Float(0x41eb3333), SkBits2Float(0xc12ccccd)); |
5613 path.lineTo(SkBits2Float(0x42053333), SkBits2Float(0xc1cccccd)); | 5614 path.lineTo(SkBits2Float(0x42053333), SkBits2Float(0xc1cccccd)); |
5614 path.lineTo(SkBits2Float(0x42780000), SkBits2Float(0xc18f3334)); | 5615 path.lineTo(SkBits2Float(0x42780000), SkBits2Float(0xc18f3334)); |
5615 path.cubicTo(SkBits2Float(0x43206666), SkBits2Float(0x43134ccd), SkBits2Float(0x
43213333), SkBits2Float(0x430db333), SkBits2Float(0x43213333), SkBits2Float(0x43
080000)); | 5616 path.cubicTo(SkBits2Float(0x43206666), SkBits2Float(0x43134ccd), SkBits2Float(0x
43213333), SkBits2Float(0x430db333), SkBits2Float(0x43213333), SkBits2Float(0x43
080000)); |
5616 path.lineTo(SkBits2Float(0x432c8000), SkBits2Float(0x42c00000)); | 5617 path.lineTo(SkBits2Float(0x432c8000), SkBits2Float(0x42c00000)); |
5617 path.close(); | 5618 path.close(); |
5618 | 5619 |
5619 SkPath path2(path); | 5620 SkPath path2(path); |
5620 testPathOpFailCheck(reporter, path1, path2, (SkPathOp) 2, filename); | 5621 testPathOpCheck(reporter, path1, path2, (SkPathOp) 2, filename, FLAGS_runFai
l); |
5621 } | 5622 } |
5622 | 5623 |
5623 static void fuzz487b(skiatest::Reporter* reporter, const char* filename) { | 5624 static void fuzz487b(skiatest::Reporter* reporter, const char* filename) { |
5624 SkPath path; | 5625 SkPath path; |
5625 path.setFillType((SkPath::FillType) 0); | 5626 path.setFillType((SkPath::FillType) 0); |
5626 path.moveTo(SkBits2Float(0x432c8000), SkBits2Float(0x42c00000)); | 5627 path.moveTo(SkBits2Float(0x432c8000), SkBits2Float(0x42c00000)); |
5627 path.lineTo(SkBits2Float(0x4309999a), SkBits2Float(0x42c00000)); | 5628 path.lineTo(SkBits2Float(0x4309999a), SkBits2Float(0x42c00000)); |
5628 path.cubicTo(SkBits2Float(0x4309999a), SkBits2Float(0x429a6666), SkBits2Float(0x
42f9999a), SkBits2Float(0x4275999a), SkBits2Float(0x42d70001), SkBits2Float(0x42
633333)); | 5629 path.cubicTo(SkBits2Float(0x4309999a), SkBits2Float(0x429a6666), SkBits2Float(0x
42f9999a), SkBits2Float(0x4275999a), SkBits2Float(0x42d70001), SkBits2Float(0x42
633333)); |
5629 path.lineTo(SkBits2Float(0x42e90001), SkBits2Float(0x41b8cccc)); | 5630 path.lineTo(SkBits2Float(0x42e90001), SkBits2Float(0x41b8cccc)); |
5630 path.cubicTo(SkBits2Float(0x42dc6667), SkBits2Float(0x41ab3332), SkBits2Float(0x
42cf3334), SkBits2Float(0x41a3ffff), SkBits2Float(0x42c20001), SkBits2Float(0x41
a3ffff)); | 5631 path.cubicTo(SkBits2Float(0x42dc6667), SkBits2Float(0x41ab3332), SkBits2Float(0x
42cf3334), SkBits2Float(0x41a3ffff), SkBits2Float(0x42c20001), SkBits2Float(0x41
a3ffff)); |
(...skipping 25 matching lines...) Expand all Loading... |
5656 path.cubicTo(SkBits2Float(0x4272cccc), SkBits2Float(0x4303199a), SkBits2Float(0x
423d3332), SkBits2Float(0x430de667), SkBits2Float(0x422d9999), SkBits2Float(0x43
1cb334)); | 5657 path.cubicTo(SkBits2Float(0x4272cccc), SkBits2Float(0x4303199a), SkBits2Float(0x
423d3332), SkBits2Float(0x430de667), SkBits2Float(0x422d9999), SkBits2Float(0x43
1cb334)); |
5657 path.lineTo(SkBits2Float(0x7086a1dc), SkBits2Float(0x42eecccd)); | 5658 path.lineTo(SkBits2Float(0x7086a1dc), SkBits2Float(0x42eecccd)); |
5658 path.lineTo(SkBits2Float(0x41eb3333), SkBits2Float(0xc12ccccd)); | 5659 path.lineTo(SkBits2Float(0x41eb3333), SkBits2Float(0xc12ccccd)); |
5659 path.lineTo(SkBits2Float(0x42053333), SkBits2Float(0xc1cccccd)); | 5660 path.lineTo(SkBits2Float(0x42053333), SkBits2Float(0xc1cccccd)); |
5660 path.lineTo(SkBits2Float(0x42780000), SkBits2Float(0xc18f3334)); | 5661 path.lineTo(SkBits2Float(0x42780000), SkBits2Float(0xc18f3334)); |
5661 path.cubicTo(SkBits2Float(0x43206666), SkBits2Float(0x43134ccd), SkBits2Float(0x
43213333), SkBits2Float(0x430db333), SkBits2Float(0x43213333), SkBits2Float(0x43
080000)); | 5662 path.cubicTo(SkBits2Float(0x43206666), SkBits2Float(0x43134ccd), SkBits2Float(0x
43213333), SkBits2Float(0x430db333), SkBits2Float(0x43213333), SkBits2Float(0x43
080000)); |
5662 path.lineTo(SkBits2Float(0x432c8000), SkBits2Float(0x42c00000)); | 5663 path.lineTo(SkBits2Float(0x432c8000), SkBits2Float(0x42c00000)); |
5663 path.close(); | 5664 path.close(); |
5664 | 5665 |
5665 SkPath path2(path); | 5666 SkPath path2(path); |
5666 testPathOpFailCheck(reporter, path1, path2, (SkPathOp) 2, filename); | 5667 testPathOpCheck(reporter, path1, path2, (SkPathOp) 2, filename, FLAGS_runFai
l); |
5667 } | 5668 } |
5668 | 5669 |
5669 static void fuzz714(skiatest::Reporter* reporter, const char* filename) { | 5670 static void fuzz714(skiatest::Reporter* reporter, const char* filename) { |
5670 SkPath path; | 5671 SkPath path; |
5671 path.setFillType((SkPath::FillType) 1); | 5672 path.setFillType((SkPath::FillType) 1); |
5672 path.moveTo(SkBits2Float(0x430c0000), SkBits2Float(0x42200000)); | 5673 path.moveTo(SkBits2Float(0x430c0000), SkBits2Float(0x42200000)); |
5673 path.lineTo(SkBits2Float(0x43480000), SkBits2Float(0x43520000)); | 5674 path.lineTo(SkBits2Float(0x43480000), SkBits2Float(0x43520000)); |
5674 path.lineTo(SkBits2Float(0x42200000), SkBits2Float(0x42c80000)); | 5675 path.lineTo(SkBits2Float(0x42200000), SkBits2Float(0x42c80000)); |
5675 path.lineTo(SkBits2Float(0x64969569), SkBits2Float(0x42c80000)); // 2.22222e+02
2f | 5676 path.lineTo(SkBits2Float(0x64969569), SkBits2Float(0x42c80000)); // 2.22222e+02
2f |
5676 path.lineTo(SkBits2Float(0x64969569), SkBits2Float(0x43520000)); // 2.22222e+02
2f | 5677 path.lineTo(SkBits2Float(0x64969569), SkBits2Float(0x43520000)); // 2.22222e+02
2f |
5677 path.lineTo(SkBits2Float(0x430c0000), SkBits2Float(0x42200000)); | 5678 path.lineTo(SkBits2Float(0x430c0000), SkBits2Float(0x42200000)); |
5678 path.close(); | 5679 path.close(); |
5679 | 5680 |
5680 SkPath path1(path); | 5681 SkPath path1(path); |
5681 path.reset(); | 5682 path.reset(); |
5682 path.setFillType((SkPath::FillType) 0); | 5683 path.setFillType((SkPath::FillType) 0); |
5683 path.moveTo(SkBits2Float(0x43200000), SkBits2Float(0x42700000)); | 5684 path.moveTo(SkBits2Float(0x43200000), SkBits2Float(0x42700000)); |
5684 path.lineTo(SkBits2Float(0x435c0000), SkBits2Float(0x43660000)); | 5685 path.lineTo(SkBits2Float(0x435c0000), SkBits2Float(0x43660000)); |
5685 path.lineTo(SkBits2Float(0x42700000), SkBits2Float(0x42f00000)); | 5686 path.lineTo(SkBits2Float(0x42700000), SkBits2Float(0x42f00000)); |
5686 path.lineTo(SkBits2Float(0x64969569), SkBits2Float(0x42f00000)); // 2.22222e+02
2f | 5687 path.lineTo(SkBits2Float(0x64969569), SkBits2Float(0x42f00000)); // 2.22222e+02
2f |
5687 path.lineTo(SkBits2Float(0x64969569), SkBits2Float(0x43660000)); // 2.22222e+02
2f | 5688 path.lineTo(SkBits2Float(0x64969569), SkBits2Float(0x43660000)); // 2.22222e+02
2f |
5688 path.lineTo(SkBits2Float(0x43200000), SkBits2Float(0x42700000)); | 5689 path.lineTo(SkBits2Float(0x43200000), SkBits2Float(0x42700000)); |
5689 path.close(); | 5690 path.close(); |
5690 | 5691 |
5691 SkPath path2(path); | 5692 SkPath path2(path); |
5692 testPathOpFailCheck(reporter, path1, path2, (SkPathOp) 2, filename); | 5693 testPathOpCheck(reporter, path1, path2, (SkPathOp) 2, filename, FLAGS_runFai
l); |
5693 } | 5694 } |
5694 | 5695 |
5695 static void fuzz1(skiatest::Reporter* reporter, const char* filename) { | 5696 static void fuzz1(skiatest::Reporter* reporter, const char* filename) { |
5696 SkPath path; | 5697 SkPath path; |
5697 path.setFillType((SkPath::FillType) 0); | 5698 path.setFillType((SkPath::FillType) 0); |
5698 path.moveTo(SkBits2Float(0x7f800000), SkBits2Float(0x7f800000)); | 5699 path.moveTo(SkBits2Float(0x7f800000), SkBits2Float(0x7f800000)); |
5699 path.quadTo(SkBits2Float(0x7f800000), SkBits2Float(0x7f800000), SkBits2Float(0x7
f800000), SkBits2Float(0x7f800000)); | 5700 path.quadTo(SkBits2Float(0x7f800000), SkBits2Float(0x7f800000), SkBits2Float(0x7
f800000), SkBits2Float(0x7f800000)); |
5700 path.quadTo(SkBits2Float(0x7f800000), SkBits2Float(0x7f800000), SkBits2Float(0x7
f800000), SkBits2Float(0x7f800000)); | 5701 path.quadTo(SkBits2Float(0x7f800000), SkBits2Float(0x7f800000), SkBits2Float(0x7
f800000), SkBits2Float(0x7f800000)); |
5701 path.quadTo(SkBits2Float(0xffc00000), SkBits2Float(0x7f800000), SkBits2Float(0xf
fc00000), SkBits2Float(0x7f800000)); | 5702 path.quadTo(SkBits2Float(0xffc00000), SkBits2Float(0x7f800000), SkBits2Float(0xf
fc00000), SkBits2Float(0x7f800000)); |
5702 path.quadTo(SkBits2Float(0xff000001), SkBits2Float(0x7f800000), SkBits2Float(0xf
f000001), SkBits2Float(0x7f800000)); | 5703 path.quadTo(SkBits2Float(0xff000001), SkBits2Float(0x7f800000), SkBits2Float(0xf
f000001), SkBits2Float(0x7f800000)); |
(...skipping 22 matching lines...) Expand all Loading... |
5725 }; | 5726 }; |
5726 | 5727 |
5727 static const size_t failTestCount = SK_ARRAY_COUNT(failTests); | 5728 static const size_t failTestCount = SK_ARRAY_COUNT(failTests); |
5728 | 5729 |
5729 DEF_TEST(PathOpsFailOp, reporter) { | 5730 DEF_TEST(PathOpsFailOp, reporter) { |
5730 #if DEBUG_SHOW_TEST_NAME | 5731 #if DEBUG_SHOW_TEST_NAME |
5731 strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH); | 5732 strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH); |
5732 #endif | 5733 #endif |
5733 RunTestSet(reporter, failTests, failTestCount, NULL, NULL, NULL, false); | 5734 RunTestSet(reporter, failTests, failTestCount, NULL, NULL, NULL, false); |
5734 } | 5735 } |
OLD | NEW |