Home | History | Annotate | Download | only in tests
      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 markTestFlakyForPathKit();
     35 extern void showOp(const SkPathOp op);
     36 extern bool testPathOp(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b,
     37                        const SkPathOp , const char* testName);
     38 extern bool testPathOpCheck(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b,
     39                             const SkPathOp , const char* testName, bool checkFail);
     40 extern bool testPathOpFail(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b,
     41                            const SkPathOp, const char* testName);
     42 extern bool testPathOpFuzz(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b,
     43                            const SkPathOp , const char* testName);
     44 extern bool testSimplify(SkPath& path, bool useXor, SkPath& out, PathOpsThreadState& state,
     45                          const char* pathStr);
     46 extern bool testSimplify(skiatest::Reporter* reporter, const SkPath& path, const char* filename);
     47 extern bool testSimplifyCheck(skiatest::Reporter* reporter, const SkPath& path,
     48                               const char* filename, bool checkFail);
     49 extern bool testSimplifyFail(skiatest::Reporter* reporter, const SkPath& path,
     50                              const char* filename);
     51 extern bool testSimplifyFuzz(skiatest::Reporter* reporter, const SkPath& path,
     52                              const char* filename);
     53 
     54 void initializeTests(skiatest::Reporter* reporter, const char* testName);
     55 
     56 void RunTestSet(skiatest::Reporter* reporter, TestDesc tests[], size_t count,
     57                 void (*firstTest)(skiatest::Reporter* , const char* filename),
     58                 void (*skipTest)(skiatest::Reporter* , const char* filename),
     59                 void (*stopTest)(skiatest::Reporter* , const char* filename), bool reverse);
     60 void ShowTestName(PathOpsThreadState* data, int a, int b, int c, int d);
     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