Route document browse roots through platform services

This commit is contained in:
2026-06-04 16:41:56 +02:00
parent 6419645e03
commit 7d992931d9
10 changed files with 74 additions and 8 deletions

View File

@@ -134,6 +134,16 @@ public:
++persistent_storage_flushes;
}
[[nodiscard]] std::vector<std::string> document_browse_roots(
std::string_view work_path,
std::string_view data_path) override
{
++document_browse_root_requests;
browse_work_path.assign(work_path);
browse_data_path.assign(data_path);
return browse_roots;
}
[[nodiscard]] bool enables_live_asset_reloading() override
{
++live_asset_reload_policy_checks;
@@ -228,6 +238,7 @@ public:
int recording_clears = 0;
int exported_image_publishes = 0;
int persistent_storage_flushes = 0;
int document_browse_root_requests = 0;
int live_asset_reload_policy_checks = 0;
int platform_frame_updates = 0;
int frame_reports = 0;
@@ -252,6 +263,8 @@ public:
std::string prepared_file_name;
std::string cleared_recording_path;
std::string exported_image_path;
std::string browse_work_path;
std::string browse_data_path;
std::string picker_path = "D:/Paint/import.png";
std::string save_path = "D:/Paint/export.ppi";
std::string directory_path = "D:/Paint";
@@ -263,6 +276,10 @@ public:
};
std::vector<std::string> picked_file_types;
std::vector<std::string> save_file_types;
std::vector<std::string> browse_roots = {
"D:/Paint/work",
"D:/Paint/Inbox",
};
private:
std::string clipboard_value_;
@@ -404,6 +421,21 @@ void platform_services_dispatch_exported_image_and_storage_flush(pp::tests::Harn
PP_EXPECT(harness, fake.persistent_storage_flushes == 1);
}
void platform_services_dispatch_document_browse_roots(pp::tests::Harness& harness)
{
FakePlatformServices fake("unused");
pp::platform::PlatformServices& services = fake;
const auto roots = services.document_browse_roots("D:/Paint/work", "D:/Paint");
PP_EXPECT(harness, fake.document_browse_root_requests == 1);
PP_EXPECT(harness, fake.browse_work_path == "D:/Paint/work");
PP_EXPECT(harness, fake.browse_data_path == "D:/Paint");
PP_EXPECT(harness, roots.size() == 2);
PP_EXPECT(harness, roots[0] == "D:/Paint/work");
PP_EXPECT(harness, roots[1] == "D:/Paint/Inbox");
}
void platform_services_dispatch_live_asset_reload_policy(pp::tests::Harness& harness)
{
FakePlatformServices fake("unused");
@@ -509,6 +541,7 @@ int main()
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 document browse roots", platform_services_dispatch_document_browse_roots);
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);