5#include "flutter/display_list/dl_paint.h"
7#include "flutter/display_list/utils/dl_comparable.h"
8#include "gtest/gtest.h"
13TEST(DisplayListPaint, ConstructorDefaults) {
15 EXPECT_FALSE(
paint.isAntiAlias());
16 EXPECT_FALSE(
paint.isInvertColors());
18 EXPECT_EQ(
paint.getAlpha(), 0xFF);
25 EXPECT_EQ(
paint.getColorSource(),
nullptr);
26 EXPECT_EQ(
paint.getColorFilter(),
nullptr);
27 EXPECT_EQ(
paint.getImageFilter(),
nullptr);
28 EXPECT_EQ(
paint.getMaskFilter(),
nullptr);
71TEST(DisplayListPaint, NullPointerSetGet) {
77 EXPECT_EQ(
paint.setColorSource(null_color_source).getColorSource(),
nullptr);
78 EXPECT_EQ(
paint.setColorFilter(null_color_filter).getColorFilter(),
nullptr);
79 EXPECT_EQ(
paint.setImageFilter(null_image_filter).getImageFilter(),
nullptr);
80 EXPECT_EQ(
paint.setMaskFilter(null_mask_filter).getMaskFilter(),
nullptr);
83TEST(DisplayListPaint, NullSharedPointerSetGet) {
84 std::shared_ptr<DlColorSource> null_color_source;
85 std::shared_ptr<DlColorFilter> null_color_filter;
86 std::shared_ptr<DlImageFilter> null_image_filter;
87 std::shared_ptr<DlMaskFilter> null_mask_filter;
89 EXPECT_EQ(
paint.setColorSource(null_color_source).getColorSource(),
nullptr);
90 EXPECT_EQ(
paint.setColorFilter(null_color_filter).getColorFilter(),
nullptr);
91 EXPECT_EQ(
paint.setImageFilter(null_image_filter).getImageFilter(),
nullptr);
92 EXPECT_EQ(
paint.setMaskFilter(null_mask_filter).getMaskFilter(),
nullptr);
95TEST(DisplayListPaint, ChainingConstructor) {
118 EXPECT_EQ(
paint.getAlpha(), 0x7F);
123 EXPECT_EQ(
paint.getStrokeWidth(), 42);
124 EXPECT_EQ(
paint.getStrokeMiter(), 1.5);
126 EXPECT_EQ(*
paint.getColorFilter(),
128 EXPECT_EQ(*
paint.getImageFilter(),
130 EXPECT_EQ(*
paint.getMaskFilter(),
static sk_sp< SkImage > color_filter(const SkImage *image, SkColorFilter *colorFilter)
std::shared_ptr< DlImageFilter > shared() const override
std::shared_ptr< DlColorSource > shared() const override
DlPaint & setColor(DlColor color)
DlPaint & setAntiAlias(bool isAntiAlias)
static const DlPaint kDefault
DlPaint & setInvertColors(bool isInvertColors)
DlPaint & setColorFilter(const std::shared_ptr< const DlColorFilter > &filter)
static constexpr float kDefaultWidth
DlPaint & setMaskFilter(const std::shared_ptr< DlMaskFilter > &filter)
DlPaint & setStrokeCap(DlStrokeCap cap)
DlPaint & setStrokeWidth(float width)
DlPaint & setAlpha(uint8_t alpha)
DlPaint & setStrokeMiter(float miter)
DlPaint & setBlendMode(DlBlendMode mode)
static constexpr float kDefaultMiter
DlPaint & setImageFilter(const std::shared_ptr< const DlImageFilter > &filter)
DlPaint & setDrawStyle(DlDrawStyle style)
static constexpr DlColor kDefaultColor
DlPaint & setStrokeJoin(DlStrokeJoin join)
DlPaint & setColorSource(std::shared_ptr< const DlColorSource > source)
std::shared_ptr< DlMaskFilter > mask_filter
TEST(DisplayListComplexity, EmptyDisplayList)
@ kMiter
extends to miter limit
@ kBevel
connects outside edges
@ kButt
no stroke extension
@ kStrokeAndFill
both strokes and fills shapes
@ kFill
fills interior of shapes
@ kInner
fuzzy inside, nothing outside
@ kSrcOver
r = s + (1-sa)*d
@ kLuminosity
luminosity of source with hue and saturation of destination
static constexpr DlColor kMagenta()
static constexpr DlColor kBlack()
static constexpr DlColor kYellow()
constexpr DlColor withAlpha(uint8_t alpha) const
static constexpr DlColor kGreen()
#define EXPECT_TRUE(handle)