7#include "flutter/testing/testing.h"
15TEST(SkiaConversionsTest, SkPointToPoint) {
16 for (
int x = -100;
x < 100;
x += 4) {
17 for (
int y = -100;
y < 100;
y += 4) {
24TEST(SkiaConversionsTest, SkPointToSize) {
25 for (
int x = -100;
x < 100;
x += 4) {
26 for (
int y = -100;
y < 100;
y += 4) {
28 Size(
x * 0.25f,
y * 0.25f));
47TEST(SkiaConversionsTest, GradientStopConversion) {
52 std::vector<float> stops = {0.0, 0.5, 1.0};
63 std::vector<Color> converted_colors;
64 std::vector<Scalar> converted_stops;
73TEST(SkiaConversionsTest, GradientMissing0) {
76 std::vector<float> stops = {0.5, 1.0};
87 std::vector<Color> converted_colors;
88 std::vector<Scalar> converted_stops;
99TEST(SkiaConversionsTest, GradientMissingLastValue) {
102 std::vector<float> stops = {0.0, .5};
103 const auto gradient =
113 std::vector<Color> converted_colors;
114 std::vector<Scalar> converted_stops;
125TEST(SkiaConversionsTest, GradientStopGreaterThan1) {
129 std::vector<float> stops = {0.0, 100, 1.0};
130 const auto gradient =
140 std::vector<Color> converted_colors;
141 std::vector<Scalar> converted_stops;
151TEST(SkiaConversionsTest, GradientConversionNonMonotonic) {
152 std::vector<flutter::DlColor>
colors = {
155 std::vector<float> stops = {0.0, 0.5, 0.4, 1.0};
156 const auto gradient =
166 std::vector<Color> converted_colors;
167 std::vector<Scalar> converted_stops;
static SkRRect MakeRectXY(const SkRect &rect, SkScalar xRad, SkScalar yRad)
static std::shared_ptr< DlLinearGradientColorSource > MakeLinear(const SkPoint start_point, const SkPoint end_point, uint32_t stop_count, const DlColor *colors, const float *stops, DlTileMode tile_mode, const SkMatrix *matrix=nullptr)
PODArray< SkColor > colors
void ConvertStops(const flutter::DlGradientColorSourceBase *gradient, std::vector< Color > &colors, std::vector< float > &stops)
Convert display list colors + stops into impeller colors and stops, taking care to ensure that the st...
Point ToPoint(const SkPoint &point)
Size ToSize(const SkPoint &point)
bool IsNearlySimpleRRect(const SkRRect &rr)
Like SkRRect.isSimple, but allows the corners to differ by kEhCloseEnough.
Color ToColor(const flutter::DlColor &color)
TEST(AiksCanvasTest, EmptyCullRect)
constexpr bool ScalarNearlyEqual(Scalar x, Scalar y, Scalar tolerance=kEhCloseEnough)
static constexpr SkPoint Make(float x, float y)
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
static constexpr DlColor kBlue()
static constexpr DlColor kRed()
static constexpr DlColor kGreen()
#define EXPECT_TRUE(handle)