aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/StrokerTest.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/StrokerTest.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/StrokerTest.cpp')
-rwxr-xr-xtests/StrokerTest.cpp25
1 files changed, 17 insertions, 8 deletions
diff --git a/tests/StrokerTest.cpp b/tests/StrokerTest.cpp
index 68792d9d47..7b9a3400fd 100755
--- a/tests/StrokerTest.cpp
+++ b/tests/StrokerTest.cpp
@@ -8,6 +8,7 @@
#include "PathOpsCubicIntersectionTestData.h"
#include "PathOpsQuadIntersectionTestData.h"
#include "SkCommonFlags.h"
+#include "SkPathOpsCubic.h"
#include "SkPaint.h"
#include "SkPath.h"
#include "SkRandom.h"
@@ -49,10 +50,12 @@ static void quadTest(const SkPoint c[3]) {
pathTest(path);
}
-static void cubicSetTest(const SkDCubic* dCubic, size_t count) {
+static void cubicSetTest(const CubicPts* dCubic, size_t count) {
skiatest::Timer timer;
for (size_t index = 0; index < count; ++index) {
- const SkDCubic& d = dCubic[index];
+ const CubicPts& dPts = dCubic[index];
+ SkDCubic d;
+ d.debugSet(dPts.fPts);
SkPoint c[4] = { {(float) d[0].fX, (float) d[0].fY}, {(float) d[1].fX, (float) d[1].fY},
{(float) d[2].fX, (float) d[2].fY}, {(float) d[3].fX, (float) d[3].fY} };
cubicTest(c);
@@ -62,11 +65,13 @@ static void cubicSetTest(const SkDCubic* dCubic, size_t count) {
}
}
-static void cubicPairSetTest(const SkDCubic dCubic[][2], size_t count) {
+static void cubicPairSetTest(const CubicPts dCubic[][2], size_t count) {
skiatest::Timer timer;
for (size_t index = 0; index < count; ++index) {
for (int pair = 0; pair < 2; ++pair) {
- const SkDCubic& d = dCubic[index][pair];
+ const CubicPts& dPts = dCubic[index][pair];
+ SkDCubic d;
+ d.debugSet(dPts.fPts);
SkPoint c[4] = { {(float) d[0].fX, (float) d[0].fY}, {(float) d[1].fX, (float) d[1].fY},
{(float) d[2].fX, (float) d[2].fY}, {(float) d[3].fX, (float) d[3].fY} };
cubicTest(c);
@@ -77,10 +82,12 @@ static void cubicPairSetTest(const SkDCubic dCubic[][2], size_t count) {
}
}
-static void quadSetTest(const SkDQuad* dQuad, size_t count) {
+static void quadSetTest(const QuadPts* dQuad, size_t count) {
skiatest::Timer timer;
for (size_t index = 0; index < count; ++index) {
- const SkDQuad& d = dQuad[index];
+ const QuadPts& dPts = dQuad[index];
+ SkDQuad d;
+ d.debugSet(dPts.fPts);
SkPoint c[3] = { {(float) d[0].fX, (float) d[0].fY}, {(float) d[1].fX, (float) d[1].fY},
{(float) d[2].fX, (float) d[2].fY} };
quadTest(c);
@@ -90,11 +97,13 @@ static void quadSetTest(const SkDQuad* dQuad, size_t count) {
}
}
-static void quadPairSetTest(const SkDQuad dQuad[][2], size_t count) {
+static void quadPairSetTest(const QuadPts dQuad[][2], size_t count) {
skiatest::Timer timer;
for (size_t index = 0; index < count; ++index) {
for (int pair = 0; pair < 2; ++pair) {
- const SkDQuad& d = dQuad[index][pair];
+ const QuadPts& dPts = dQuad[index][pair];
+ SkDQuad d;
+ d.debugSet(dPts.fPts);
SkPoint c[3] = { {(float) d[0].fX, (float) d[0].fY}, {(float) d[1].fX, (float) d[1].fY},
{(float) d[2].fX, (float) d[2].fY} };
quadTest(c);