blob: 55a4410ed01cc15dbca29eb4bf73b76689a353c2 [file] [log] [blame]
caryclark@google.com818b0cc2013-04-08 11:50:46 +00001/*
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.com818b0cc2013-04-08 11:50:46 +000010#include "SkBitmap.h"
caryclark65b427c2014-09-18 10:32:57 -070011#include "SkCommandLineFlags.h"
caryclark@google.com818b0cc2013-04-08 11:50:46 +000012#include "SkPath.h"
caryclark@google.com66089e42013-04-10 15:55:37 +000013#include "SkPathOpsTypes.h"
caryclark@google.com818b0cc2013-04-08 11:50:46 +000014#include "SkStream.h"
caryclark@google.com66089e42013-04-10 15:55:37 +000015#include "Test.h"
caryclark@google.com818b0cc2013-04-08 11:50:46 +000016
caryclark65b427c2014-09-18 10:32:57 -070017DECLARE_bool(runFail);
caryclark54359292015-03-26 07:52:43 -070018DECLARE_bool(runBinary);
caryclark65b427c2014-09-18 10:32:57 -070019
caryclark@google.com66089e42013-04-10 15:55:37 +000020struct PathOpsThreadState;
caryclark@google.com818b0cc2013-04-08 11:50:46 +000021
22struct TestDesc {
commit-bot@chromium.org4431e772014-04-14 17:08:59 +000023 void (*fun)(skiatest::Reporter*, const char* filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +000024 const char* str;
25};
26
caryclark@google.com818b0cc2013-04-08 11:50:46 +000027//extern int comparePaths(const SkPath& one, const SkPath& two);
caryclark54359292015-03-26 07:52:43 -070028extern int comparePaths(skiatest::Reporter* reporter, const char* filename,
29 const SkPath& one, const SkPath& two, SkBitmap& bitmap);
caryclark4e1a4c92015-05-18 12:56:57 -070030
31inline 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
caryclark@google.com818b0cc2013-04-08 11:50:46 +000037extern bool drawAsciiPaths(const SkPath& one, const SkPath& two, bool drawPaths);
38extern void showOp(const SkPathOp op);
caryclark@google.com818b0cc2013-04-08 11:50:46 +000039extern bool testPathOp(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b,
caryclark65f55312014-11-13 06:58:52 -080040 const SkPathOp , const char* testName);
41extern bool testPathOpCheck(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b,
42 const SkPathOp , const char* testName, bool checkFail);
caryclark55888e42016-07-18 10:01:36 -070043extern bool testPathOpFail(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b,
44 const SkPathOp, const char* testName);
caryclark30b9fdd2016-08-31 14:36:29 -070045extern bool testPathOpFuzz(skiatest::Reporter* reporter, const SkPath& a,
46 const SkPath& b, const SkPathOp , const char* testName);
caryclark@google.com66089e42013-04-10 15:55:37 +000047extern bool testSimplify(SkPath& path, bool useXor, SkPath& out, PathOpsThreadState& state,
48 const char* pathStr);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +000049extern bool testSimplify(skiatest::Reporter* reporter, const SkPath& path, const char* filename);
caryclark54359292015-03-26 07:52:43 -070050extern bool testSimplifyCheck(skiatest::Reporter* reporter, const SkPath& path,
51 const char* filename, bool checkFail);
caryclark30b9fdd2016-08-31 14:36:29 -070052extern bool testSimplifyFuzz(skiatest::Reporter* reporter, const SkPath& path,
caryclark55888e42016-07-18 10:01:36 -070053 const char* filename);
caryclark@google.com818b0cc2013-04-08 11:50:46 +000054
mtklein406654b2014-09-03 15:34:37 -070055void initializeTests(skiatest::Reporter* reporter, const char* testName);
caryclark@google.com66089e42013-04-10 15:55:37 +000056void outputProgress(char* ramStr, const char* pathStr, SkPath::FillType );
57void outputProgress(char* ramStr, const char* pathStr, SkPathOp op);
caryclark@google.com818b0cc2013-04-08 11:50:46 +000058
59void RunTestSet(skiatest::Reporter* reporter, TestDesc tests[], size_t count,
commit-bot@chromium.org4431e772014-04-14 17:08:59 +000060 void (*firstTest)(skiatest::Reporter* , const char* filename),
caryclark54359292015-03-26 07:52:43 -070061 void (*skipTest)(skiatest::Reporter* , const char* filename),
commit-bot@chromium.org4431e772014-04-14 17:08:59 +000062 void (*stopTest)(skiatest::Reporter* , const char* filename), bool reverse);
caryclark@google.com03610322013-04-18 15:58:21 +000063void ShowTestName(PathOpsThreadState* data, int a, int b, int c, int d);
caryclark@google.com07e97fc2013-07-08 17:17:02 +000064void ShowFunctionHeader(const char* name);
65void ShowPath(const SkPath& path, const char* pathName);
66void ShowOp(SkPathOp op, const char* pathOne, const char* pathTwo);
caryclark@google.com818b0cc2013-04-08 11:50:46 +000067
68#endif