Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions impeller/aiks/aiks_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2526,5 +2526,37 @@ TEST_P(AiksTest, CanDrawPointsWithTextureMap) {
ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
}

TEST_P(AiksTest, TextForegroundShaderWithTransform) {
auto mapping = OpenFixtureAsSkData("Roboto-Regular.ttf");
ASSERT_NE(mapping, nullptr);

Scalar font_size = 100;
SkFont sk_font(SkTypeface::MakeFromData(mapping), font_size);

Paint text_paint;
text_paint.color = Color::Blue();

std::vector<Color> colors = {Color{0.9568, 0.2627, 0.2118, 1.0},
Color{0.1294, 0.5882, 0.9529, 1.0}};
std::vector<Scalar> stops = {
0.0,
1.0,
};
text_paint.color_source = ColorSource::MakeLinearGradient(
{0, 0}, {100, 100}, std::move(colors), std::move(stops),
Entity::TileMode::kRepeat, {});

Canvas canvas;
canvas.Translate({100, 100});
canvas.Rotate(Radians(kPi / 4));

auto blob = SkTextBlob::MakeFromString("Hello", sk_font);
ASSERT_NE(blob, nullptr);
auto frame = TextFrameFromTextBlob(blob);
canvas.DrawTextFrame(frame, Point(), text_paint);

ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
}

} // namespace testing
} // namespace impeller