Flutter Engine
The Flutter Engine
Functions | Variables
PathOpsDLineTest.cpp File Reference
#include "include/core/SkPoint.h"
#include "include/core/SkTypes.h"
#include "src/pathops/SkPathOpsLine.h"
#include "src/pathops/SkPathOpsPoint.h"
#include "src/pathops/SkPathOpsTypes.h"
#include "tests/PathOpsTestCommon.h"
#include "tests/Test.h"
#include <array>
#include <cstddef>

Go to the source code of this file.

Functions

 DEF_TEST (PathOpsLineUtilities, reporter)
 

Variables

static const SkDLine tests []
 
static const size_t tests_count = std::size(tests)
 

Function Documentation

◆ DEF_TEST()

DEF_TEST ( PathOpsLineUtilities  ,
reporter   
)

Definition at line 29 of file PathOpsDLineTest.cpp.

29 {
30 for (size_t index = 0; index < tests_count; ++index) {
31 const SkDLine& line = tests[index];
33 SkDLine line2;
34 SkPoint pts[2] = {line[0].asSkPoint(), line[1].asSkPoint()};
35 line2.set(pts);
36 REPORTER_ASSERT(reporter, line[0] == line2[0] && line[1] == line2[1]);
37 SkDPoint mid = line.ptAtT(.5);
38 REPORTER_ASSERT(reporter, approximately_equal((line[0].fX + line[1].fX) / 2, mid.fX));
39 REPORTER_ASSERT(reporter, approximately_equal((line[0].fY + line[1].fY) / 2, mid.fY));
40 }
41}
reporter
Definition: FontMgrTest.cpp:39
static const SkDLine tests[]
static const size_t tests_count
bool ValidLine(const SkDLine &line)
#define SkASSERT(cond)
Definition: SkAssert.h:116
bool approximately_equal(double x, double y)
#define REPORTER_ASSERT(r, cond,...)
Definition: Test.h:286
const SkDLine & set(const SkPoint pts[2])
Definition: SkPathOpsLine.h:20

Variable Documentation

◆ tests

const SkDLine tests[]
static
Initial value:
= {
{{{2, 1}, {2, 1}}},
{{{2, 1}, {1, 1}}},
{{{2, 1}, {2, 2}}},
{{{1, 1}, {2, 2}}},
{{{3, 0}, {2, 1}}},
{{{3, 2}, {1, 1}}},
}

Definition at line 18 of file PathOpsDLineTest.cpp.

◆ tests_count

const size_t tests_count = std::size(tests)
static

Definition at line 27 of file PathOpsDLineTest.cpp.