Route export storage hooks through platform services

This commit is contained in:
2026-06-04 16:34:19 +02:00
parent 3c709f07e6
commit 6419645e03
12 changed files with 86 additions and 23 deletions

View File

@@ -123,6 +123,17 @@ public:
cleared_recording_path.assign(recording_path);
}
void publish_exported_image(std::string_view path) override
{
++exported_image_publishes;
exported_image_path.assign(path);
}
void flush_persistent_storage() override
{
++persistent_storage_flushes;
}
[[nodiscard]] bool enables_live_asset_reloading() override
{
++live_asset_reload_policy_checks;
@@ -215,6 +226,8 @@ public:
int crash_tests = 0;
int recording_delete_policy_checks = 0;
int recording_clears = 0;
int exported_image_publishes = 0;
int persistent_storage_flushes = 0;
int live_asset_reload_policy_checks = 0;
int platform_frame_updates = 0;
int frame_reports = 0;
@@ -238,6 +251,7 @@ public:
std::string prepared_file_path;
std::string prepared_file_name;
std::string cleared_recording_path;
std::string exported_image_path;
std::string picker_path = "D:/Paint/import.png";
std::string save_path = "D:/Paint/export.ppi";
std::string directory_path = "D:/Paint";
@@ -377,6 +391,19 @@ void platform_services_dispatch_recording_cleanup(pp::tests::Harness& harness)
PP_EXPECT(harness, fake.cleared_recording_path == "D:/Paint/frames");
}
void platform_services_dispatch_exported_image_and_storage_flush(pp::tests::Harness& harness)
{
FakePlatformServices fake("unused");
pp::platform::PlatformServices& services = fake;
services.publish_exported_image("D:/Paint/export.png");
services.flush_persistent_storage();
PP_EXPECT(harness, fake.exported_image_publishes == 1);
PP_EXPECT(harness, fake.exported_image_path == "D:/Paint/export.png");
PP_EXPECT(harness, fake.persistent_storage_flushes == 1);
}
void platform_services_dispatch_live_asset_reload_policy(pp::tests::Harness& harness)
{
FakePlatformServices fake("unused");
@@ -481,6 +508,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 exported image and storage flush", platform_services_dispatch_exported_image_and_storage_flush);
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);