1 /*
2  * Copyright 2012 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 #ifndef PathOpsExtendedTest_DEFINED
8 #define PathOpsExtendedTest_DEFINED
9 
10 #include "SkBitmap.h"
11 #include "SkCommandLineFlags.h"
12 #include "SkPath.h"
13 #include "SkPathOpsTypes.h"
14 #include "SkStream.h"
15 #include "SkThread.h"
16 #include "SkThreadUtils.h"
17 #include "Test.h"
18 
19 DECLARE_bool(runFail);
20 DECLARE_bool(runBinary);
21 
22 struct PathOpsThreadState;
23 
24 struct TestDesc {
25     void (*fun)(skiatest::Reporter*, const char* filename);
26     const char* str;
27 };
28 
29 //extern int comparePaths(const SkPath& one, const SkPath& two);
30 extern int comparePaths(skiatest::Reporter* reporter, const char* filename,
31                         const SkPath& one, const SkPath& two, SkBitmap& bitmap);
32 extern bool drawAsciiPaths(const SkPath& one, const SkPath& two, bool drawPaths);
33 extern void showOp(const SkPathOp op);
34 extern bool testPathOp(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b,
35                        const SkPathOp , const char* testName);
36 extern bool testPathOpCheck(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b,
37                             const SkPathOp , const char* testName, bool checkFail);
38 extern bool testPathOpFailCheck(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b,
39                                 const SkPathOp , const char* testName);
40 extern bool testPathFailOp(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b,
41                            const SkPathOp , const char* testName);
42 extern bool testSimplify(SkPath& path, bool useXor, SkPath& out, PathOpsThreadState& state,
43                          const char* pathStr);
44 extern bool testSimplify(skiatest::Reporter* reporter, const SkPath& path, const char* filename);
45 extern bool testSimplifyCheck(skiatest::Reporter* reporter, const SkPath& path,
46                               const char* filename, bool checkFail);
47 
48 void initializeTests(skiatest::Reporter* reporter, const char* testName);
49 void outputProgress(char* ramStr, const char* pathStr, SkPath::FillType );
50 void outputProgress(char* ramStr, const char* pathStr, SkPathOp op);
51 
52 void RunTestSet(skiatest::Reporter* reporter, TestDesc tests[], size_t count,
53                 void (*firstTest)(skiatest::Reporter* , const char* filename),
54                 void (*skipTest)(skiatest::Reporter* , const char* filename),
55                 void (*stopTest)(skiatest::Reporter* , const char* filename), bool reverse);
56 void ShowTestArray(const char* testName);
57 void ShowTestName(PathOpsThreadState* data, int a, int b, int c, int d);
58 void ShowFunctionHeader(const char* name);
59 void ShowPath(const SkPath& path, const char* pathName);
60 void ShowOp(SkPathOp op, const char* pathOne, const char* pathTwo);
61 
62 #endif
63