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

Side by Side Diff: tests/PathOpsOpTest.cpp

Issue 623943002: abort op early if path isn't parseable (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 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/SkPathOpsOp.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 #define TEST(name) { name, #name } 10 #define TEST(name) { name, #name }
(...skipping 3907 matching lines...) Expand 10 before | Expand all | Expand 10 after
3918 path.lineTo(SkBits2Float(0x42700000), SkBits2Float(0x42f00000)); 3918 path.lineTo(SkBits2Float(0x42700000), SkBits2Float(0x42f00000));
3919 path.lineTo(SkBits2Float(0x64969569), SkBits2Float(0x42f00000)); 3919 path.lineTo(SkBits2Float(0x64969569), SkBits2Float(0x42f00000));
3920 path.lineTo(SkBits2Float(0x64969569), SkBits2Float(0x43660000)); 3920 path.lineTo(SkBits2Float(0x64969569), SkBits2Float(0x43660000));
3921 path.lineTo(SkBits2Float(0x43200000), SkBits2Float(0x42700000)); 3921 path.lineTo(SkBits2Float(0x43200000), SkBits2Float(0x42700000));
3922 path.close(); 3922 path.close();
3923 3923
3924 SkPath path2(path); 3924 SkPath path2(path);
3925 testPathFailOp(reporter, path1, path2, (SkPathOp) 2, filename); 3925 testPathFailOp(reporter, path1, path2, (SkPathOp) 2, filename);
3926 } 3926 }
3927 3927
3928 static void fuzz1(skiatest::Reporter* reporter, const char* filename) {
3929 SkPath path;
3930 path.setFillType((SkPath::FillType) 0);
3931 path.moveTo(SkBits2Float(0x7f800000), SkBits2Float(0x7f800000));
3932 path.quadTo(SkBits2Float(0x7f800000), SkBits2Float(0x7f800000), SkBits2Float(0x7 f800000), SkBits2Float(0x7f800000));
3933 path.quadTo(SkBits2Float(0x7f800000), SkBits2Float(0x7f800000), SkBits2Float(0x7 f800000), SkBits2Float(0x7f800000));
3934 path.quadTo(SkBits2Float(0xffc00000), SkBits2Float(0x7f800000), SkBits2Float(0xf fc00000), SkBits2Float(0x7f800000));
3935 path.quadTo(SkBits2Float(0xff000001), SkBits2Float(0x7f800000), SkBits2Float(0xf f000001), SkBits2Float(0x7f800000));
3936 path.quadTo(SkBits2Float(0xff000001), SkBits2Float(0xffc00000), SkBits2Float(0xf fc00000), SkBits2Float(0xffc00000));
3937 path.quadTo(SkBits2Float(0xffc00000), SkBits2Float(0xff000001), SkBits2Float(0x7 f800000), SkBits2Float(0xff000001));
3938 path.quadTo(SkBits2Float(0x7f800000), SkBits2Float(0xff000001), SkBits2Float(0x7 f800000), SkBits2Float(0xffc00000));
3939 path.quadTo(SkBits2Float(0x7f800000), SkBits2Float(0xffc00000), SkBits2Float(0x7 f800000), SkBits2Float(0x7f800000));
3940 path.close();
3941
3942 SkPath path1(path);
3943 path.reset();
3944 path.setFillType((SkPath::FillType) 0);
3945
3946 SkPath path2(path);
3947 testPathFailOp(reporter, path1, path2, (SkPathOp) 2, filename);
3948 }
3949
3928 static struct TestDesc failTests[] = { 3950 static struct TestDesc failTests[] = {
3951 TEST(fuzz1),
3929 TEST(fuzz714), 3952 TEST(fuzz714),
3930 TEST(fuzz487a), 3953 TEST(fuzz487a),
3931 TEST(fuzz487b), 3954 TEST(fuzz487b),
3932 TEST(fuzz433b), 3955 TEST(fuzz433b),
3933 TEST(fuzz433), 3956 TEST(fuzz433),
3934 TEST(bufferOverflow), 3957 TEST(bufferOverflow),
3935 }; 3958 };
3936 3959
3937 static const size_t failTestCount = SK_ARRAY_COUNT(failTests); 3960 static const size_t failTestCount = SK_ARRAY_COUNT(failTests);
3938 3961
3939 DEF_TEST(PathOpsFailOp, reporter) { 3962 DEF_TEST(PathOpsFailOp, reporter) {
3940 #if DEBUG_SHOW_TEST_NAME 3963 #if DEBUG_SHOW_TEST_NAME
3941 strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH); 3964 strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH);
3942 #endif 3965 #endif
3943 RunTestSet(reporter, failTests, failTestCount, 0, 0, false); 3966 RunTestSet(reporter, failTests, failTestCount, 0, 0, false);
3944 } 3967 }
OLDNEW
« no previous file with comments | « src/pathops/SkPathOpsOp.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698