Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DisplayList] Fix assertions on DisplayList verbose comparison tests #54065

Merged
Merged
Show file tree
Hide file tree
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
48 changes: 32 additions & 16 deletions display_list/display_list_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -676,12 676,12 @@ TEST_F(DisplayListTest, SingleOpDisplayListsRecapturedAreEqual) {
sk_sp<DisplayList> copy = copy_builder.Build();
auto desc =
group.op_name "(variant " std::to_string(i 1) " == copy)";
DisplayListsEQ_Verbose(dl, copy);
ASSERT_TRUE(DisplayListsEQ_Verbose(dl, copy));
ASSERT_EQ(copy->op_count(false), dl->op_count(false)) << desc;
ASSERT_EQ(copy->bytes(false), dl->bytes(false)) << desc;
ASSERT_EQ(copy->op_count(true), dl->op_count(true)) << desc;
ASSERT_EQ(copy->bytes(true), dl->bytes(true)) << desc;
EXPECT_EQ(copy->total_depth(), dl->total_depth()) << desc;
ASSERT_EQ(copy->total_depth(), dl->total_depth()) << desc;
ASSERT_EQ(copy->bounds(), dl->bounds()) << desc;
ASSERT_TRUE(copy->Equals(*dl)) << desc;
ASSERT_TRUE(dl->Equals(*copy)) << desc;
Expand Down Expand Up @@ -4955,7 4955,7 @@ TEST_F(DisplayListTest, DrawRectRRectPromoteToDrawRect) {
expected.DrawRect(rect, DlPaint());
auto expect_dl = expected.Build();

DisplayListsEQ_Verbose(dl, expect_dl);
ASSERT_TRUE(DisplayListsEQ_Verbose(dl, expect_dl));
}

TEST_F(DisplayListTest, DrawOvalRRectPromoteToDrawOval) {
Expand All @@ -4969,7 4969,7 @@ TEST_F(DisplayListTest, DrawOvalRRectPromoteToDrawOval) {
expected.DrawOval(rect, DlPaint());
auto expect_dl = expected.Build();

DisplayListsEQ_Verbose(dl, expect_dl);
ASSERT_TRUE(DisplayListsEQ_Verbose(dl, expect_dl));
}

TEST_F(DisplayListTest, DrawRectPathPromoteToDrawRect) {
Expand All @@ -4983,7 4983,9 @@ TEST_F(DisplayListTest, DrawRectPathPromoteToDrawRect) {
expected.DrawRect(rect, DlPaint());
auto expect_dl = expected.Build();

DisplayListsEQ_Verbose(dl, expect_dl);
// Support for this will be re-added soon, until then verify that we
// do not promote.
ASSERT_TRUE(DisplayListsNE_Verbose(dl, expect_dl));
}

TEST_F(DisplayListTest, DrawOvalPathPromoteToDrawOval) {
Expand All @@ -4997,7 4999,9 @@ TEST_F(DisplayListTest, DrawOvalPathPromoteToDrawOval) {
expected.DrawOval(rect, DlPaint());
auto expect_dl = expected.Build();

DisplayListsEQ_Verbose(dl, expect_dl);
// Support for this will be re-added soon, until then verify that we
// do not promote.
ASSERT_TRUE(DisplayListsNE_Verbose(dl, expect_dl));
}

TEST_F(DisplayListTest, DrawRRectPathPromoteToDrawRRect) {
Expand All @@ -5012,7 5016,9 @@ TEST_F(DisplayListTest, DrawRRectPathPromoteToDrawRRect) {
expected.DrawRRect(rrect, DlPaint());
auto expect_dl = expected.Build();

DisplayListsEQ_Verbose(dl, expect_dl);
// Support for this will be re-added soon, until then verify that we
// do not promote.
ASSERT_TRUE(DisplayListsNE_Verbose(dl, expect_dl));
}

TEST_F(DisplayListTest, DrawRectRRectPathPromoteToDrawRect) {
Expand All @@ -5027,7 5033,9 @@ TEST_F(DisplayListTest, DrawRectRRectPathPromoteToDrawRect) {
expected.DrawRect(rect, DlPaint());
auto expect_dl = expected.Build();

DisplayListsEQ_Verbose(dl, expect_dl);
// Support for this will be re-added soon, until then verify that we
// do not promote.
ASSERT_TRUE(DisplayListsNE_Verbose(dl, expect_dl));
}

TEST_F(DisplayListTest, DrawOvalRRectPathPromoteToDrawOval) {
Expand All @@ -5042,7 5050,9 @@ TEST_F(DisplayListTest, DrawOvalRRectPathPromoteToDrawOval) {
expected.DrawOval(rect, DlPaint());
auto expect_dl = expected.Build();

DisplayListsEQ_Verbose(dl, expect_dl);
// Support for this will be re-added soon, until then verify that we
// do not promote.
ASSERT_TRUE(DisplayListsNE_Verbose(dl, expect_dl));
}

TEST_F(DisplayListTest, ClipRectRRectPromoteToClipRect) {
Expand All @@ -5060,7 5070,7 @@ TEST_F(DisplayListTest, ClipRectRRectPromoteToClipRect) {
expected.DrawRect(draw_rect, DlPaint());
auto expect_dl = expected.Build();

DisplayListsEQ_Verbose(dl, expect_dl);
ASSERT_TRUE(DisplayListsEQ_Verbose(dl, expect_dl));
}

TEST_F(DisplayListTest, ClipOvalRRectPromoteToClipOval) {
Expand All @@ -5078,7 5088,9 @@ TEST_F(DisplayListTest, ClipOvalRRectPromoteToClipOval) {
expected.DrawRect(draw_rect, DlPaint());
auto expect_dl = expected.Build();

DisplayListsEQ_Verbose(dl, expect_dl);
// Support for this will be re-added soon, until then verify that we
// do not promote.
ASSERT_TRUE(DisplayListsNE_Verbose(dl, expect_dl));
}

TEST_F(DisplayListTest, ClipRectPathPromoteToClipRect) {
Expand All @@ -5099,7 5111,7 @@ TEST_F(DisplayListTest, ClipRectPathPromoteToClipRect) {
expected.DrawRect(draw_rect, DlPaint());
auto expect_dl = expected.Build();

DisplayListsEQ_Verbose(dl, expect_dl);
ASSERT_TRUE(DisplayListsEQ_Verbose(dl, expect_dl));
}

TEST_F(DisplayListTest, ClipOvalPathPromoteToClipOval) {
Expand All @@ -5120,7 5132,9 @@ TEST_F(DisplayListTest, ClipOvalPathPromoteToClipOval) {
expected.DrawRect(draw_rect, DlPaint());
auto expect_dl = expected.Build();

DisplayListsEQ_Verbose(dl, expect_dl);
// Support for this will be re-added soon, until then verify that we
// do not promote.
ASSERT_TRUE(DisplayListsNE_Verbose(dl, expect_dl));
}

TEST_F(DisplayListTest, ClipRRectPathPromoteToClipRRect) {
Expand All @@ -5142,7 5156,7 @@ TEST_F(DisplayListTest, ClipRRectPathPromoteToClipRRect) {
expected.DrawRect(draw_rect, DlPaint());
auto expect_dl = expected.Build();

DisplayListsEQ_Verbose(dl, expect_dl);
ASSERT_TRUE(DisplayListsEQ_Verbose(dl, expect_dl));
}

TEST_F(DisplayListTest, ClipRectInversePathNoPromoteToClipRect) {
Expand Down Expand Up @@ -5237,7 5251,7 @@ TEST_F(DisplayListTest, ClipRectRRectPathPromoteToClipRect) {
expected.DrawRect(draw_rect, DlPaint());
auto expect_dl = expected.Build();

DisplayListsEQ_Verbose(dl, expect_dl);
ASSERT_TRUE(DisplayListsEQ_Verbose(dl, expect_dl));
}

TEST_F(DisplayListTest, ClipOvalRRectPathPromoteToClipOval) {
Expand All @@ -5259,7 5273,9 @@ TEST_F(DisplayListTest, ClipOvalRRectPathPromoteToClipOval) {
expected.DrawRect(draw_rect, DlPaint());
auto expect_dl = expected.Build();

DisplayListsEQ_Verbose(dl, expect_dl);
// Support for this will be re-added soon, until then verify that we
// do not promote.
ASSERT_TRUE(DisplayListsNE_Verbose(dl, expect_dl));
}

TEST_F(DisplayListTest, BoundedRenderOpsDoNotReportUnbounded) {
Expand Down
22 changes: 14 additions & 8 deletions testing/display_list_testing.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 13,26 @@
namespace flutter {
namespace testing {

bool DisplayListsEQ_Verbose(const DisplayList* a, const DisplayList* b);
bool inline DisplayListsEQ_Verbose(const DisplayList& a, const DisplayList& b) {
[[nodiscard]] bool DisplayListsEQ_Verbose(const DisplayList* a,
const DisplayList* b);
[[nodiscard]] bool inline DisplayListsEQ_Verbose(const DisplayList& a,
const DisplayList& b) {
return DisplayListsEQ_Verbose(&a, &b);
}
bool inline DisplayListsEQ_Verbose(const sk_sp<const DisplayList>& a,
const sk_sp<const DisplayList>& b) {
[[nodiscard]] bool inline DisplayListsEQ_Verbose(
const sk_sp<const DisplayList>& a,
const sk_sp<const DisplayList>& b) {
return DisplayListsEQ_Verbose(a.get(), b.get());
}
bool DisplayListsNE_Verbose(const DisplayList* a, const DisplayList* b);
bool inline DisplayListsNE_Verbose(const DisplayList& a, const DisplayList& b) {
[[nodiscard]] bool DisplayListsNE_Verbose(const DisplayList* a,
const DisplayList* b);
[[nodiscard]] bool inline DisplayListsNE_Verbose(const DisplayList& a,
const DisplayList& b) {
return DisplayListsNE_Verbose(&a, &b);
}
bool inline DisplayListsNE_Verbose(const sk_sp<const DisplayList>& a,
const sk_sp<const DisplayList>& b) {
[[nodiscard]] bool inline DisplayListsNE_Verbose(
const sk_sp<const DisplayList>& a,
const sk_sp<const DisplayList>& b) {
return DisplayListsNE_Verbose(a.get(), b.get());
}

Expand Down