caryclark@google.com | 818b0cc | 2013-04-08 11:50:46 +0000 | [diff] [blame] | 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 | |
caryclark@google.com | 818b0cc | 2013-04-08 11:50:46 +0000 | [diff] [blame] | 10 | #include "SkBitmap.h" |
caryclark | 65b427c | 2014-09-18 10:32:57 -0700 | [diff] [blame] | 11 | #include "SkCommandLineFlags.h" |
caryclark@google.com | 818b0cc | 2013-04-08 11:50:46 +0000 | [diff] [blame] | 12 | #include "SkPath.h" |
caryclark@google.com | 66089e4 | 2013-04-10 15:55:37 +0000 | [diff] [blame] | 13 | #include "SkPathOpsTypes.h" |
caryclark@google.com | 818b0cc | 2013-04-08 11:50:46 +0000 | [diff] [blame] | 14 | #include "SkStream.h" |
caryclark@google.com | 818b0cc | 2013-04-08 11:50:46 +0000 | [diff] [blame] | 15 | #include "SkThread.h" |
caryclark@google.com | 66089e4 | 2013-04-10 15:55:37 +0000 | [diff] [blame] | 16 | #include "SkThreadUtils.h" |
| 17 | #include "Test.h" |
caryclark@google.com | 818b0cc | 2013-04-08 11:50:46 +0000 | [diff] [blame] | 18 | |
caryclark | 65b427c | 2014-09-18 10:32:57 -0700 | [diff] [blame] | 19 | DECLARE_bool(runFail); |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 20 | DECLARE_bool(runBinary); |
caryclark | 65b427c | 2014-09-18 10:32:57 -0700 | [diff] [blame] | 21 | |
caryclark@google.com | 66089e4 | 2013-04-10 15:55:37 +0000 | [diff] [blame] | 22 | struct PathOpsThreadState; |
caryclark@google.com | 818b0cc | 2013-04-08 11:50:46 +0000 | [diff] [blame] | 23 | |
| 24 | struct TestDesc { |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 25 | void (*fun)(skiatest::Reporter*, const char* filename); |
caryclark@google.com | 818b0cc | 2013-04-08 11:50:46 +0000 | [diff] [blame] | 26 | const char* str; |
| 27 | }; |
| 28 | |
caryclark@google.com | 818b0cc | 2013-04-08 11:50:46 +0000 | [diff] [blame] | 29 | //extern int comparePaths(const SkPath& one, const SkPath& two); |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 30 | extern int comparePaths(skiatest::Reporter* reporter, const char* filename, |
| 31 | const SkPath& one, const SkPath& two, SkBitmap& bitmap); |
caryclark | 4e1a4c9 | 2015-05-18 12:56:57 -0700 | [diff] [blame^] | 32 | |
| 33 | inline int comparePaths(skiatest::Reporter* reporter, const char* filename, |
| 34 | const SkPath& one, const SkPath& two) { |
| 35 | SkBitmap bitmap; |
| 36 | return comparePaths(reporter, filename, one, two, bitmap); |
| 37 | } |
| 38 | |
caryclark@google.com | 818b0cc | 2013-04-08 11:50:46 +0000 | [diff] [blame] | 39 | extern bool drawAsciiPaths(const SkPath& one, const SkPath& two, bool drawPaths); |
| 40 | extern void showOp(const SkPathOp op); |
caryclark@google.com | 818b0cc | 2013-04-08 11:50:46 +0000 | [diff] [blame] | 41 | extern bool testPathOp(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b, |
caryclark | 65f5531 | 2014-11-13 06:58:52 -0800 | [diff] [blame] | 42 | const SkPathOp , const char* testName); |
| 43 | extern bool testPathOpCheck(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b, |
| 44 | const SkPathOp , const char* testName, bool checkFail); |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 45 | extern bool testPathOpFailCheck(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b, |
| 46 | const SkPathOp , const char* testName); |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 47 | extern bool testPathFailOp(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b, |
caryclark | 65f5531 | 2014-11-13 06:58:52 -0800 | [diff] [blame] | 48 | const SkPathOp , const char* testName); |
caryclark@google.com | 66089e4 | 2013-04-10 15:55:37 +0000 | [diff] [blame] | 49 | extern bool testSimplify(SkPath& path, bool useXor, SkPath& out, PathOpsThreadState& state, |
| 50 | const char* pathStr); |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 51 | extern bool testSimplify(skiatest::Reporter* reporter, const SkPath& path, const char* filename); |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 52 | extern bool testSimplifyCheck(skiatest::Reporter* reporter, const SkPath& path, |
| 53 | const char* filename, bool checkFail); |
caryclark@google.com | 818b0cc | 2013-04-08 11:50:46 +0000 | [diff] [blame] | 54 | |
mtklein | 406654b | 2014-09-03 15:34:37 -0700 | [diff] [blame] | 55 | void initializeTests(skiatest::Reporter* reporter, const char* testName); |
caryclark@google.com | 66089e4 | 2013-04-10 15:55:37 +0000 | [diff] [blame] | 56 | void outputProgress(char* ramStr, const char* pathStr, SkPath::FillType ); |
| 57 | void outputProgress(char* ramStr, const char* pathStr, SkPathOp op); |
caryclark@google.com | 818b0cc | 2013-04-08 11:50:46 +0000 | [diff] [blame] | 58 | |
| 59 | void RunTestSet(skiatest::Reporter* reporter, TestDesc tests[], size_t count, |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 60 | void (*firstTest)(skiatest::Reporter* , const char* filename), |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 61 | void (*skipTest)(skiatest::Reporter* , const char* filename), |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 62 | void (*stopTest)(skiatest::Reporter* , const char* filename), bool reverse); |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 63 | void ShowTestArray(const char* testName); |
caryclark@google.com | 0361032 | 2013-04-18 15:58:21 +0000 | [diff] [blame] | 64 | void ShowTestName(PathOpsThreadState* data, int a, int b, int c, int d); |
caryclark@google.com | 07e97fc | 2013-07-08 17:17:02 +0000 | [diff] [blame] | 65 | void ShowFunctionHeader(const char* name); |
| 66 | void ShowPath(const SkPath& path, const char* pathName); |
| 67 | void ShowOp(SkPathOp op, const char* pathOne, const char* pathTwo); |
caryclark@google.com | 818b0cc | 2013-04-08 11:50:46 +0000 | [diff] [blame] | 68 | |
| 69 | #endif |