Route startup storage paths through platform services
This commit is contained in:
@@ -15,6 +15,12 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
[[nodiscard]] pp::platform::PlatformStoragePaths prepare_storage_paths() override
|
||||
{
|
||||
++storage_prepares;
|
||||
return storage_paths;
|
||||
}
|
||||
|
||||
[[nodiscard]] std::string clipboard_text() override
|
||||
{
|
||||
++clipboard_reads;
|
||||
@@ -152,6 +158,7 @@ public:
|
||||
int render_context_presents = 0;
|
||||
int render_capture_begins = 0;
|
||||
int render_capture_ends = 0;
|
||||
int storage_prepares = 0;
|
||||
int platform_frame_updates = 0;
|
||||
int frame_reports = 0;
|
||||
int display_file_requests = 0;
|
||||
@@ -174,6 +181,12 @@ public:
|
||||
std::string picker_path = "D:/Paint/import.png";
|
||||
std::string save_path = "D:/Paint/export.ppi";
|
||||
std::string directory_path = "D:/Paint";
|
||||
pp::platform::PlatformStoragePaths storage_paths{
|
||||
"D:/Paint",
|
||||
"D:/Paint/work",
|
||||
"D:/Paint/frames",
|
||||
"D:/Paint/tmp",
|
||||
};
|
||||
std::vector<std::string> picked_file_types;
|
||||
std::vector<std::string> save_file_types;
|
||||
|
||||
@@ -193,6 +206,20 @@ void platform_services_dispatch_clipboard_reads_and_writes(pp::tests::Harness& h
|
||||
PP_EXPECT(harness, fake.clipboard_writes == 1);
|
||||
}
|
||||
|
||||
void platform_services_dispatch_storage_path_preparation(pp::tests::Harness& harness)
|
||||
{
|
||||
FakePlatformServices fake("unused");
|
||||
pp::platform::PlatformServices& services = fake;
|
||||
|
||||
const auto paths = services.prepare_storage_paths();
|
||||
|
||||
PP_EXPECT(harness, fake.storage_prepares == 1);
|
||||
PP_EXPECT(harness, paths.data_path == "D:/Paint");
|
||||
PP_EXPECT(harness, paths.work_path == "D:/Paint/work");
|
||||
PP_EXPECT(harness, paths.recording_path == "D:/Paint/frames");
|
||||
PP_EXPECT(harness, paths.temporary_path == "D:/Paint/tmp");
|
||||
}
|
||||
|
||||
void platform_services_preserve_empty_clipboard_writes(pp::tests::Harness& harness)
|
||||
{
|
||||
FakePlatformServices fake("initial");
|
||||
@@ -340,6 +367,7 @@ void platform_services_dispatch_prepared_file_save(pp::tests::Harness& harness)
|
||||
int main()
|
||||
{
|
||||
pp::tests::Harness harness;
|
||||
harness.run("platform services dispatch storage path preparation", platform_services_dispatch_storage_path_preparation);
|
||||
harness.run("platform services dispatch clipboard reads and writes", platform_services_dispatch_clipboard_reads_and_writes);
|
||||
harness.run("platform services preserve empty clipboard writes", platform_services_preserve_empty_clipboard_writes);
|
||||
harness.run("platform services dispatch visibility updates", platform_services_dispatch_visibility_updates);
|
||||
|
||||
Reference in New Issue
Block a user