Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(444)

Side by Side Diff: tests/PathOpsOpTest.cpp

Issue 1730293002: fix path ops fuzz bug (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/pathops/SkPathOpsCommon.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 5546 matching lines...) Expand 10 before | Expand all | Expand 10 after
5557 #endif 5557 #endif
5558 if (runSubTests && runSubTestsFirst) { 5558 if (runSubTests && runSubTestsFirst) {
5559 RunTestSet(reporter, subTests, subTestCount, firstSubTest, nullptr, stop Test, runReverse); 5559 RunTestSet(reporter, subTests, subTestCount, firstSubTest, nullptr, stop Test, runReverse);
5560 } 5560 }
5561 RunTestSet(reporter, tests, testCount, firstTest, skipTest, stopTest, runRev erse); 5561 RunTestSet(reporter, tests, testCount, firstTest, skipTest, stopTest, runRev erse);
5562 if (runSubTests && !runSubTestsFirst) { 5562 if (runSubTests && !runSubTestsFirst) {
5563 RunTestSet(reporter, subTests, subTestCount, firstSubTest, nullptr, stop Test, runReverse); 5563 RunTestSet(reporter, subTests, subTestCount, firstSubTest, nullptr, stop Test, runReverse);
5564 } 5564 }
5565 } 5565 }
5566 5566
5567 static void fuzz535151(skiatest::Reporter* reporter, const char* filename) {
5568 SkPath one;
5569 one.setFillType(SkPath::kWinding_FillType);
5570 SkPath two;
5571 two.setFillType(SkPath::kWinding_FillType);
5572 two.moveTo(0, 0);
5573 two.lineTo(0, 50);
5574 two.lineTo(4.29497e+09f, 50);
5575 SkPath dummy;
5576 REPORTER_ASSERT(reporter, !Op(one, two, kIntersect_SkPathOp, &dummy));
5577 }
5578
5567 static void bufferOverflow(skiatest::Reporter* reporter, const char* filename) { 5579 static void bufferOverflow(skiatest::Reporter* reporter, const char* filename) {
5568 SkPath path; 5580 SkPath path;
5569 path.addRect(0,0, 300,170141183460469231731687303715884105728.f); 5581 path.addRect(0,0, 300,170141183460469231731687303715884105728.f);
5570 SkPath pathB; 5582 SkPath pathB;
5571 pathB.addRect(0,0, 300,16); 5583 pathB.addRect(0,0, 300,16);
5572 testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename); 5584 testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
5573 } 5585 }
5574 5586
5575 // m 100,0 60,170 -160,-110 200,0 -170,11000000000 z 5587 // m 100,0 60,170 -160,-110 200,0 -170,11000000000 z
5576 static void fuzz433(skiatest::Reporter* reporter, const char* filename) { 5588 static void fuzz433(skiatest::Reporter* reporter, const char* filename) {
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
5774 path.cubicTo(SkBits2Float(0x4220d9fc), SkBits2Float(0xcf223cc0), SkBits2Float(0x 420ee118), SkBits2Float(0xcf223cc0), SkBits2Float(0x41cef2f8), SkBits2Float(0xcf 223cc0)); // 40.2129f, -2.72189e+09f, 35.7198f, -2.72189e+09f, 25.8686f, -2.721 89e+09f 5786 path.cubicTo(SkBits2Float(0x4220d9fc), SkBits2Float(0xcf223cc0), SkBits2Float(0x 420ee118), SkBits2Float(0xcf223cc0), SkBits2Float(0x41cef2f8), SkBits2Float(0xcf 223cc0)); // 40.2129f, -2.72189e+09f, 35.7198f, -2.72189e+09f, 25.8686f, -2.721 89e+09f
5775 path.lineTo(SkBits2Float(0x424a99e0), SkBits2Float(0xcf223cc0)); // 50.6503f, - 2.72189e+09f 5787 path.lineTo(SkBits2Float(0x424a99e0), SkBits2Float(0xcf223cc0)); // 50.6503f, - 2.72189e+09f
5776 path.cubicTo(SkBits2Float(0x42266e32), SkBits2Float(0xcf223cc0), SkBits2Float(0x 41f0fa20), SkBits2Float(0xcf223cc0), SkBits2Float(0x41872ed4), SkBits2Float(0xcf 223cc0)); // 41.6076f, -2.72189e+09f, 30.1221f, -2.72189e+09f, 16.8979f, -2.721 89e+09f 5788 path.cubicTo(SkBits2Float(0x42266e32), SkBits2Float(0xcf223cc0), SkBits2Float(0x 41f0fa20), SkBits2Float(0xcf223cc0), SkBits2Float(0x41872ed4), SkBits2Float(0xcf 223cc0)); // 41.6076f, -2.72189e+09f, 30.1221f, -2.72189e+09f, 16.8979f, -2.721 89e+09f
5777 path.lineTo(SkBits2Float(0x40f8fbe0), SkBits2Float(0xcf223cc0)); // 7.78075f, - 2.72189e+09f 5789 path.lineTo(SkBits2Float(0x40f8fbe0), SkBits2Float(0xcf223cc0)); // 7.78075f, - 2.72189e+09f
5778 5790
5779 SkPath path2(path); 5791 SkPath path2(path);
5780 testPathFailOp(reporter, path1, path2, (SkPathOp) 2, filename); 5792 testPathFailOp(reporter, path1, path2, (SkPathOp) 2, filename);
5781 } 5793 }
5782 5794
5783 static struct TestDesc failTests[] = { 5795 static struct TestDesc failTests[] = {
5796 TEST(fuzz535151),
5784 TEST(fuzz753_91), 5797 TEST(fuzz753_91),
5785 TEST(fuzz714), 5798 TEST(fuzz714),
5786 TEST(fuzz487a), 5799 TEST(fuzz487a),
5787 TEST(fuzz433), 5800 TEST(fuzz433),
5788 TEST(fuzz1), 5801 TEST(fuzz1),
5789 TEST(fuzz487b), 5802 TEST(fuzz487b),
5790 TEST(fuzz433b), 5803 TEST(fuzz433b),
5791 TEST(bufferOverflow), 5804 TEST(bufferOverflow),
5792 }; 5805 };
5793 5806
5794 static const size_t failTestCount = SK_ARRAY_COUNT(failTests); 5807 static const size_t failTestCount = SK_ARRAY_COUNT(failTests);
5795 5808
5796 DEF_TEST(PathOpsFailOp, reporter) { 5809 DEF_TEST(PathOpsFailOp, reporter) {
5797 #if DEBUG_SHOW_TEST_NAME 5810 #if DEBUG_SHOW_TEST_NAME
5798 strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH); 5811 strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH);
5799 #endif 5812 #endif
5800 RunTestSet(reporter, failTests, failTestCount, nullptr, nullptr, nullptr, fa lse); 5813 RunTestSet(reporter, failTests, failTestCount, nullptr, nullptr, nullptr, fa lse);
5801 } 5814 }
OLDNEW
« no previous file with comments | « src/pathops/SkPathOpsCommon.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698