7 #include "gtest/gtest.h"
9 #include "flutter/display_list/testing/dl_test_mock_path_receiver.h"
10 #include "flutter/testing/testing.h"
21 TEST(PathSourceTest, RectSourceTest) {
29 ::testing::StrictMock<DlPathReceiverMock> receiver;
32 ::testing::Sequence sequence;
39 EXPECT_CALL(receiver,
Close());
45 TEST(PathSourceTest, EllipseSourceTest) {
53 ::testing::StrictMock<DlPathReceiverMock> receiver;
56 ::testing::Sequence sequence;
58 EXPECT_CALL(receiver,
MoveTo(
Point(10, 22.5),
true));
63 EXPECT_CALL(receiver,
Close());
69 TEST(PathSourceTest, RoundRectSourceTest) {
73 .top_right =
Size(2, 12),
74 .bottom_left =
Size(4, 14),
75 .bottom_right =
Size(3, 13),
84 ::testing::StrictMock<DlPathReceiverMock> receiver;
87 ::testing::Sequence sequence;
98 EXPECT_CALL(receiver,
Close());
104 TEST(PathSourceTest, DiffRoundRectSourceTest) {
107 ASSERT_TRUE(outer_rect.
Contains(inner_rect));
110 .top_right =
Size(2, 12),
111 .bottom_left =
Size(4, 14),
112 .bottom_right =
Size(3, 13),
122 ::testing::StrictMock<DlPathReceiverMock> receiver;
125 ::testing::Sequence sequence;
127 EXPECT_CALL(receiver,
MoveTo(
Point(11, 15),
true));
131 EXPECT_CALL(receiver,
138 EXPECT_CALL(receiver,
Close()).RetiresOnSaturation();
140 EXPECT_CALL(receiver,
MoveTo(
Point(51, 60),
true));
144 EXPECT_CALL(receiver,
151 EXPECT_CALL(receiver,
Close()).RetiresOnSaturation();
164 ::testing::StrictMock<DlPathReceiverMock> receiver;
167 ::testing::Sequence sequence;
169 EXPECT_CALL(receiver,
MoveTo(
Point(10, 10),
false));
171 EXPECT_CALL(receiver,
MoveTo(
Point(20, 10),
false));
178 TEST(PathSourceTest, EmptyDashedLinePathSource) {
185 ::testing::StrictMock<DlPathReceiverMock> receiver;
188 ::testing::Sequence sequence;
190 EXPECT_CALL(receiver,
MoveTo(
Point(10, 10),
false));
197 TEST(PathSourceTest, DashedLinePathSourceZeroOffGaps) {
204 ::testing::StrictMock<DlPathReceiverMock> receiver;
207 ::testing::Sequence sequence;
209 EXPECT_CALL(receiver,
MoveTo(
Point(10, 10),
false));
216 TEST(PathSourceTest, DashedLinePathSourceInvalidOffGaps) {
223 ::testing::StrictMock<DlPathReceiverMock> receiver;
226 ::testing::Sequence sequence;
228 EXPECT_CALL(receiver,
MoveTo(
Point(10, 10),
false));
235 TEST(PathSourceTest, DashedLinePathSourceInvalidOnRegion) {
242 ::testing::StrictMock<DlPathReceiverMock> receiver;
245 ::testing::Sequence sequence;
247 EXPECT_CALL(receiver,
MoveTo(
Point(10, 10),
false));
A PathSource that generates the various segments of a dashed line.
bool IsConvex() const override
FillType GetFillType() const override
Rect GetBounds() const override
void Dispatch(PathReceiver &receiver) const override
Rect GetBounds() const override
bool IsConvex() const override
void Dispatch(PathReceiver &receiver) const override
FillType GetFillType() const override
A PathSource object that provides path iteration for any ellipse inscribed within a Rect bounds.
void Dispatch(PathReceiver &receiver) const override
bool IsConvex() const override
Rect GetBounds() const override
FillType GetFillType() const override
A PathSource object that provides path iteration for any TRect.
FillType GetFillType() const override
bool IsConvex() const override
Rect GetBounds() const override
void Dispatch(PathReceiver &receiver) const override
Rect GetBounds() const override
bool IsConvex() const override
void Dispatch(PathReceiver &receiver) const override
FillType GetFillType() const override
TEST(AllocationSizeTest, CanCreateTypedAllocations)
flutter::testing::DlPathReceiverMock DlPathReceiverMock
constexpr float kSqrt2Over2
void MoveTo(PathBuilder *builder, Scalar x, Scalar y)
void LineTo(PathBuilder *builder, Scalar x, Scalar y)
void Close(PathBuilder *builder)
static RoundRect MakeRectRadii(const Rect &rect, const RoundingRadii &radii)
constexpr bool Contains(const TPoint< Type > &p) const
Returns true iff the provided point |p| is inside the half-open interior of this rectangle.
constexpr static TRect MakeLTRB(Type left, Type top, Type right, Type bottom)