Route collection export targets through platform policy
This commit is contained in:
@@ -192,6 +192,32 @@ void video_export_builds_suggested_name(pp::tests::Harness& harness)
|
||||
PP_EXPECT(harness, animation.value().name == "demo-animation");
|
||||
}
|
||||
|
||||
void collection_export_target_plan_selects_platform_destination(pp::tests::Harness& harness)
|
||||
{
|
||||
const auto layer_collection = pp::app::plan_document_export_collection_target(
|
||||
pp::app::DocumentExportCollectionKind::layers,
|
||||
true);
|
||||
const auto frame_collection = pp::app::plan_document_export_collection_target(
|
||||
pp::app::DocumentExportCollectionKind::animation_frames,
|
||||
true);
|
||||
const auto picked_layers = pp::app::plan_document_export_collection_target(
|
||||
pp::app::DocumentExportCollectionKind::layers,
|
||||
false);
|
||||
|
||||
PP_EXPECT(
|
||||
harness,
|
||||
layer_collection.destination == pp::app::DocumentExportCollectionDestination::work_directory_collection);
|
||||
PP_EXPECT(
|
||||
harness,
|
||||
frame_collection.destination == pp::app::DocumentExportCollectionDestination::work_directory_collection);
|
||||
PP_EXPECT(
|
||||
harness,
|
||||
picked_layers.destination == pp::app::DocumentExportCollectionDestination::picked_directory_stem);
|
||||
PP_EXPECT(harness, layer_collection.suffix == "_layers");
|
||||
PP_EXPECT(harness, frame_collection.suffix == "_frames");
|
||||
PP_EXPECT(harness, picked_layers.suffix == "_layers");
|
||||
}
|
||||
|
||||
void export_start_allows_valid_canvas_state(pp::tests::Harness& harness)
|
||||
{
|
||||
PP_EXPECT(
|
||||
@@ -525,6 +551,7 @@ int main()
|
||||
harness.run("collection export builds directory and stem", collection_export_builds_directory_and_stem);
|
||||
harness.run("picked directory export builds stem", picked_directory_export_builds_stem);
|
||||
harness.run("video export builds suggested name", video_export_builds_suggested_name);
|
||||
harness.run("collection export target plan selects platform destination", collection_export_target_plan_selects_platform_destination);
|
||||
harness.run("export start allows valid canvas state", export_start_allows_valid_canvas_state);
|
||||
harness.run("export start blocks demo only when license required", export_start_blocks_demo_only_when_license_required);
|
||||
harness.run("export start reports missing canvas after license gate", export_start_reports_missing_canvas_after_license_gate);
|
||||
|
||||
@@ -216,6 +216,12 @@ public:
|
||||
return prepared_file_writes;
|
||||
}
|
||||
|
||||
[[nodiscard]] bool uses_work_directory_document_export_collections() override
|
||||
{
|
||||
++document_export_collection_policy_checks;
|
||||
return work_directory_document_export_collections;
|
||||
}
|
||||
|
||||
[[nodiscard]] pp::platform::PreparedFileTarget prepare_writable_file(
|
||||
std::string_view type,
|
||||
std::string_view default_name,
|
||||
@@ -276,12 +282,14 @@ public:
|
||||
int pick_save_file_requests = 0;
|
||||
int pick_directory_requests = 0;
|
||||
int prepared_file_write_policy_checks = 0;
|
||||
int document_export_collection_policy_checks = 0;
|
||||
int prepare_writable_file_requests = 0;
|
||||
int save_prepared_file_requests = 0;
|
||||
bool cursor_visible = false;
|
||||
bool keyboard_visible = false;
|
||||
bool prepared_file_saved = true;
|
||||
bool prepared_file_writes = true;
|
||||
bool work_directory_document_export_collections = false;
|
||||
bool deletes_recorded_files = true;
|
||||
bool live_asset_reloading = true;
|
||||
float last_platform_delta = 0.0f;
|
||||
@@ -597,6 +605,17 @@ void platform_services_dispatch_writable_file_target(pp::tests::Harness& harness
|
||||
PP_EXPECT(harness, target.write_on_background_thread);
|
||||
}
|
||||
|
||||
void platform_services_dispatch_document_export_collection_policy(pp::tests::Harness& harness)
|
||||
{
|
||||
FakePlatformServices fake("unused");
|
||||
pp::platform::PlatformServices& services = fake;
|
||||
|
||||
PP_EXPECT(harness, !services.uses_work_directory_document_export_collections());
|
||||
fake.work_directory_document_export_collections = true;
|
||||
PP_EXPECT(harness, services.uses_work_directory_document_export_collections());
|
||||
PP_EXPECT(harness, fake.document_export_collection_policy_checks == 2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int main()
|
||||
@@ -620,5 +639,8 @@ int main()
|
||||
harness.run("platform services dispatch picker callbacks", platform_services_dispatch_picker_callbacks);
|
||||
harness.run("platform services dispatch prepared file save", platform_services_dispatch_prepared_file_save);
|
||||
harness.run("platform services dispatch writable file target", platform_services_dispatch_writable_file_target);
|
||||
harness.run(
|
||||
"platform services dispatch document export collection policy",
|
||||
platform_services_dispatch_document_export_collection_policy);
|
||||
return harness.finish();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user