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

Commit ed8023e

Browse files
authored
Fix runtime stage tests (#37025)
1 parent f7ed46a commit ed8023e

File tree

8 files changed

+18
-37
lines changed

8 files changed

+18
-37
lines changed

impeller/entity/entity_unittests.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2086,7 +2086,7 @@ TEST_P(EntityTest, RuntimeEffect) {
20862086
contents->SetGeometry(Geometry::MakeCover());
20872087

20882088
auto runtime_stage =
2089-
LoadFixtureRuntimeStage("runtime_stage_example.frag.iplr");
2089+
OpenAssetAsRuntimeStage("runtime_stage_example.frag.iplr");
20902090
contents->SetRuntimeStage(runtime_stage);
20912091

20922092
struct FragUniforms {

impeller/playground/playground.cc

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -437,22 +437,6 @@ std::shared_ptr<Texture> Playground::CreateTextureCubeForFixture(
437437
return texture;
438438
}
439439

440-
std::shared_ptr<RuntimeStage> Playground::LoadFixtureRuntimeStage(
441-
const char* fixture_name) const {
442-
if (fixture_name == nullptr) {
443-
return nullptr;
444-
}
445-
446-
auto runtime_stage =
447-
std::make_shared<RuntimeStage>(OpenAssetAsMapping(fixture_name));
448-
449-
if (!runtime_stage->IsValid()) {
450-
VALIDATION_LOG << "Could not load valid runtime stage.";
451-
return nullptr;
452-
}
453-
return runtime_stage;
454-
}
455-
456440
void Playground::SetWindowSize(ISize size) {
457441
window_size_ = size;
458442
}

impeller/playground/playground.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ class Playground {
6464
std::shared_ptr<Texture> CreateTextureCubeForFixture(
6565
std::array<const char*, 6> fixture_names) const;
6666

67-
std::shared_ptr<RuntimeStage> LoadFixtureRuntimeStage(
68-
const char* fixture_name) const;
69-
7067
static bool SupportsBackend(PlaygroundBackend backend);
7168

7269
virtual std::unique_ptr<fml::Mapping> OpenAssetAsMapping(

impeller/playground/playground_test.cc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,19 @@ std::unique_ptr<fml::Mapping> PlaygroundTest::OpenAssetAsMapping(
3434
return flutter::testing::OpenFixtureAsMapping(asset_name);
3535
}
3636

37+
std::shared_ptr<RuntimeStage> PlaygroundTest::OpenAssetAsRuntimeStage(
38+
const char* asset_name) const {
39+
auto fixture = flutter::testing::OpenFixtureAsMapping(asset_name);
40+
if (!fixture || fixture->GetSize() == 0) {
41+
return nullptr;
42+
}
43+
auto stage = std::make_unique<RuntimeStage>(std::move(fixture));
44+
if (!stage->IsValid()) {
45+
return nullptr;
46+
}
47+
return stage;
48+
}
49+
3750
static std::string FormatWindowTitle(const std::string& test_name) {
3851
std::stringstream stream;
3952
stream << "Impeller Playground for '" << test_name

impeller/playground/playground_test.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ class PlaygroundTest : public Playground,
2727
std::unique_ptr<fml::Mapping> OpenAssetAsMapping(
2828
std::string asset_name) const override;
2929

30+
std::shared_ptr<RuntimeStage> OpenAssetAsRuntimeStage(
31+
const char* asset_name) const;
32+
3033
// |Playground|
3134
std::string GetWindowTitle() const override;
3235

impeller/runtime_stage/runtime_stage_playground.cc

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,6 @@ RuntimeStagePlayground::RuntimeStagePlayground() = default;
1717

1818
RuntimeStagePlayground::~RuntimeStagePlayground() = default;
1919

20-
std::unique_ptr<RuntimeStage> RuntimeStagePlayground::CreateStageFromFixture(
21-
const std::string& fixture_name) const {
22-
auto fixture = flutter::testing::OpenFixtureAsMapping(fixture_name);
23-
if (!fixture || fixture->GetSize() == 0) {
24-
return nullptr;
25-
}
26-
auto stage = std::make_unique<RuntimeStage>(std::move(fixture));
27-
if (!stage->IsValid()) {
28-
return nullptr;
29-
}
30-
return stage;
31-
}
32-
3320
bool RuntimeStagePlayground::RegisterStage(const RuntimeStage& stage) {
3421
std::promise<bool> registration;
3522
auto future = registration.get_future();

impeller/runtime_stage/runtime_stage_playground.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ class RuntimeStagePlayground : public PlaygroundTest {
1616

1717
~RuntimeStagePlayground();
1818

19-
std::unique_ptr<RuntimeStage> CreateStageFromFixture(
20-
const std::string& fixture_name) const;
21-
2219
bool RegisterStage(const RuntimeStage& stage);
2320

2421
private:

impeller/runtime_stage/runtime_stage_unittests.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ TEST_P(RuntimeStageTest, CanCreatePipelineFromRuntimeStage) {
216216
if (GetParam() != PlaygroundBackend::kMetal) {
217217
GTEST_SKIP_("Skipped: https://github.com/flutter/flutter/issues/105538");
218218
}
219-
auto stage = CreateStageFromFixture("ink_sparkle.frag.iplr");
219+
auto stage = OpenAssetAsRuntimeStage("ink_sparkle.frag.iplr");
220220
ASSERT_NE(stage, nullptr);
221221
ASSERT_TRUE(RegisterStage(*stage));
222222
auto library = GetContext()->GetShaderLibrary();

0 commit comments

Comments
 (0)