Centralize legacy video export bridge
This commit is contained in:
@@ -110,6 +110,45 @@ public:
|
||||
std::string call_order;
|
||||
};
|
||||
|
||||
class FakeDocumentVideoExportServices final : public pp::app::DocumentVideoExportServices {
|
||||
public:
|
||||
void export_animation_mp4(std::string_view path) override
|
||||
{
|
||||
animation_exports += 1;
|
||||
last_path = std::string(path);
|
||||
call_order += "animation-export;";
|
||||
}
|
||||
|
||||
void export_timelapse_mp4(std::string_view path) override
|
||||
{
|
||||
timelapse_exports += 1;
|
||||
last_path = std::string(path);
|
||||
call_order += "timelapse-export;";
|
||||
}
|
||||
|
||||
void show_animation_export_success(std::string_view path) override
|
||||
{
|
||||
animation_messages += 1;
|
||||
last_message_path = std::string(path);
|
||||
call_order += "animation-message;";
|
||||
}
|
||||
|
||||
void show_timelapse_export_success(std::string_view path) override
|
||||
{
|
||||
timelapse_messages += 1;
|
||||
last_message_path = std::string(path);
|
||||
call_order += "timelapse-message;";
|
||||
}
|
||||
|
||||
int animation_exports = 0;
|
||||
int timelapse_exports = 0;
|
||||
int animation_messages = 0;
|
||||
int timelapse_messages = 0;
|
||||
std::string last_path;
|
||||
std::string last_message_path;
|
||||
std::string call_order;
|
||||
};
|
||||
|
||||
void equirectangular_export_builds_file_target(pp::tests::Harness& harness)
|
||||
{
|
||||
const auto target = pp::app::make_document_export_file_target("D:/Paint", "demo", ".png");
|
||||
@@ -431,6 +470,51 @@ void export_executor_rejects_malformed_targets(pp::tests::Harness& harness)
|
||||
PP_EXPECT(harness, services.call_order.empty());
|
||||
}
|
||||
|
||||
void video_export_executor_dispatches_animation_and_timelapse(pp::tests::Harness& harness)
|
||||
{
|
||||
FakeDocumentVideoExportServices services;
|
||||
|
||||
PP_EXPECT(
|
||||
harness,
|
||||
pp::app::execute_document_video_export(
|
||||
pp::app::DocumentVideoExportKind::animation_mp4,
|
||||
"D:/Paint/animation.mp4",
|
||||
services)
|
||||
.ok());
|
||||
PP_EXPECT(
|
||||
harness,
|
||||
pp::app::execute_document_video_export(
|
||||
pp::app::DocumentVideoExportKind::timelapse,
|
||||
"D:/Paint/timelapse.mp4",
|
||||
services)
|
||||
.ok());
|
||||
|
||||
PP_EXPECT(harness, services.animation_exports == 1);
|
||||
PP_EXPECT(harness, services.timelapse_exports == 1);
|
||||
PP_EXPECT(harness, services.animation_messages == 1);
|
||||
PP_EXPECT(harness, services.timelapse_messages == 1);
|
||||
PP_EXPECT(harness, services.last_path == "D:/Paint/timelapse.mp4");
|
||||
PP_EXPECT(harness, services.last_message_path == "D:/Paint/timelapse.mp4");
|
||||
PP_EXPECT(
|
||||
harness,
|
||||
services.call_order
|
||||
== "animation-export;animation-message;timelapse-export;timelapse-message;");
|
||||
}
|
||||
|
||||
void video_export_executor_rejects_empty_paths(pp::tests::Harness& harness)
|
||||
{
|
||||
FakeDocumentVideoExportServices services;
|
||||
|
||||
PP_EXPECT(
|
||||
harness,
|
||||
!pp::app::execute_document_video_export(
|
||||
pp::app::DocumentVideoExportKind::animation_mp4,
|
||||
"",
|
||||
services)
|
||||
.ok());
|
||||
PP_EXPECT(harness, services.call_order.empty());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int main()
|
||||
@@ -454,5 +538,7 @@ int main()
|
||||
export_executor_dispatches_file_stem_collection_and_named_exports);
|
||||
harness.run("export executor preserves failed directory creation", export_executor_preserves_failed_directory_creation);
|
||||
harness.run("export executor rejects malformed targets", export_executor_rejects_malformed_targets);
|
||||
harness.run("video export executor dispatches animation and timelapse", video_export_executor_dispatches_animation_and_timelapse);
|
||||
harness.run("video export executor rejects empty paths", video_export_executor_rejects_empty_paths);
|
||||
return harness.finish();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user