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 "include/core/SkBitmap.h"
11 #include "include/pathops/SkPathOps.h"
12
13 #include <cstddef>
14
15 class SkPath;
16 namespace skiatest { class Reporter; }
17 struct PathOpsThreadState;
18
19 struct TestDesc {
20 void (*fun)(skiatest::Reporter*, const char* filename);
21 const char* str;
22 };
23
24 //extern int comparePaths(const SkPath& one, const SkPath& two);
25 extern int comparePaths(skiatest::Reporter* reporter, const char* filename,
26 const SkPath& one, const SkPath& two, SkBitmap& bitmap);
27
comparePaths(skiatest::Reporter * reporter,const char * filename,const SkPath & one,const SkPath & two)28 inline int comparePaths(skiatest::Reporter* reporter, const char* filename,
29 const SkPath& one, const SkPath& two) {
30 SkBitmap bitmap;
31 return comparePaths(reporter, filename, one, two, bitmap);
32 }
33
34 extern bool drawAsciiPaths(const SkPath& one, const SkPath& two, bool drawPaths);
35 extern void markTestFlakyForPathKit();
36 extern void showOp(const SkPathOp op);
37 extern bool testPathOp(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b,
38 const SkPathOp , const char* testName);
39 extern bool testPathOpCheck(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b,
40 const SkPathOp , const char* testName, bool checkFail);
41 extern bool testPathOpFail(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b,
42 const SkPathOp, const char* testName);
43 extern bool testPathOpFuzz(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b,
44 const SkPathOp , const char* testName);
45 extern bool testSimplify(SkPath& path, bool useXor, SkPath& out, PathOpsThreadState& state,
46 const char* pathStr);
47 extern bool testSimplify(skiatest::Reporter* reporter, const SkPath& path, const char* filename);
48 extern bool testSimplifyCheck(skiatest::Reporter* reporter, const SkPath& path,
49 const char* filename, bool checkFail);
50 extern bool testSimplifyFail(skiatest::Reporter* reporter, const SkPath& path,
51 const char* filename);
52 extern bool testSimplifyFuzz(skiatest::Reporter* reporter, const SkPath& path,
53 const char* filename);
54
55 void initializeTests(skiatest::Reporter* reporter, const char* testName);
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 ShowFunctionHeader(const char* name);
62 void ShowPath(const SkPath& path, const char* pathName);
63 void ShowOp(SkPathOp op, const char* pathOne, const char* pathTwo);
64
65 #endif
66