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

Unified Diff: tests/PathOpsOpLoopThreadedTest.cpp

Issue 1037573004: cumulative pathops patch (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix pathopsinverse gm Created 5 years, 9 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/PathOpsOpCubicThreadedTest.cpp ('k') | tests/PathOpsOpRectThreadedTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/PathOpsOpLoopThreadedTest.cpp
diff --git a/tests/PathOpsOpLoopThreadedTest.cpp b/tests/PathOpsOpLoopThreadedTest.cpp
index c50e23bae92be26df3951f802c2c5e535abced6c..3e43b9f75d5f3bb2e17384854734736d59d12573 100755
--- a/tests/PathOpsOpLoopThreadedTest.cpp
+++ b/tests/PathOpsOpLoopThreadedTest.cpp
@@ -7,6 +7,24 @@
#include "PathOpsExtendedTest.h"
#include "PathOpsThreadedCommon.h"
+static int add_point(char* str, SkScalar x, SkScalar y) {
+ int result;
+ int asInt = SkScalarRoundToInt(x);
+ if (SkIntToScalar(asInt) == x) {
+ result = sprintf(str, "%d", asInt);
+ } else {
+ result = sprintf(str, "%1.9gf", x);
+ }
+ result += sprintf(str + result, ",");
+ asInt = SkScalarRoundToInt(y);
+ if (SkIntToScalar(asInt) == y) {
+ result += sprintf(str + result, "%d", asInt);
+ } else {
+ result += sprintf(str + result, "%1.9gf", y);
+ }
+ return result;
+}
+
static void testOpLoopsMain(PathOpsThreadState* data) {
#if DEBUG_SHOW_TEST_NAME
strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH);
@@ -35,14 +53,27 @@ static void testOpLoopsMain(PathOpsThreadState* data) {
SkPath pathA, pathB;
if (progress) {
char* str = pathStr;
+ const int loopNo = 7;
+ str += sprintf(str, "static void loop%d(skiatest::Reporter* reporter,"
+ " const char* filename) {\n", loopNo);
+ str += sprintf(str, " SkPath path, pathB;\n");
str += sprintf(str, " path.moveTo(%d,%d);\n", a, b);
- str += sprintf(str, " path.cubicTo(%d,%d, %1.9gf,%1.9gf, %1.9gf,%1.9gf);\n",
- c, d, endC.fX, endC.fY, endD.fX, endD.fY);
+ str += sprintf(str, " path.cubicTo(%d,%d, ", c, d);
+ str += add_point(str, endC.fX, endC.fY);
+ str += sprintf(str, ", ");
+ str += add_point(str, endD.fX, endD.fY);
+ str += sprintf(str, ");\n");
str += sprintf(str, " path.close();\n");
str += sprintf(str, " pathB.moveTo(%d,%d);\n", c, d);
- str += sprintf(str, " pathB.cubicTo(%1.9gf,%1.9gf, %1.9gf,%1.9gf, %d,%d);\n",
- endC.fX, endC.fY, endD.fX, endD.fY, a, b);
+ str += sprintf(str, " pathB.cubicTo(");
+ str += add_point(str, endC.fX, endC.fY);
+ str += sprintf(str, ", ");
+ str += add_point(str, endD.fX, endD.fY);
+ str += sprintf(str, ", %d,%d);\n", a, b);
str += sprintf(str, " pathB.close();\n");
+ str += sprintf(str, " testPathOp(reporter, path, pathB, kIntersect_SkPathOp,"
+ " filename);\n");
+ str += sprintf(str, "}\n");
}
pathA.moveTo(SkIntToScalar(a), SkIntToScalar(b));
pathA.cubicTo(SkIntToScalar(c), SkIntToScalar(d), endC.fX, endC.fY, endD.fX, endD.fY);
@@ -52,9 +83,9 @@ static void testOpLoopsMain(PathOpsThreadState* data) {
pathB.close();
// SkDebugf("%s\n", pathStr);
if (progress) {
- outputProgress(state.fPathStr, pathStr, kIntersect_PathOp);
+ outputProgress(state.fPathStr, pathStr, kIntersect_SkPathOp);
}
- testThreadedPathOp(state.fReporter, pathA, pathB, kIntersect_PathOp, "loops");
+ testThreadedPathOp(state.fReporter, pathA, pathB, kIntersect_SkPathOp, "loops");
}
}
}
@@ -62,9 +93,6 @@ static void testOpLoopsMain(PathOpsThreadState* data) {
}
DEF_TEST(PathOpsOpLoopsThreaded, reporter) {
- if (!FLAGS_runFail) {
- return;
- }
initializeTests(reporter, "cubicOp");
PathOpsThreadedTestRunner testRunner(reporter);
for (int a = 0; a < 6; ++a) { // outermost
@@ -84,9 +112,6 @@ finish:
}
DEF_TEST(PathOpsOpLoops, reporter) {
- if (!FLAGS_runFail) {
- return;
- }
initializeTests(reporter, "cubicOp");
PathOpsThreadState state;
state.fReporter = reporter;
« no previous file with comments | « tests/PathOpsOpCubicThreadedTest.cpp ('k') | tests/PathOpsOpRectThreadedTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698