Plan document share decisions in app core

This commit is contained in:
2026-06-02 23:53:09 +02:00
parent cc3490d9d8
commit 777723b68c
10 changed files with 148 additions and 3 deletions

View File

@@ -298,6 +298,16 @@ add_test(NAME pp_app_core_document_recording_tests COMMAND pp_app_core_document_
set_tests_properties(pp_app_core_document_recording_tests PROPERTIES
LABELS "app;desktop-fast;fuzz")
add_executable(pp_app_core_document_sharing_tests
app_core/document_sharing_tests.cpp)
target_link_libraries(pp_app_core_document_sharing_tests PRIVATE
pp_app_core
pp_test_harness)
add_test(NAME pp_app_core_document_sharing_tests COMMAND pp_app_core_document_sharing_tests)
set_tests_properties(pp_app_core_document_sharing_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
@@ -571,6 +581,18 @@ if(TARGET pano_cli)
LABELS "app;integration;desktop-fast;fuzz"
PASS_REGULAR_EXPRESSION "\"command\":\"plan-recording-session\".*\"platformDeletesRecordedFiles\":true.*\"deleteRecordedFiles\":true.*\"frameCountAfterClear\":0")
add_test(NAME pano_cli_plan_share_file_unsaved_smoke
COMMAND pano_cli plan-share-file)
set_tests_properties(pano_cli_plan_share_file_unsaved_smoke PROPERTIES
LABELS "app;integration;desktop-fast;fuzz"
PASS_REGULAR_EXPRESSION "\"command\":\"plan-share-file\".*\"path\":\"\".*\"decision\":\"show-save-required-warning\"")
add_test(NAME pano_cli_plan_share_file_saved_smoke
COMMAND pano_cli plan-share-file --path D:/Paint/demo.ppi)
set_tests_properties(pano_cli_plan_share_file_saved_smoke PROPERTIES
LABELS "app;integration;desktop-fast"
PASS_REGULAR_EXPRESSION "\"command\":\"plan-share-file\".*\"path\":\"D:/Paint/demo.ppi\".*\"decision\":\"share-now\"")
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

View File

@@ -0,0 +1,28 @@
#include "app_core/document_sharing.h"
#include "test_harness.h"
namespace {
void share_requires_saved_document_path(pp::tests::Harness& harness)
{
PP_EXPECT(
harness,
pp::app::plan_document_share("") == pp::app::DocumentShareAction::show_save_required_warning);
}
void share_allows_nonempty_document_path(pp::tests::Harness& harness)
{
PP_EXPECT(
harness,
pp::app::plan_document_share("D:/Paint/demo.ppi") == pp::app::DocumentShareAction::share_now);
}
}
int main()
{
pp::tests::Harness harness;
harness.run("share requires saved document path", share_requires_saved_document_path);
harness.run("share allows nonempty document path", share_allows_nonempty_document_path);
return harness.finish();
}