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 "SkPath.h" 12 #include "SkPathOpsTypes.h" 13 #include "SkStream.h" 14 #include "Test.h" 15 16 struct PathOpsThreadState; 17 18 struct TestDesc { 19 void (*fun)(skiatest::Reporter*, const char* filename); 20 const char* str; 21 }; 22 23 //extern int comparePaths(const SkPath& one, const SkPath& two); 24 extern int comparePaths(skiatest::Reporter* reporter, const char* filename, 25 const SkPath& one, const SkPath& two, SkBitmap& bitmap); 26 27 inline int comparePaths(skiatest::Reporter* reporter, const char* filename, 28 const SkPath& one, const SkPath& two) { 29 SkBitmap bitmap; 30 return comparePaths(reporter, filename, one, two, bitmap); 31 } 32 33 extern bool drawAsciiPaths(const SkPath& one, const SkPath& two, bool drawPaths); 34 extern void showOp(const SkPathOp op); 35 extern bool testPathOp(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b, 36 const SkPathOp , const char* testName); 37 extern bool testPathOpCheck(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b, 38 const SkPathOp , const char* testName, bool checkFail); 39 extern bool testPathOpFail(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b, 40 const SkPathOp, const char* testName); 41 extern bool testPathOpFuzz(skiatest::Reporter* reporter, const SkPath& a, 42 const SkPath& b, const SkPathOp , const char* testName); 43 extern bool testSimplify(SkPath& path, bool useXor, SkPath& out, PathOpsThreadState& state, 44 const char* pathStr); 45 extern bool testSimplify(skiatest::Reporter* reporter, const SkPath& path, const char* filename); 46 extern bool testSimplifyCheck(skiatest::Reporter* reporter, const SkPath& path, 47 const char* filename, bool checkFail); 48 extern bool testSimplifyFuzz(skiatest::Reporter* reporter, const SkPath& path, 49 const char* filename); 50 51 void initializeTests(skiatest::Reporter* reporter, const char* testName); 52 53 void RunTestSet(skiatest::Reporter* reporter, TestDesc tests[], size_t count, 54 void (*firstTest)(skiatest::Reporter* , const char* filename), 55 void (*skipTest)(skiatest::Reporter* , const char* filename), 56 void (*stopTest)(skiatest::Reporter* , const char* filename), bool reverse); 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