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

Go to the source code of this file.

Functions

 DEF_TEST (PathOpsDPoint, reporter)
 

Variables

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

Function Documentation

◆ DEF_TEST()

DEF_TEST ( PathOpsDPoint  ,
reporter   
)

Definition at line 30 of file PathOpsDPointTest.cpp.

30 {
31 for (size_t index = 0; index < tests_count; ++index) {
32 const SkDPoint& pt = tests[index];
34 SkDPoint p = pt;
36 REPORTER_ASSERT(reporter, !(pt != pt));
37 SkDVector v = p - pt;
38 p += v;
40 p -= v;
42 REPORTER_ASSERT(reporter, p.approximatelyEqual(pt));
43 SkPoint sPt = pt.asSkPoint();
44 p.set(sPt);
46 REPORTER_ASSERT(reporter, p.approximatelyEqual(sPt));
47 REPORTER_ASSERT(reporter, p.roughlyEqual(pt));
48 p.fX = p.fY = 0;
49 REPORTER_ASSERT(reporter, p.fX == 0 && p.fY == 0);
50 REPORTER_ASSERT(reporter, p.approximatelyZero());
51 REPORTER_ASSERT(reporter, pt.distanceSquared(p) == pt.fX * pt.fX + pt.fY * pt.fY);
53 sqrt(pt.fX * pt.fX + pt.fY * pt.fY)));
54 }
55}
reporter
Definition: FontMgrTest.cpp:39
static const size_t tests_count
static const SkDPoint tests[]
bool ValidPoint(const SkDPoint &pt)
#define SkASSERT(cond)
Definition: SkAssert.h:116
bool approximately_equal(double x, double y)
#define REPORTER_ASSERT(r, cond,...)
Definition: Test.h:286
SIN Vec< N, float > sqrt(const Vec< N, float > &x)
Definition: SkVx.h:706

Variable Documentation

◆ tests

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

Definition at line 18 of file PathOpsDPointTest.cpp.

◆ tests_count

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

Definition at line 28 of file PathOpsDPointTest.cpp.