Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
cleaned up test
  • Loading branch information
gaaclarke committed May 16, 2024
commit d127c47fd126f47778036c58ce6c1ac93ebeceb9
59 changes: 9 additions & 50 deletions impeller/display_list/dl_golden_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ namespace testing {

using impeller::PlaygroundBackend;
using impeller::PlaygroundTest;
using impeller::Point;

INSTANTIATE_PLAYGROUND_SUITE(DlGoldenTest);

Expand Down Expand Up @@ -49,8 +50,10 @@ TEST_P(DlGoldenTest, CanRenderImage) {
}

TEST_P(DlGoldenTest, Bug147807) {
auto draw = [](DlCanvas* canvas, const std::vector<sk_sp<DlImage>>& images) {
canvas->Transform2DAffine(2, 0, 0, 0, 2, 0);
Point content_scale = GetContentScale();
auto draw = [content_scale](DlCanvas* canvas,
const std::vector<sk_sp<DlImage>>& images) {
canvas->Transform2DAffine(content_scale.x, 0, 0, 0, content_scale.y, 0);
DlPaint paint;
paint.setColor(DlColor(0xfffef7ff));
canvas->DrawRect(SkRect::MakeLTRB(0, 0, 375, 667), paint);
Expand All @@ -62,52 +65,17 @@ TEST_P(DlGoldenTest, Bug147807) {
canvas->DrawRect(SkRect::MakeLTRB(0, 333.5, 187.5, 667), paint);
paint.setColor(DlColor(0xfff44336));
canvas->DrawRect(SkRect::MakeLTRB(187.5, 333.5, 375, 667), paint);
canvas->Save();
{
canvas->Transform2DAffine(1, 2.449293705170336e-16, -1.70530256582424e-13,
-2.449293705170336e-16, 1,
1.13686837721616e-13);
canvas->DrawShadow(SkPath().addRect(SkRect::MakeLTRB(303, 595, 359, 651)),
DlColor(0xffebddff), 6, false, 2);
canvas->DrawPath(SkPath().addRect(SkRect::MakeLTRB(303, 595, 359, 651)),
DlPaint().setColor(DlColor(0xffebddff)));
canvas->Save();
{
canvas->Translate(303, 595);
canvas->ClipRRect(SkRRect::MakeRect(SkRect::MakeLTRB(0, 0, 56, 56)),
DlCanvas::ClipOp::kIntersect, true);
canvas->Save();
{
canvas->ClipRRect(SkRRect::MakeOval(SkRect::MakeLTRB(0, 0, 56, 56)),
DlCanvas::ClipOp::kIntersect, true);
canvas->DrawCircle(
SkPoint::Make(21.55413055419922, 25.02498245239258),
12.15186500549316, DlPaint().setColor(DlColor(0x6230f46)));
}
canvas->Restore();
canvas->Save();
{
canvas->ClipRRect(SkRRect::MakeOval(SkRect::MakeLTRB(0, 0, 56, 56)),
DlCanvas::ClipOp::kIntersect, true);
canvas->DrawRect(SkRect::MakeLTRB(0, 0, 56, 56),
DlPaint().setColor(DlColor(0x9bcbcbc)));
}
canvas->Restore();
}
canvas->Restore();
//drawTextFrame
}
canvas->Restore();

canvas->Save();
{
canvas->ClipRRect(
SkRRect::MakeOval(SkRect::MakeLTRB(201.25, 10, 361.25, 170)),
DlCanvas::ClipOp::kIntersect, true);
SkRect save_layer_bounds = SkRect::MakeLTRB(201.25, 10, 361.25, 170);
DlMatrixImageFilter backdrop(
SkMatrix::MakeAll(3, 0, -299.25, 0, 3, -949, 0, 0, 1),
DlImageSampling::kLinear);
DlMatrixImageFilter backdrop(SkMatrix::MakeAll(3, 0, -299.25, //
0, 3, -949, //
0, 0, 1),
DlImageSampling::kLinear);
canvas->SaveLayer(&save_layer_bounds, /*paint=*/nullptr, &backdrop);
{
canvas->Translate(201.25, 10);
Expand All @@ -117,14 +85,6 @@ TEST_P(DlGoldenTest, Bug147807) {
.setStrokeWidth(5)
.setDrawStyle(DlDrawStyle::kStroke);
canvas->DrawCircle(SkPoint::Make(80, 80), 80, paint);
paint.setColor(DlColor(0xfff44336));
paint.setStrokeWidth(1.666666626930237);
canvas->DrawRect(SkRect::MakeLTRB(70, 70, 90, 90), paint);
paint.setColor(DlColor(0xff000000));
canvas->DrawLine(SkPoint::Make(75.19999694824219, 80),
SkPoint::Make(84.80000305175781, 80), paint);
canvas->DrawLine(SkPoint::Make(80, 75.19999694824219),
SkPoint::Make(80, 84.80000305175781), paint);
}
canvas->Restore();
}
Expand All @@ -133,7 +93,6 @@ TEST_P(DlGoldenTest, Bug147807) {

DisplayListBuilder builder;
std::vector<sk_sp<DlImage>> images;
images.emplace_back(CreateDlImageForFixture("kalimba.jpg"));
draw(&builder, images);

ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
Expand Down