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

Side by Side Diff: tests/PathOpsOpCubicThreadedTest.cpp

Issue 14072002: Make parallel unit testing work on windows (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/PathOpsExtendedTest.cpp ('k') | tests/PathOpsOpRectThreadedTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 #include "PathOpsExtendedTest.h" 7 #include "PathOpsExtendedTest.h"
8 #include "PathOpsThreadedCommon.h"
8 9
9 static THREAD_TYPE testOpCubicsMain(void* data) 10 static void testOpCubicsMain(PathOpsThreadState* data)
10 { 11 {
11 SkASSERT(data); 12 SkASSERT(data);
12 State4& state = *(State4*) data; 13 PathOpsThreadState& state = *data;
13 char pathStr[1024]; // gdb: set print elements 400 14 char pathStr[1024]; // gdb: set print elements 400
14 sk_bzero(pathStr, sizeof(pathStr)); 15 sk_bzero(pathStr, sizeof(pathStr));
15 do { 16 for (int a = 0 ; a < 6; ++a) {
16 for (int a = 0 ; a < 6; ++a) { 17 for (int b = a + 1 ; b < 7; ++b) {
17 for (int b = a + 1 ; b < 7; ++b) { 18 for (int c = 0 ; c < 6; ++c) {
18 for (int c = 0 ; c < 6; ++c) { 19 for (int d = c + 1 ; d < 7; ++d) {
19 for (int d = c + 1 ; d < 7; ++d) { 20 for (int e = SkPath::kWinding_FillType ; e <= SkPath::kEvenO dd_FillType; ++e) {
20 for (int e = SkPath::kWinding_FillType ; e <= SkPath::kEvenOdd_FillType; ++e) { 21 for (int f = SkPath::kWinding_FillType ; f <= SkPath::kEvenOdd_FillType; ++f ) {
21 for (int f = SkPath::kWinding_FillType ; f <= SkPath::kEvenOdd_FillType; ++f) { 22 SkPath pathA, pathB;
22 SkPath pathA, pathB; 23 char* str = pathStr;
23 char* str = pathStr; 24 pathA.setFillType((SkPath::FillType) e);
24 pathA.setFillType((SkPath::FillType) e); 25 str += sprintf(str, " path.setFillType(SkPath::k%s_FillType);\n",
25 str += sprintf(str, " path.setFillType(SkPath::k%s_FillType);\n", 26 e == SkPath::kWinding_FillType ? "Winding" : e == SkPath::kEvenO dd_FillType
26 e == SkPath::kWinding_FillType ? "Winding" : e == SkPath::kE venOdd_FillType 27 ? "EvenOdd" : "?UNDEFINED");
27 ? "EvenOdd" : "?UNDEFINED"); 28 pathA.moveTo(SkIntToScalar(state.fA), SkIntToScalar(state.fB));
28 pathA.moveTo(SkIntToScalar(state.a), SkIntToScalar(state.b)); 29 str += sprintf(str, " path.moveTo(%d,%d);\n", state.fA, state.fB);
29 str += sprintf(str, " path.moveTo(%d,%d);\n", state.a, state.b); 30 pathA.cubicTo(SkIntToScalar(state.fC), SkIntToScalar(state.fD), SkIntToS calar(b),
30 pathA.cubicTo(SkIntToScalar(state.c), SkIntToScalar(state.d), SkIntT oScalar(b), 31 SkIntToScalar(a), SkIntToScalar(d), SkIntToScalar(c));
31 SkIntToScalar(a), SkIntToScalar(d), SkIntToScalar(c)); 32 str += sprintf(str, " path.cubicTo(%d,%d, %d,%d, %d,%d);\n", state.fC , state.fD,
32 str += sprintf(str, " path.cubicTo(%d,%d, %d,%d, %d,%d);\n", stat e.c, state.d, 33 b, a, d, c);
33 b, a, d, c); 34 pathA.close();
34 pathA.close(); 35 str += sprintf(str, " path.close();\n");
35 str += sprintf(str, " path.close();\n"); 36 pathB.setFillType((SkPath::FillType) f);
36 pathB.setFillType((SkPath::FillType) f); 37 str += sprintf(str, " pathB.setFillType(SkPath::k%s_FillType);\n",
37 str += sprintf(str, " pathB.setFillType(SkPath::k%s_FillType);\n" , 38 f == SkPath::kWinding_FillType ? "Winding" : f == SkPath::kEvenO dd_FillType
38 f == SkPath::kWinding_FillType ? "Winding" : f == SkPath::kE venOdd_FillType 39 ? "EvenOdd" : "?UNDEFINED");
39 ? "EvenOdd" : "?UNDEFINED"); 40 pathB.moveTo(SkIntToScalar(a), SkIntToScalar(b));
40 pathB.moveTo(SkIntToScalar(a), SkIntToScalar(b)); 41 str += sprintf(str, " pathB.moveTo(%d,%d);\n", a, b);
41 str += sprintf(str, " pathB.moveTo(%d,%d);\n", a, b); 42 pathB.cubicTo(SkIntToScalar(c), SkIntToScalar(d), SkIntToScalar(state.fB ),
42 pathB.cubicTo(SkIntToScalar(c), SkIntToScalar(d), SkIntToScalar(stat e.b), 43 SkIntToScalar(state.fA), SkIntToScalar(state.fD), SkIntToScalar( state.fC));
43 SkIntToScalar(state.a), SkIntToScalar(state.d), SkIntToScala r(state.c)); 44 str += sprintf(str, " pathB.cubicTo(%d,%d, %d,%d, %d,%d);\n", c, d,
44 str += sprintf(str, " pathB.cubicTo(%d,%d, %d,%d, %d,%d);\n", c, d, 45 state.fB, state.fA, state.fD, state.fC);
45 state.b, state.a, state.d, state.c); 46 pathB.close();
46 pathB.close(); 47 str += sprintf(str, " pathB.close();\n");
47 str += sprintf(str, " pathB.close();\n"); 48 for (int op = 0 ; op <= kXOR_PathOp; ++op) {
48 for (int op = 0 ; op <= kXOR_PathOp; ++op) { 49 outputProgress(state.fPathStr, pathStr, (SkPathOp) op);
49 outputProgress(state, pathStr, (SkPathOp) op); 50 testPathOp(state.fReporter, pathA, pathB, (SkPathOp) op);
50 testPathOp(state.reporter, pathA, pathB, (SkPathOp) op); 51 }
51 state.testsRun++; 52 }
52 }
53 }
54 }
55 }
56 } 53 }
57 } 54 }
58 } 55 }
59 } while (runNextTestSet(state)); 56 }
60 THREAD_RETURN 57 }
61 } 58 }
62 59
63 static void TestOpCubicsThreaded(skiatest::Reporter* reporter) 60 static void TestOpCubicsThreaded(skiatest::Reporter* reporter)
64 { 61 {
65 int testsRun = 0; 62 int threadCount = initializeTests("cubicOp");
66 if (gShowTestProgress) SkDebugf("%s\n", __FUNCTION__); 63 PathOpsThreadedTestRunner testRunner(reporter, threadCount);
67 #ifdef SK_DEBUG
68 gDebugMaxWindSum = 4;
69 gDebugMaxWindValue = 4;
70 #endif
71 const char testLineStr[] = "cubicOp";
72 initializeTests(reporter, testLineStr, sizeof(testLineStr));
73 for (int a = 0; a < 6; ++a) { // outermost 64 for (int a = 0; a < 6; ++a) { // outermost
74 for (int b = a + 1; b < 7; ++b) { 65 for (int b = a + 1; b < 7; ++b) {
75 for (int c = 0 ; c < 6; ++c) { 66 for (int c = 0 ; c < 6; ++c) {
76 for (int d = c + 1; d < 7; ++d) { 67 for (int d = c + 1; d < 7; ++d) {
77 testsRun += dispatchTest4(testOpCubicsMain, a, b, c, d); 68 *testRunner.fRunnables.append() = SkNEW_ARGS(PathOpsThreaded Runnable,
69 (&testOpCubicsMain, a, b, c, d, &testRunner));
78 } 70 }
79 if (gShowTestProgress) SkDebugf(".");
80 } 71 }
81 if (!gAllowExtendedTest) goto finish; 72 if (!reporter->allowExtendedTest()) goto finish;
82 if (gShowTestProgress) SkDebugf("%d", b);
83 } 73 }
84 if (gShowTestProgress) SkDebugf("\n%d", a);
85 } 74 }
86 finish: 75 finish:
87 testsRun += waitForCompletion(); 76 testRunner.render();
88 if (gShowTestProgress) SkDebugf("%s tests=%d\n", __FUNCTION__, testsRun);
89 } 77 }
90 78
91 #include "TestClassDef.h" 79 #include "TestClassDef.h"
92 DEFINE_TESTCLASS("PathOpsOpCubicsThreaded", OpCubicsThreadedTestClass, \ 80 DEFINE_TESTCLASS("PathOpsOpCubicsThreaded", OpCubicsThreadedTestClass, \
93 TestOpCubicsThreaded) 81 TestOpCubicsThreaded)
OLDNEW
« no previous file with comments | « tests/PathOpsExtendedTest.cpp ('k') | tests/PathOpsOpRectThreadedTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698