Plan app export targets in app core
This commit is contained in:
@@ -268,6 +268,16 @@ add_test(NAME pp_app_core_document_route_tests COMMAND pp_app_core_document_rout
|
||||
set_tests_properties(pp_app_core_document_route_tests PROPERTIES
|
||||
LABELS "app;desktop-fast;fuzz")
|
||||
|
||||
add_executable(pp_app_core_document_export_tests
|
||||
app_core/document_export_tests.cpp)
|
||||
target_link_libraries(pp_app_core_document_export_tests PRIVATE
|
||||
pp_app_core
|
||||
pp_test_harness)
|
||||
|
||||
add_test(NAME pp_app_core_document_export_tests COMMAND pp_app_core_document_export_tests)
|
||||
set_tests_properties(pp_app_core_document_export_tests PROPERTIES
|
||||
LABELS "app;desktop-fast;fuzz")
|
||||
|
||||
add_executable(pp_app_core_document_session_tests
|
||||
app_core/document_session_tests.cpp)
|
||||
target_link_libraries(pp_app_core_document_session_tests PRIVATE
|
||||
@@ -383,6 +393,24 @@ if(TARGET pano_cli)
|
||||
LABELS "app;integration;desktop-fast"
|
||||
PASS_REGULAR_EXPRESSION "\"command\":\"plan-document-file\".*\"path\":\"D:/Paint/demo.ppi\".*\"exists\":true.*\"decision\":\"prompt-overwrite\"")
|
||||
|
||||
add_test(NAME pano_cli_plan_export_target_file_smoke
|
||||
COMMAND pano_cli plan-export-target --kind file --work-dir D:/Paint --doc-name demo --extension .png)
|
||||
set_tests_properties(pano_cli_plan_export_target_file_smoke PROPERTIES
|
||||
LABELS "app;integration;desktop-fast"
|
||||
PASS_REGULAR_EXPRESSION "\"command\":\"plan-export-target\".*\"kind\":\"file\".*\"path\":\"D:/Paint/demo.png\".*\"suggestedName\":\"demo.png\"")
|
||||
|
||||
add_test(NAME pano_cli_plan_export_target_collection_smoke
|
||||
COMMAND pano_cli plan-export-target --kind collection --work-dir D:/Paint --doc-name demo --suffix _layers)
|
||||
set_tests_properties(pano_cli_plan_export_target_collection_smoke PROPERTIES
|
||||
LABELS "app;integration;desktop-fast"
|
||||
PASS_REGULAR_EXPRESSION "\"command\":\"plan-export-target\".*\"kind\":\"collection\".*\"directory\":\"D:/Paint/demo_layers\".*\"stemPath\":\"D:/Paint/demo_layers/demo\"")
|
||||
|
||||
add_test(NAME pano_cli_plan_export_target_name_smoke
|
||||
COMMAND pano_cli plan-export-target --kind name --doc-name demo --suffix -timelapse)
|
||||
set_tests_properties(pano_cli_plan_export_target_name_smoke PROPERTIES
|
||||
LABELS "app;integration;desktop-fast"
|
||||
PASS_REGULAR_EXPRESSION "\"command\":\"plan-export-target\".*\"kind\":\"name\".*\"suggestedName\":\"demo-timelapse\"")
|
||||
|
||||
add_test(NAME pano_cli_simulate_app_session_clean_smoke
|
||||
COMMAND pano_cli simulate-app-session)
|
||||
set_tests_properties(pano_cli_simulate_app_session_clean_smoke PROPERTIES
|
||||
|
||||
60
tests/app_core/document_export_tests.cpp
Normal file
60
tests/app_core/document_export_tests.cpp
Normal file
@@ -0,0 +1,60 @@
|
||||
#include "app_core/document_export.h"
|
||||
#include "test_harness.h"
|
||||
|
||||
namespace {
|
||||
|
||||
void equirectangular_export_builds_file_target(pp::tests::Harness& harness)
|
||||
{
|
||||
const auto target = pp::app::make_document_export_file_target("D:/Paint", "demo", ".png");
|
||||
PP_EXPECT(harness, target);
|
||||
PP_EXPECT(harness, target.value().path == "D:/Paint/demo.png");
|
||||
PP_EXPECT(harness, target.value().suggested_name == "demo.png");
|
||||
}
|
||||
|
||||
void export_file_target_rejects_invalid_input(pp::tests::Harness& harness)
|
||||
{
|
||||
const auto missing_name = pp::app::make_document_export_file_target("D:/Paint", "", ".jpg");
|
||||
const auto missing_extension = pp::app::make_document_export_file_target("D:/Paint", "demo", "");
|
||||
PP_EXPECT(harness, !missing_name);
|
||||
PP_EXPECT(harness, missing_name.status().code == pp::foundation::StatusCode::invalid_argument);
|
||||
PP_EXPECT(harness, !missing_extension);
|
||||
PP_EXPECT(harness, missing_extension.status().code == pp::foundation::StatusCode::invalid_argument);
|
||||
}
|
||||
|
||||
void collection_export_builds_directory_and_stem(pp::tests::Harness& harness)
|
||||
{
|
||||
const auto target = pp::app::make_document_export_collection_target("D:/Paint", "demo", "_layers");
|
||||
PP_EXPECT(harness, target);
|
||||
PP_EXPECT(harness, target.value().directory == "D:/Paint/demo_layers");
|
||||
PP_EXPECT(harness, target.value().stem_path == "D:/Paint/demo_layers/demo");
|
||||
}
|
||||
|
||||
void picked_directory_export_builds_stem(pp::tests::Harness& harness)
|
||||
{
|
||||
const auto target = pp::app::make_document_export_stem_target("D:/Exports", "demo");
|
||||
PP_EXPECT(harness, target);
|
||||
PP_EXPECT(harness, target.value().stem_path == "D:/Exports/demo");
|
||||
}
|
||||
|
||||
void video_export_builds_suggested_name(pp::tests::Harness& harness)
|
||||
{
|
||||
const auto timelapse = pp::app::make_document_export_suggested_name("demo", "-timelapse");
|
||||
const auto animation = pp::app::make_document_export_suggested_name("demo", "-animation");
|
||||
PP_EXPECT(harness, timelapse);
|
||||
PP_EXPECT(harness, animation);
|
||||
PP_EXPECT(harness, timelapse.value().name == "demo-timelapse");
|
||||
PP_EXPECT(harness, animation.value().name == "demo-animation");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
pp::tests::Harness harness;
|
||||
harness.run("equirectangular export builds file target", equirectangular_export_builds_file_target);
|
||||
harness.run("export file target rejects invalid input", export_file_target_rejects_invalid_input);
|
||||
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);
|
||||
return harness.finish();
|
||||
}
|
||||
Reference in New Issue
Block a user