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

Side by Side Diff: tests/PathOpsExtendedTest.h

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/PathOpsCubicIntersectionTestData.cpp ('k') | tests/PathOpsExtendedTest.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 #ifndef PathOpsExtendedTest_DEFINED 7 #ifndef PathOpsExtendedTest_DEFINED
8 #define PathOpsExtendedTest_DEFINED 8 #define PathOpsExtendedTest_DEFINED
9 9
10 #include "Test.h"
11 #include "SkPathOpsTypes.h"
12 #include "SkBitmap.h" 10 #include "SkBitmap.h"
13 #include "SkPath.h" 11 #include "SkPath.h"
12 #include "SkPathOpsTypes.h"
14 #include "SkStream.h" 13 #include "SkStream.h"
14 #include "SkThread.h"
15 #include "SkThreadUtils.h"
16 #include "Test.h"
15 17
16 #ifdef SK_BUILD_FOR_WIN 18 struct PathOpsThreadState;
17 #define HARD_CODE_PTHREAD 0
18 #else
19 #define HARD_CODE_PTHREAD 1
20 #endif
21
22 #if HARD_CODE_PTHREAD
23 #include <pthread.h>
24 #else
25 #include "SkThread.h"
26 #include "../../src/utils/SkThreadUtils.h"
27 #endif
28
29 #if HARD_CODE_PTHREAD
30 typedef void* (*ThreadFunction)(void*);
31 #define THREAD_TYPE void*
32 #define THREAD_RETURN return NULL;
33 #else
34 typedef void (*ThreadFunction)(void*);
35 #define THREAD_TYPE void
36 #define THREAD_RETURN
37 #endif
38
39 struct State4;
40 19
41 struct TestDesc { 20 struct TestDesc {
42 void (*fun)(skiatest::Reporter*); 21 void (*fun)(skiatest::Reporter*);
43 const char* str; 22 const char* str;
44 }; 23 };
45 24
46 extern bool gShowTestProgress;
47 extern bool gAllowExtendedTest;
48
49 //extern int comparePaths(const SkPath& one, const SkPath& two); 25 //extern int comparePaths(const SkPath& one, const SkPath& two);
50 extern int comparePaths(const SkPath& one, const SkPath& two, SkBitmap& bitmap); 26 extern int comparePaths(const SkPath& one, const SkPath& two, SkBitmap& bitmap);
51 extern bool drawAsciiPaths(const SkPath& one, const SkPath& two, bool drawPaths) ; 27 extern bool drawAsciiPaths(const SkPath& one, const SkPath& two, bool drawPaths) ;
52 extern void showOp(const SkPathOp op); 28 extern void showOp(const SkPathOp op);
53 extern void showPath(const SkPath& path, const char* str); 29 extern void showPath(const SkPath& path, const char* str);
54 extern void showPath(const SkPath& path); 30 extern void showPath(const SkPath& path);
55 extern void showPathData(const SkPath& path); 31 extern void showPathData(const SkPath& path);
56 extern bool testPathOp(skiatest::Reporter* reporter, const SkPath& a, const SkPa th& b, 32 extern bool testPathOp(skiatest::Reporter* reporter, const SkPath& a, const SkPa th& b,
57 const SkPathOp ); 33 const SkPathOp );
58 extern bool testSimplify(SkPath& path, bool useXor, SkPath& out, 34 extern bool testSimplify(SkPath& path, bool useXor, SkPath& out, PathOpsThreadSt ate& state,
59 State4& state, const char* pathStr); 35 const char* pathStr);
60 extern bool testSimplify(skiatest::Reporter* reporter, const SkPath& path); 36 extern bool testSimplify(skiatest::Reporter* reporter, const SkPath& path);
61 37
62 struct State4 { 38 int initializeTests(const char* testName);
63 State4(); 39 void outputProgress(char* ramStr, const char* pathStr, SkPath::FillType );
64 #if HARD_CODE_PTHREAD 40 void outputProgress(char* ramStr, const char* pathStr, SkPathOp op);
65 static pthread_mutex_t addQueue;
66 static pthread_cond_t checkQueue;
67 pthread_cond_t initialized;
68 pthread_t threadID;
69 #else
70 SkThread* thread;
71 #endif
72 static State4* queue;
73 int index;
74 bool done;
75 bool last;
76 int a;
77 int b;
78 int c;
79 int d; // sometimes 1 if abc_is_a_triangle
80 int testsRun;
81 char filename[256];
82 skiatest::Reporter* reporter;
83 SkBitmap bitmap;
84 mutable SkDynamicMemoryWStream ramStream;
85 };
86
87 void createThread(State4* statePtr, void* (*test)(void* ));
88 int dispatchTest4(ThreadFunction testFun, int a, int b, int c, int d);
89 void initializeTests(skiatest::Reporter* reporter, const char* testName, size_t testNameSize);
90 void outputProgress(const State4& state, const char* pathStr, SkPath::FillType ) ;
91 void outputProgress(const State4& state, const char* pathStr, SkPathOp op);
92 void outputToStream(const State4& state, const char* pathStr, const char* pathPr efix,
93 const char* nameSuffix,
94 const char* testFunction, SkWStream& outFile);
95 bool runNextTestSet(State4& state);
96 int waitForCompletion();
97 41
98 void RunTestSet(skiatest::Reporter* reporter, TestDesc tests[], size_t count, 42 void RunTestSet(skiatest::Reporter* reporter, TestDesc tests[], size_t count,
99 void (*firstTest)(skiatest::Reporter* ), 43 void (*firstTest)(skiatest::Reporter* ),
100 void (*stopTest)(skiatest::Reporter* ), bool reverse); 44 void (*stopTest)(skiatest::Reporter* ), bool reverse);
101 45
102 #endif 46 #endif
OLDNEW
« no previous file with comments | « tests/PathOpsCubicIntersectionTestData.cpp ('k') | tests/PathOpsExtendedTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698