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

Unified Diff: tests/PathOpsCubicReduceOrderTest.cpp

Issue 19374003: harden and speed up path op unit tests (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rename threaded to single Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/PathOpsCubicQuadIntersectionTest.cpp ('k') | tests/PathOpsCubicToQuadsTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/PathOpsCubicReduceOrderTest.cpp
diff --git a/tests/PathOpsCubicReduceOrderTest.cpp b/tests/PathOpsCubicReduceOrderTest.cpp
index d7518ab3039deb9366a96233562a7b62876743ed..7b89bbe5b3e75dc296b66e04e67599478a230efe 100644
--- a/tests/PathOpsCubicReduceOrderTest.cpp
+++ b/tests/PathOpsCubicReduceOrderTest.cpp
@@ -6,6 +6,7 @@
*/
#include "PathOpsCubicIntersectionTestData.h"
#include "PathOpsQuadIntersectionTestData.h"
+#include "PathOpsTestCommon.h"
#include "SkIntersections.h"
#include "SkPathOpsRect.h"
#include "SkReduceOrder.h"
@@ -102,6 +103,7 @@ static void PathOpsReduceOrderCubicTest(skiatest::Reporter* reporter) {
for (index = firstPointDegeneratesTest; index < pointDegenerates_count; ++index) {
const SkDCubic& cubic = pointDegenerates[index];
+ SkASSERT(ValidCubic(cubic));
order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics, SkReduceOrder::kFill_Style);
if (order != 1) {
SkDebugf("[%d] pointDegenerates order=%d\n", static_cast<int>(index), order);
@@ -110,6 +112,7 @@ static void PathOpsReduceOrderCubicTest(skiatest::Reporter* reporter) {
}
for (index = firstNotPointDegeneratesTest; index < notPointDegenerates_count; ++index) {
const SkDCubic& cubic = notPointDegenerates[index];
+ SkASSERT(ValidCubic(cubic));
order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics, SkReduceOrder::kFill_Style);
if (order == 1) {
SkDebugf("[%d] notPointDegenerates order=%d\n", static_cast<int>(index), order);
@@ -118,6 +121,7 @@ static void PathOpsReduceOrderCubicTest(skiatest::Reporter* reporter) {
}
for (index = firstLinesTest; index < lines_count; ++index) {
const SkDCubic& cubic = lines[index];
+ SkASSERT(ValidCubic(cubic));
order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics, SkReduceOrder::kFill_Style);
if (order != 2) {
SkDebugf("[%d] lines order=%d\n", static_cast<int>(index), order);
@@ -126,6 +130,7 @@ static void PathOpsReduceOrderCubicTest(skiatest::Reporter* reporter) {
}
for (index = firstNotLinesTest; index < notLines_count; ++index) {
const SkDCubic& cubic = notLines[index];
+ SkASSERT(ValidCubic(cubic));
order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics, SkReduceOrder::kFill_Style);
if (order == 2) {
SkDebugf("[%d] notLines order=%d\n", static_cast<int>(index), order);
@@ -134,6 +139,7 @@ static void PathOpsReduceOrderCubicTest(skiatest::Reporter* reporter) {
}
for (index = firstModEpsilonTest; index < modEpsilonLines_count; ++index) {
const SkDCubic& cubic = modEpsilonLines[index];
+ SkASSERT(ValidCubic(cubic));
order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics, SkReduceOrder::kFill_Style);
if (order == 2) {
SkDebugf("[%d] line mod by epsilon order=%d\n", static_cast<int>(index), order);
@@ -142,6 +148,7 @@ static void PathOpsReduceOrderCubicTest(skiatest::Reporter* reporter) {
}
for (index = firstLessEpsilonTest; index < lessEpsilonLines_count; ++index) {
const SkDCubic& cubic = lessEpsilonLines[index];
+ SkASSERT(ValidCubic(cubic));
order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics, SkReduceOrder::kFill_Style);
if (order != 2) {
SkDebugf("[%d] line less by epsilon/2 order=%d\n", static_cast<int>(index), order);
@@ -150,6 +157,7 @@ static void PathOpsReduceOrderCubicTest(skiatest::Reporter* reporter) {
}
for (index = firstNegEpsilonTest; index < negEpsilonLines_count; ++index) {
const SkDCubic& cubic = negEpsilonLines[index];
+ SkASSERT(ValidCubic(cubic));
order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics, SkReduceOrder::kFill_Style);
if (order != 2) {
SkDebugf("[%d] line neg by epsilon/2 order=%d\n", static_cast<int>(index), order);
@@ -158,6 +166,7 @@ static void PathOpsReduceOrderCubicTest(skiatest::Reporter* reporter) {
}
for (index = firstQuadraticPointTest; index < quadraticPoints_count; ++index) {
const SkDQuad& quad = quadraticPoints[index];
+ SkASSERT(ValidQuad(quad));
SkDCubic cubic = quad.toCubic();
order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics, SkReduceOrder::kFill_Style);
if (order != 1) {
@@ -167,6 +176,7 @@ static void PathOpsReduceOrderCubicTest(skiatest::Reporter* reporter) {
}
for (index = firstQuadraticLineTest; index < quadraticLines_count; ++index) {
const SkDQuad& quad = quadraticLines[index];
+ SkASSERT(ValidQuad(quad));
SkDCubic cubic = quad.toCubic();
order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics, SkReduceOrder::kFill_Style);
if (order != 2) {
@@ -176,6 +186,7 @@ static void PathOpsReduceOrderCubicTest(skiatest::Reporter* reporter) {
}
for (index = firstQuadraticModLineTest; index < quadraticModEpsilonLines_count; ++index) {
const SkDQuad& quad = quadraticModEpsilonLines[index];
+ SkASSERT(ValidQuad(quad));
SkDCubic cubic = quad.toCubic();
order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics, SkReduceOrder::kFill_Style);
if (order != 3) {
@@ -187,6 +198,7 @@ static void PathOpsReduceOrderCubicTest(skiatest::Reporter* reporter) {
// test if computed line end points are valid
for (index = firstComputedLinesTest; index < lines_count; ++index) {
const SkDCubic& cubic = lines[index];
+ SkASSERT(ValidCubic(cubic));
bool controlsInside = controls_inside(cubic);
order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics,
SkReduceOrder::kStroke_Style);
« no previous file with comments | « tests/PathOpsCubicQuadIntersectionTest.cpp ('k') | tests/PathOpsCubicToQuadsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698