Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
PathTest_Private Class Reference

Public Member Functions

 PathTest_Private (SkPath *path)
 
void setPt (int index, SkScalar x, SkScalar y)
 

Static Public Member Functions

static size_t GetFreeSpace (const SkPath &path)
 
static void TestPathTo (skiatest::Reporter *reporter)
 
static void TestPathrefListeners (skiatest::Reporter *reporter)
 

Public Attributes

SkPathfPath
 

Detailed Description

Definition at line 30 of file PathOpsOpTest.cpp.

Constructor & Destructor Documentation

◆ PathTest_Private()

PathTest_Private::PathTest_Private ( SkPath path)
inline

Definition at line 32 of file PathOpsOpTest.cpp.

33 : fPath(path) {}
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition: switches.h:57

Member Function Documentation

◆ GetFreeSpace()

static size_t PathTest_Private::GetFreeSpace ( const SkPath path)
inlinestatic

Definition at line 4636 of file PathTest.cpp.

4636 {
4637 return PathRefTest_Private::GetFreeSpace(*path.fPathRef);
4638 }
static size_t GetFreeSpace(const SkPathRef &ref)
Definition: PathTest.cpp:4469

◆ setPt()

void PathTest_Private::setPt ( int  index,
SkScalar  x,
SkScalar  y 
)
inline

Definition at line 35 of file PathOpsOpTest.cpp.

35 {
36 fPath->setPt(index, x, y);
37 }
double y
double x

◆ TestPathrefListeners()

static void PathTest_Private::TestPathrefListeners ( skiatest::Reporter reporter)
inlinestatic

Definition at line 4658 of file PathTest.cpp.

4658 {
4659 SkPath p;
4660
4661 bool changed = false;
4662 p.moveTo(0, 0);
4663
4664 // Check that listener is notified on moveTo().
4665
4666 SkPathPriv::AddGenIDChangeListener(p, sk_make_sp<ChangeListener>(&changed));
4667 REPORTER_ASSERT(reporter, !changed);
4668 p.moveTo(10, 0);
4669 REPORTER_ASSERT(reporter, changed);
4670
4671 // Check that listener is notified on lineTo().
4672 SkPathPriv::AddGenIDChangeListener(p, sk_make_sp<ChangeListener>(&changed));
4673 REPORTER_ASSERT(reporter, !changed);
4674 p.lineTo(20, 0);
4675 REPORTER_ASSERT(reporter, changed);
4676
4677 // Check that listener is notified on reset().
4678 SkPathPriv::AddGenIDChangeListener(p, sk_make_sp<ChangeListener>(&changed));
4679 REPORTER_ASSERT(reporter, !changed);
4680 p.reset();
4681 REPORTER_ASSERT(reporter, changed);
4682
4683 p.moveTo(0, 0);
4684
4685 // Check that listener is notified on rewind().
4686 SkPathPriv::AddGenIDChangeListener(p, sk_make_sp<ChangeListener>(&changed));
4687 REPORTER_ASSERT(reporter, !changed);
4688 p.rewind();
4689 REPORTER_ASSERT(reporter, changed);
4690
4691 // Check that listener is notified on transform().
4692 {
4693 SkPath q;
4694 q.moveTo(10, 10);
4695 SkPathPriv::AddGenIDChangeListener(q, sk_make_sp<ChangeListener>(&changed));
4696 REPORTER_ASSERT(reporter, !changed);
4698 matrix.setScale(2, 2);
4699 p.transform(matrix, &q);
4700 REPORTER_ASSERT(reporter, changed);
4701 }
4702
4703 // Check that listener is notified when pathref is deleted.
4704 {
4705 SkPath q;
4706 q.moveTo(10, 10);
4707 SkPathPriv::AddGenIDChangeListener(q, sk_make_sp<ChangeListener>(&changed));
4708 REPORTER_ASSERT(reporter, !changed);
4709 }
4710 // q went out of scope.
4711 REPORTER_ASSERT(reporter, changed);
4712 }
reporter
Definition: FontMgrTest.cpp:39
#define REPORTER_ASSERT(r, cond,...)
Definition: Test.h:286
static void AddGenIDChangeListener(const SkPath &path, sk_sp< SkIDChangeListener > listener)
Definition: SkPathPriv.h:106
Definition: SkPath.h:59
SkPath & moveTo(SkScalar x, SkScalar y)
Definition: SkPath.cpp:688
unsigned useCenter Optional< SkMatrix > matrix
Definition: SkRecords.h:258

◆ TestPathTo()

static void PathTest_Private::TestPathTo ( skiatest::Reporter reporter)
inlinestatic

Definition at line 4640 of file PathTest.cpp.

4640 {
4641 SkPath p, q;
4642 p.lineTo(4, 4);
4643 p.reversePathTo(q);
4644 check_path_is_line(reporter, &p, 4, 4);
4645 q.moveTo(-4, -4);
4646 p.reversePathTo(q);
4647 check_path_is_line(reporter, &p, 4, 4);
4648 q.lineTo(7, 8);
4649 q.conicTo(8, 7, 6, 5, 0.5f);
4650 q.quadTo(6, 7, 8, 6);
4651 q.cubicTo(5, 6, 7, 8, 7, 5);
4652 q.close();
4653 p.reversePathTo(q);
4654 SkRect reverseExpected = {-4, -4, 8, 8};
4655 REPORTER_ASSERT(reporter, p.getBounds() == reverseExpected);
4656 }
static void check_path_is_line(skiatest::Reporter *reporter, SkPath *p, SkScalar x1, SkScalar y1)
Definition: PathTest.cpp:4079
SkPath & lineTo(SkScalar x, SkScalar y)
Definition: SkPath.cpp:728
SkPath & quadTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2)
Definition: SkPath.cpp:746
SkPath & cubicTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar x3, SkScalar y3)
Definition: SkPath.cpp:799
SkPath & conicTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar w)
Definition: SkPath.cpp:766
SkPath & close()
Definition: SkPath.cpp:823

Member Data Documentation

◆ fPath

SkPath* PathTest_Private::fPath

Definition at line 39 of file PathOpsOpTest.cpp.


The documentation for this class was generated from the following files: