Route live reload policy through platform services

This commit is contained in:
2026-06-03 05:08:00 +02:00
parent ac4d065c78
commit e152616d7f
10 changed files with 66 additions and 18 deletions

View File

@@ -93,6 +93,12 @@ public:
cleared_recording_path.assign(recording_path);
}
[[nodiscard]] bool enables_live_asset_reloading() override
{
++live_asset_reload_policy_checks;
return live_asset_reloading;
}
void update_platform_frame(float delta_time_seconds) override
{
++platform_frame_updates;
@@ -173,6 +179,7 @@ public:
int storage_prepares = 0;
int recording_delete_policy_checks = 0;
int recording_clears = 0;
int live_asset_reload_policy_checks = 0;
int platform_frame_updates = 0;
int frame_reports = 0;
int display_file_requests = 0;
@@ -187,6 +194,7 @@ public:
bool keyboard_visible = false;
bool prepared_file_saved = true;
bool deletes_recorded_files = true;
bool live_asset_reloading = true;
float last_platform_delta = 0.0f;
int last_frame_report = 0;
std::string displayed_path;
@@ -313,6 +321,18 @@ void platform_services_dispatch_recording_cleanup(pp::tests::Harness& harness)
PP_EXPECT(harness, fake.cleared_recording_path == "D:/Paint/frames");
}
void platform_services_dispatch_live_asset_reload_policy(pp::tests::Harness& harness)
{
FakePlatformServices fake("unused");
pp::platform::PlatformServices& services = fake;
PP_EXPECT(harness, services.enables_live_asset_reloading());
fake.live_asset_reloading = false;
PP_EXPECT(harness, !services.enables_live_asset_reloading());
PP_EXPECT(harness, fake.live_asset_reload_policy_checks == 2);
}
void platform_services_dispatch_frame_hooks(pp::tests::Harness& harness)
{
FakePlatformServices fake("unused");
@@ -404,6 +424,7 @@ int main()
harness.run("platform services dispatch render context lifecycle", platform_services_dispatch_render_context_lifecycle);
harness.run("platform services dispatch render capture hooks", platform_services_dispatch_render_capture_hooks);
harness.run("platform services dispatch recording cleanup", platform_services_dispatch_recording_cleanup);
harness.run("platform services dispatch live asset reload policy", platform_services_dispatch_live_asset_reload_policy);
harness.run("platform services dispatch frame hooks", platform_services_dispatch_frame_hooks);
harness.run("platform services dispatch file actions", platform_services_dispatch_file_actions);
harness.run("platform services dispatch picker callbacks", platform_services_dispatch_picker_callbacks);