Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
ContourTest.cpp File Reference
#include "modules/bentleyottmann/include/Contour.h"
#include "include/core/SkPath.h"
#include "include/core/SkPathBuilder.h"
#include "tests/Test.h"

Go to the source code of this file.

Functions

 DEF_TEST (CFC_Contours_Basic, r)
 

Function Documentation

◆ DEF_TEST()

DEF_TEST ( CFC_Contours_Basic  ,
 
)

Definition at line 12 of file ContourTest.cpp.

12 {
13 {
14 // No contours basic
15 SkPath p;
16 Contours contours = Contours::Make(p);
17 REPORTER_ASSERT(r, contours.empty());
18 }
19 {
20 // Path with just a close.
22 b.close();
23 SkPath p = b.detach();
24 Contours contours = Contours::Make(p);
25 REPORTER_ASSERT(r, contours.empty());
26 }
27 {
28 // Path with a bunch of moves.
30 b.moveTo(10, 10);
31 b.moveTo(20, 20);
32 b.close();
33 SkPath p = b.detach();
34 Contours contours = Contours::Make(p);
35 REPORTER_ASSERT(r, contours.empty());
36 }
37 {
38 // LineTo, but no close.
40 b.moveTo(10, 10);
41 b.moveTo(20, 20);
42 b.lineTo(30, 30);
43 SkPath p = b.detach();
44 Contours contours = Contours::Make(p);
45 REPORTER_ASSERT(r, contours.size() == 1);
46 Contour c = *contours.begin();
47 REPORTER_ASSERT(r, c.points.size() == 2);
54 }
55 {
56 // LineTo with close.
58 b.moveTo(10, 10);
59 b.moveTo(20, 20);
60 b.lineTo(30, 30);
61 b.close();
62 SkPath p = b.detach();
63 Contours contours = Contours::Make(p);
64 REPORTER_ASSERT(r, contours.size() == 1);
65 Contour c = *contours.begin();
66 REPORTER_ASSERT(r, c.points.size() == 3);
69 // Extra point added by close.
75 }
76 {
77 // LineTo with close and extra moves.
79 b.moveTo(10, 10);
80 b.moveTo(20, 20);
81 b.lineTo(30, 30);
82 b.close();
83 b.moveTo(100, 100);
84 SkPath p = b.detach();
85 Contours contours = Contours::Make(p);
86 REPORTER_ASSERT(r, contours.size() == 1);
87 Contour c = *contours.begin();
88 REPORTER_ASSERT(r, c.points.size() == 3);
91 // Extra point added by close.
97 }
98}
#define REPORTER_ASSERT(r, cond,...)
Definition Test.h:286
SkPathBuilder & close()
SkPathBuilder & lineTo(SkPoint pt)
SkPathBuilder & moveTo(SkPoint pt)
SkIRect bounds
Definition Contour.h:30
SkSpan< const Point > points
Definition Contour.h:29
size_t size() const
Definition Contour.h:78
static constexpr double kScaleFactor
Definition Contour.h:59
Iterator begin() const
Definition Contour.h:70
bool empty() const
Definition Contour.h:82
static Contours Make(SkPath path)
Definition Contour.cpp:16
static bool b
static constexpr SkIRect MakeLTRB(int32_t l, int32_t t, int32_t r, int32_t b)
Definition SkRect.h:91