aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/PathOpsExtendedTest.cpp
diff options
context:
space:
mode:
authorGravatar Cary Clark <caryclark@google.com>2017-01-23 14:38:52 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-23 15:31:25 +0000
commit59d5a0e3f560da40e0ae7036a01d7d58ce3718d8 (patch)
tree55a3467bdbbda58dc30eca902d20130a2a20346d /tests/PathOpsExtendedTest.cpp
parentb07a01e6b9bd552bab12aabd48dc77a7562f4f97 (diff)
Revert "offset angle check edge in common"
This reverts commit d2eb581ebc8f8009e80cccccd74d5b341ef5bd5b. Reason for revert: broke Google3 MSAN run of dm Original change's description: > offset angle check edge in common > > When curves cross, their intersection points may be nearby, but not exactly the same. > Sort the angles formed by the crossing curves when all angles don't have the same > origin. > > This sets up the framework to solve test case that currently fail (e.g., joel6) but > does not fix all related test cases (e.g., joel9). > > All older existing test cases, including extended tests, pass. > > Rework the test framework to better report when tests expected to produce failing > results now pass. > > Add new point and vector operations to support offset angles. > > TBR=reed@google.com > BUG=skia:6041 > > Change-Id: I67c651ded0a25e99ad93d55d6a35109b3ee3698e > Reviewed-on: https://skia-review.googlesource.com/6624 > Commit-Queue: Cary Clark <caryclark@google.com> > Reviewed-by: Cary Clark <caryclark@google.com> > TBR=caryclark@google.com,reviews@skia.org # Not skipping CQ checks because original CL landed > 1 day ago. BUG=skia:6041 Change-Id: I43db0808522ac44aceeb4f70e296167ea84a3663 Reviewed-on: https://skia-review.googlesource.com/7373 Commit-Queue: Cary Clark <caryclark@google.com> Reviewed-by: Cary Clark <caryclark@google.com>
Diffstat (limited to 'tests/PathOpsExtendedTest.cpp')
-rw-r--r--tests/PathOpsExtendedTest.cpp52
1 files changed, 22 insertions, 30 deletions
diff --git a/tests/PathOpsExtendedTest.cpp b/tests/PathOpsExtendedTest.cpp
index 06fee80f5d..d70deb30fc 100644
--- a/tests/PathOpsExtendedTest.cpp
+++ b/tests/PathOpsExtendedTest.cpp
@@ -320,26 +320,21 @@ int comparePaths(skiatest::Reporter* reporter, const char* filename, const SkPat
static SkTDArray<SkPathOp> gTestOp;
-static void dumpPathOpFunction(const char* testName, const SkPath& a, const SkPath& b,
- const SkPathOp shapeOp) {
+static void showPathOpPath(const char* testName, const SkPath& one, const SkPath& two,
+ const SkPath& a, const SkPath& b, const SkPath& scaledOne, const SkPath& scaledTwo,
+ const SkPathOp shapeOp, const SkMatrix& scale) {
+ SkASSERT((unsigned) shapeOp < SK_ARRAY_COUNT(opStrs));
if (!testName) {
testName = "xOp";
}
SkDebugf("static void %s_%s(skiatest::Reporter* reporter, const char* filename) {\n",
testName, opSuffixes[shapeOp]);
+ *gTestOp.append() = shapeOp;
SkDebugf(" SkPath path, pathB;\n");
SkPathOpsDebug::ShowOnePath(a, "path", false);
SkPathOpsDebug::ShowOnePath(b, "pathB", false);
SkDebugf(" testPathOp(reporter, path, pathB, %s, filename);\n", opStrs[shapeOp]);
SkDebugf("}\n");
-}
-
-static void showPathOpPath(const char* testName, const SkPath& one, const SkPath& two,
- const SkPath& a, const SkPath& b, const SkPath& scaledOne, const SkPath& scaledTwo,
- const SkPathOp shapeOp, const SkMatrix& scale) {
- SkASSERT((unsigned) shapeOp < SK_ARRAY_COUNT(opStrs));
- *gTestOp.append() = shapeOp;
- dumpPathOpFunction(testName, a, b, shapeOp);
drawAsciiPaths(scaledOne, scaledTwo, true);
}
@@ -349,15 +344,11 @@ static int comparePaths(skiatest::Reporter* reporter, const char* testName, cons
const SkPath& scaledOne, const SkPath& two, const SkPath& scaledTwo, SkBitmap& bitmap,
const SkPath& a, const SkPath& b, const SkPathOp shapeOp, const SkMatrix& scale,
ExpectMatch expectMatch) {
- if (ExpectMatch::kFlaky == expectMatch) {
- return 0; // fuzz data may cause asserts in region generating code, so don't try
- }
int errors2x2;
const int MAX_ERRORS = 8;
(void) pathsDrawTheSame(bitmap, scaledOne, scaledTwo, errors2x2);
if (ExpectMatch::kNo == expectMatch) {
if (errors2x2 < MAX_ERRORS) {
- SkDebugf("%s failing test %s now succeeds\n", __FUNCTION__, testName);
REPORTER_ASSERT(reporter, 0);
}
return 0;
@@ -514,11 +505,6 @@ bool testSimplifyCheck(skiatest::Reporter* reporter, const SkPath& path, const c
ExpectSuccess::kYes : ExpectSuccess::kNo, SkipAssert::kNo, ExpectMatch::kNo);
}
-bool testSimplifyTry(skiatest::Reporter* reporter, const SkPath& path, const char* filename) {
- return inner_simplify(reporter, path, filename, ExpectSuccess::kYes, SkipAssert::kNo,
- ExpectMatch::kNo);
-}
-
#if DEBUG_SHOW_TEST_NAME
static void showName(const SkPath& a, const SkPath& b, const SkPathOp shapeOp) {
SkDebugf("\n");
@@ -539,23 +525,18 @@ static bool innerPathOp(skiatest::Reporter* reporter, const SkPath& a, const SkP
SkDEBUGPARAMS(testName))) {
if (ExpectSuccess::kYes == expectSuccess) {
SkDebugf("%s %s did not expect failure\n", __FUNCTION__, testName);
- dumpPathOpFunction(testName, a, b, shapeOp);
REPORTER_ASSERT(reporter, 0);
}
return false;
} else {
if (ExpectSuccess::kNo == expectSuccess) {
SkDebugf("%s %s unexpected success\n", __FUNCTION__, testName);
- dumpPathOpFunction(testName, a, b, shapeOp);
REPORTER_ASSERT(reporter, 0);
}
}
if (!reporter->verbose()) {
return true;
}
- if (ExpectMatch::kFlaky == expectMatch) {
- return true; // fuzzy data may assert in region construction: see bug.skia.org/6129
- }
SkPath pathOut, scaledPathOut;
SkRegion rgnA, rgnB, openClip, rgnOut;
openClip.setRect(-16000, -16000, 16000, 16000);
@@ -598,18 +579,29 @@ bool testPathOpCheck(skiatest::Reporter* reporter, const SkPath& a, const SkPath
ExpectSuccess::kYes : ExpectSuccess::kNo, SkipAssert::kNo, ExpectMatch::kNo);
}
-bool testPathOpTry(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b,
- const SkPathOp shapeOp, const char* testName) {
- return innerPathOp(reporter, a, b, shapeOp, testName,
- ExpectSuccess::kYes, SkipAssert::kNo, ExpectMatch::kNo);
-}
-
bool testPathOpFuzz(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b,
const SkPathOp shapeOp, const char* testName) {
return innerPathOp(reporter, a, b, shapeOp, testName, ExpectSuccess::kFlaky, SkipAssert::kYes,
ExpectMatch::kFlaky);
}
+bool testPathOpFail(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b,
+ const SkPathOp shapeOp, const char* testName) {
+#if DEBUG_SHOW_TEST_NAME
+ showName(a, b, shapeOp);
+#endif
+ SkPath orig;
+ orig.lineTo(54, 43);
+ SkPath out = orig;
+ if (Op(a, b, shapeOp, &out) ) {
+ SkDebugf("%s test is expected to fail\n", __FUNCTION__);
+ REPORTER_ASSERT(reporter, 0);
+ return false;
+ }
+ SkASSERT(out == orig);
+ return true;
+}
+
SK_DECLARE_STATIC_MUTEX(gMutex);
void initializeTests(skiatest::Reporter* reporter, const char* test) {