Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions | Variables
PathOpsQuadReduceOrderTest.cpp File Reference
#include "include/core/SkTypes.h"
#include "include/private/base/SkDebug.h"
#include "include/private/base/SkMath.h"
#include "src/pathops/SkPathOpsQuad.h"
#include "src/pathops/SkReduceOrder.h"
#include "tests/PathOpsQuadIntersectionTestData.h"
#include "tests/PathOpsTestCommon.h"
#include "tests/Test.h"
#include <array>
#include <cstddef>

Go to the source code of this file.

Functions

static void oneOffTest (skiatest::Reporter *reporter)
 
static void standardTestCases (skiatest::Reporter *reporter)
 
 DEF_TEST (PathOpsReduceOrderQuad, reporter)
 

Variables

static const QuadPts testSet []
 
static const size_t testSetCount = std::size(testSet)
 

Function Documentation

◆ DEF_TEST()

DEF_TEST ( PathOpsReduceOrderQuad  ,
reporter   
)

Definition at line 77 of file PathOpsQuadReduceOrderTest.cpp.

77 {
80}
reporter
static void standardTestCases(skiatest::Reporter *reporter)
static void oneOffTest(skiatest::Reporter *reporter)

◆ oneOffTest()

static void oneOffTest ( skiatest::Reporter reporter)
static

Definition at line 26 of file PathOpsQuadReduceOrderTest.cpp.

26 {
27 for (size_t index = 0; index < testSetCount; ++index) {
28 const QuadPts& q = testSet[index];
29 SkDQuad quad;
30 quad.debugSet(q.fPts);
31 SkReduceOrder reducer;
32 SkDEBUGCODE(int result = ) reducer.reduce(quad);
33 SkASSERT(result == 3);
34 }
35}
static const QuadPts testSet[]
static const size_t testSetCount
#define SkASSERT(cond)
Definition SkAssert.h:116
#define SkDEBUGCODE(...)
Definition SkDebug.h:23
GAsyncResult * result
SkDPoint fPts[kPointCount]
void debugSet(const SkDPoint *pts)

◆ standardTestCases()

static void standardTestCases ( skiatest::Reporter reporter)
static

Definition at line 37 of file PathOpsQuadReduceOrderTest.cpp.

37 {
38 size_t index;
39 SkReduceOrder reducer;
40 int order;
41 enum {
42 RunAll,
43 RunQuadraticLines,
44 RunQuadraticModLines,
45 RunNone
46 } run = RunAll;
47 int firstTestIndex = 0;
48#if 0
49 run = RunQuadraticLines;
50 firstTestIndex = 1;
51#endif
52 int firstQuadraticLineTest = run == RunAll ? 0 : run == RunQuadraticLines ? firstTestIndex
53 : SK_MaxS32;
54 int firstQuadraticModLineTest = run == RunAll ? 0 : run == RunQuadraticModLines ? firstTestIndex
55 : SK_MaxS32;
56
57 for (index = firstQuadraticLineTest; index < quadraticLines_count; ++index) {
58 const QuadPts& q = quadraticLines[index];
59 SkDQuad quad;
60 quad.debugSet(q.fPts);
61 order = reducer.reduce(quad);
62 if (order != 2) {
63 SkDebugf("[%d] line quad order=%d\n", (int) index, order);
64 }
65 }
66 for (index = firstQuadraticModLineTest; index < quadraticModEpsilonLines_count; ++index) {
67 const QuadPts& q = quadraticModEpsilonLines[index];
68 SkDQuad quad;
69 quad.debugSet(q.fPts);
70 order = reducer.reduce(quad);
71 if (order != 2 && order != 3) { // FIXME: data probably is not good
72 SkDebugf("[%d] line mod quad order=%d\n", (int) index, order);
73 }
74 }
75}
const size_t quadraticLines_count
const QuadPts quadraticModEpsilonLines[]
const size_t quadraticModEpsilonLines_count
const QuadPts quadraticLines[]
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static constexpr int32_t SK_MaxS32
Definition SkMath.h:21
Definition run.py:1
int reduce(const SkDCubic &cubic, Quadratics)

Variable Documentation

◆ testSet

const QuadPts testSet[]
static
Initial value:
= {
{{{1, 1}, {2, 2}, {1, 1.000003}}},
{{{1, 0}, {2, 6}, {3, 0}}}
}

Definition at line 19 of file PathOpsQuadReduceOrderTest.cpp.

19 {
20 {{{1, 1}, {2, 2}, {1, 1.000003}}},
21 {{{1, 0}, {2, 6}, {3, 0}}}
22};

◆ testSetCount

const size_t testSetCount = std::size(testSet)
static

Definition at line 24 of file PathOpsQuadReduceOrderTest.cpp.