aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/PathOpsConicLineIntersectionTest.cpp
diff options
context:
space:
mode:
authorGravatar caryclark <caryclark@google.com>2016-10-20 08:32:18 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-10-20 08:32:18 -0700
commita35ab3e6e024d0b548ded26a2e3b8ecd838ead93 (patch)
treec009069f86b1129fcf5037ffc8e8fbf1b9ba010f /tests/PathOpsConicLineIntersectionTest.cpp
parent65820db5e15201a3f30968420232d36c0ca89cd8 (diff)
fix fuzzers
Many old pathops-related fuzz failures have built up while the codebase was under a state a flux. Now that the code is stable, address these failures. Most of the CL plumbs the debug global state to downstream routines so that, if the data is not trusted (ala fuzzed) the function can safely exit without asserting. TBR=reed@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2426173002 Review-Url: https://chromiumcodereview.appspot.com/2426173002
Diffstat (limited to 'tests/PathOpsConicLineIntersectionTest.cpp')
-rw-r--r--tests/PathOpsConicLineIntersectionTest.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/PathOpsConicLineIntersectionTest.cpp b/tests/PathOpsConicLineIntersectionTest.cpp
index ecc4a47f17..c3d4a2afe3 100644
--- a/tests/PathOpsConicLineIntersectionTest.cpp
+++ b/tests/PathOpsConicLineIntersectionTest.cpp
@@ -14,7 +14,7 @@
#include "Test.h"
static struct lineConic {
- SkDConic conic;
+ ConicPts conic;
SkDLine line;
int result;
SkDPoint expected[2];
@@ -57,7 +57,7 @@ static int doIntersect(SkIntersections& intersections, const SkDConic& conic, co
}
static struct oneLineConic {
- SkDConic conic;
+ ConicPts conic;
SkDLine line;
} oneOffs[] = {
{{{{{30.6499996,25.6499996}, {30.6499996,20.6499996}, {25.6499996,20.6499996}}}, 0.707107008f},
@@ -69,7 +69,9 @@ static size_t oneOffs_count = SK_ARRAY_COUNT(oneOffs);
static void testOneOffs(skiatest::Reporter* reporter) {
bool flipped = false;
for (size_t index = 0; index < oneOffs_count; ++index) {
- const SkDConic& conic = oneOffs[index].conic;
+ const ConicPts& c = oneOffs[index].conic;
+ SkDConic conic;
+ conic.debugSet(c.fPts.fPts, c.fWeight);
SkASSERT(ValidConic(conic));
const SkDLine& line = oneOffs[index].line;
SkASSERT(ValidLine(line));
@@ -96,7 +98,9 @@ DEF_TEST(PathOpsConicLineIntersectionOneOff, reporter) {
DEF_TEST(PathOpsConicLineIntersection, reporter) {
for (size_t index = 0; index < lineConicTests_count; ++index) {
int iIndex = static_cast<int>(index);
- const SkDConic& conic = lineConicTests[index].conic;
+ const ConicPts& c = lineConicTests[index].conic;
+ SkDConic conic;
+ conic.debugSet(c.fPts.fPts, c.fWeight);
SkASSERT(ValidConic(conic));
const SkDLine& line = lineConicTests[index].line;
SkASSERT(ValidLine(line));