Plan picked path callbacks in app core

This commit is contained in:
2026-06-03 03:33:33 +02:00
parent 777723b68c
commit 712c28068d
10 changed files with 165 additions and 20 deletions

View File

@@ -288,6 +288,16 @@ add_test(NAME pp_app_core_document_cloud_tests COMMAND pp_app_core_document_clou
set_tests_properties(pp_app_core_document_cloud_tests PROPERTIES
LABELS "app;desktop-fast;fuzz")
add_executable(pp_app_core_document_platform_io_tests
app_core/document_platform_io_tests.cpp)
target_link_libraries(pp_app_core_document_platform_io_tests PRIVATE
pp_app_core
pp_test_harness)
add_test(NAME pp_app_core_document_platform_io_tests COMMAND pp_app_core_document_platform_io_tests)
set_tests_properties(pp_app_core_document_platform_io_tests PROPERTIES
LABELS "app;desktop-fast;fuzz")
add_executable(pp_app_core_document_recording_tests
app_core/document_recording_tests.cpp)
target_link_libraries(pp_app_core_document_recording_tests PRIVATE
@@ -593,6 +603,18 @@ if(TARGET pano_cli)
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_plan_picked_path_empty_smoke
COMMAND pano_cli plan-picked-path)
set_tests_properties(pano_cli_plan_picked_path_empty_smoke PROPERTIES
LABELS "app;integration;desktop-fast;fuzz"
PASS_REGULAR_EXPRESSION "\"command\":\"plan-picked-path\".*\"path\":\"\".*\"decision\":\"ignore-empty-path\"")
add_test(NAME pano_cli_plan_picked_path_selected_smoke
COMMAND pano_cli plan-picked-path --path D:/Paint/demo.ppi)
set_tests_properties(pano_cli_plan_picked_path_selected_smoke PROPERTIES
LABELS "app;integration;desktop-fast"
PASS_REGULAR_EXPRESSION "\"command\":\"plan-picked-path\".*\"path\":\"D:/Paint/demo.ppi\".*\"decision\":\"invoke-callback\"")
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_platform_io.h"
#include "test_harness.h"
namespace {
void picked_path_ignores_empty_path(pp::tests::Harness& harness)
{
PP_EXPECT(
harness,
pp::app::plan_picked_path("") == pp::app::PickedPathAction::ignore_empty_path);
}
void picked_path_invokes_callback_for_nonempty_path(pp::tests::Harness& harness)
{
PP_EXPECT(
harness,
pp::app::plan_picked_path("D:/Paint/demo.ppi") == pp::app::PickedPathAction::invoke_callback);
}
}
int main()
{
pp::tests::Harness harness;
harness.run("picked path ignores empty path", picked_path_ignores_empty_path);
harness.run("picked path invokes callback for nonempty path", picked_path_invokes_callback_for_nonempty_path);
return harness.finish();
}