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 "Test.h"
16
17 DECLARE_bool(runFail);
18 DECLARE_bool(runBinary);
19
20 struct PathOpsThreadState;
21
22 struct TestDesc {
23 void (*fun)(skiatest::Reporter*, const char* filename);
24 const char* str;
25 };
26
27 //extern int comparePaths(const SkPath& one, const SkPath& two);
28 extern int comparePaths(skiatest::Reporter* reporter, const char* filename,
29 const SkPath& one, const SkPath& two, SkBitmap& bitmap);
30
comparePaths(skiatest::Reporter * reporter,const char * filename,const SkPath & one,const SkPath & two)31 inline int comparePaths(skiatest::Reporter* reporter, const char* filename,
32 const SkPath& one, const SkPath& two) {
33 SkBitmap bitmap;
34 return comparePaths(reporter, filename, one, two, bitmap);
35 }
36
37 extern bool drawAsciiPaths(const SkPath& one, const SkPath& two, bool drawPaths);
38 extern void showOp(const SkPathOp op);
39 extern bool testPathOp(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b,
40 const SkPathOp , const char* testName);
41 extern bool testPathOpCheck(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b,
42 const SkPathOp , const char* testName, bool checkFail);
43 extern bool testPathOpFailCheck(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b,
44 const SkPathOp , const char* testName);
45 extern bool testPathFailOp(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b,
46 const SkPathOp , const char* testName);
47 extern bool testSimplify(SkPath& path, bool useXor, SkPath& out, PathOpsThreadState& state,
48 const char* pathStr);
49 extern bool testSimplify(skiatest::Reporter* reporter, const SkPath& path, const char* filename);
50 extern bool testSimplifyCheck(skiatest::Reporter* reporter, const SkPath& path,
51 const char* filename, bool checkFail);
52
53 void initializeTests(skiatest::Reporter* reporter, const char* testName);
54 void outputProgress(char* ramStr, const char* pathStr, SkPath::FillType );
55 void outputProgress(char* ramStr, const char* pathStr, SkPathOp op);
56
57 void RunTestSet(skiatest::Reporter* reporter, TestDesc tests[], size_t count,
58 void (*firstTest)(skiatest::Reporter* , const char* filename),
59 void (*skipTest)(skiatest::Reporter* , const char* filename),
60 void (*stopTest)(skiatest::Reporter* , const char* filename), bool reverse);
61 void ShowTestArray(const char* testName);
62 void ShowTestName(PathOpsThreadState* data, int a, int b, int c, int d);
63 void ShowFunctionHeader(const char* name);
64 void ShowPath(const SkPath& path, const char* pathName);
65 void ShowOp(SkPathOp op, const char* pathOne, const char* pathTwo);
66
67 #endif
68