Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit a6baa50

Browse files
committed
add unit test.
1 parent bde0285 commit a6baa50

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

impeller/aiks/aiks_unittests.cc

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ TEST_P(AiksTest, CanRenderColorFilterWithInvertColorsDrawPaint) {
164164
namespace {
165165
bool GenerateMipmap(const std::shared_ptr<Context>& context,
166166
std::shared_ptr<Texture> texture,
167-
std::string label) {
167+
std::string label,
168+
bool async_submit) {
168169
auto buffer = context->CreateCommandBuffer();
169170
if (!buffer) {
170171
return false;
@@ -174,18 +175,23 @@ bool GenerateMipmap(const std::shared_ptr<Context>& context,
174175
return false;
175176
}
176177
pass->GenerateMipmap(std::move(texture), std::move(label));
178+
if (async_submit) {
179+
return buffer->SubmitCommandsAsync(pass, context->GetResourceAllocator());
180+
}
181+
177182
pass->EncodeCommands(context->GetResourceAllocator());
178183
return buffer->SubmitCommands();
179184
}
180185

181186
void CanRenderTiledTexture(AiksTest* aiks_test,
182187
Entity::TileMode tile_mode,
188+
bool async_submit = false,
183189
Matrix local_matrix = {}) {
184190
auto context = aiks_test->GetContext();
185191
ASSERT_TRUE(context);
186192
auto texture = aiks_test->CreateTextureForFixture("table_mountain_nx.png",
187193
/*enable_mipmapping=*/true);
188-
GenerateMipmap(context, texture, "table_mountain_nx");
194+
GenerateMipmap(context, texture, "table_mountain_nx", async_submit);
189195
Canvas canvas;
190196
canvas.Scale(aiks_test->GetContentScale());
191197
canvas.Translate({100.0f, 100.0f, 0});
@@ -232,6 +238,10 @@ TEST_P(AiksTest, CanRenderTiledTextureClamp) {
232238
CanRenderTiledTexture(this, Entity::TileMode::kClamp);
233239
}
234240

241+
TEST_P(AiksTest, CanRenderTiledTextureClampAsync) {
242+
CanRenderTiledTexture(this, Entity::TileMode::kClamp, /*async_submit=*/true);
243+
}
244+
235245
TEST_P(AiksTest, CanRenderTiledTextureRepeat) {
236246
CanRenderTiledTexture(this, Entity::TileMode::kRepeat);
237247
}
@@ -245,7 +255,7 @@ TEST_P(AiksTest, CanRenderTiledTextureDecal) {
245255
}
246256

247257
TEST_P(AiksTest, CanRenderTiledTextureClampWithTranslate) {
248-
CanRenderTiledTexture(this, Entity::TileMode::kClamp,
258+
CanRenderTiledTexture(this, Entity::TileMode::kClamp, /*async_submit=*/false,
249259
Matrix::MakeTranslation({172.f, 172.f, 0.f}));
250260
}
251261

0 commit comments

Comments
 (0)