Plan document session prompts

This commit is contained in:
2026-06-05 08:07:54 +02:00
parent 5def47cdcc
commit e5526c6d0a
11 changed files with 316 additions and 26 deletions

View File

@@ -820,6 +820,25 @@ if(TARGET pano_cli)
LABELS "app;integration;desktop-fast"
PASS_REGULAR_EXPRESSION "\"command\":\"plan-document-version\".*\"documentName\":\"demo.01\".*\"existingPaths\":1.*\"name\":\"demo.03\".*\"path\":\"D:/Paint/demo.03.ppi\"")
add_test(NAME pano_cli_plan_document_session_prompt_close_smoke
COMMAND pano_cli plan-document-session-prompt --kind close-unsaved)
set_tests_properties(pano_cli_plan_document_session_prompt_close_smoke PROPERTIES
LABELS "app;integration;desktop-fast"
PASS_REGULAR_EXPRESSION "\"command\":\"plan-document-session-prompt\".*\"kind\":\"close-unsaved\".*\"title\":\"Unsaved document\".*\"message\":\"Do you want to close without saving\\?\".*\"okCaption\":\"Yes\".*\"cancelCaption\":\"No\".*\"showCancel\":true")
add_test(NAME pano_cli_plan_document_session_prompt_overwrite_smoke
COMMAND pano_cli plan-document-session-prompt --kind file-overwrite --name demo)
set_tests_properties(pano_cli_plan_document_session_prompt_overwrite_smoke PROPERTIES
LABELS "app;integration;desktop-fast"
PASS_REGULAR_EXPRESSION "\"command\":\"plan-document-session-prompt\".*\"kind\":\"file-overwrite\".*\"message\":\"Are you sure you want to overwrite demo\\?\".*\"showCancel\":true")
add_test(NAME pano_cli_plan_document_session_prompt_rejects_unknown
COMMAND pano_cli plan-document-session-prompt --kind nope)
set_tests_properties(pano_cli_plan_document_session_prompt_rejects_unknown PROPERTIES
LABELS "app;integration;desktop-fast;fuzz"
WILL_FAIL TRUE
PASS_REGULAR_EXPRESSION "\"command\":\"plan-document-session-prompt\".*\"message\":\"unknown document session prompt kind\"")
add_test(NAME pano_cli_plan_export_start_allowed_smoke
COMMAND pano_cli plan-export-start --requires-license)
set_tests_properties(pano_cli_plan_export_start_allowed_smoke PROPERTIES

View File

@@ -26,6 +26,7 @@ void message_dialog_preserves_cancel_policy(pp::tests::Harness& harness)
PP_EXPECT(harness, plan.title == "Import");
PP_EXPECT(harness, plan.message == "Import brushes?");
PP_EXPECT(harness, plan.ok_caption == "Ok");
PP_EXPECT(harness, plan.cancel_caption == "Cancel");
PP_EXPECT(harness, plan.show_cancel);
}
@@ -37,6 +38,14 @@ void message_dialog_defaults_to_no_cancel(pp::tests::Harness& harness)
PP_EXPECT(harness, !plan.show_cancel);
}
void message_dialog_allows_custom_button_captions(pp::tests::Harness& harness)
{
const auto plan = pp::app::plan_app_message_dialog("Unsaved", "Save first?", true, "Yes", "No");
PP_EXPECT(harness, plan.ok_caption == "Yes");
PP_EXPECT(harness, plan.cancel_caption == "No");
PP_EXPECT(harness, plan.show_cancel);
}
void input_dialog_preserves_ok_caption(pp::tests::Harness& harness)
{
const auto plan = pp::app::plan_app_input_dialog("Rename", "Layer", "Save");
@@ -62,6 +71,7 @@ int main()
harness.run("progress dialog clamps negative total", progress_dialog_clamps_negative_total);
harness.run("message dialog preserves cancel policy", message_dialog_preserves_cancel_policy);
harness.run("message dialog defaults to no cancel", message_dialog_defaults_to_no_cancel);
harness.run("message dialog allows custom button captions", message_dialog_allows_custom_button_captions);
harness.run("input dialog preserves ok caption", input_dialog_preserves_ok_caption);
harness.run("input dialog rejects empty ok caption", input_dialog_rejects_empty_ok_caption);
return harness.finish();

View File

@@ -358,6 +358,43 @@ void close_request_executor_dispatches_and_preserves_wait(pp::tests::Harness& ha
PP_EXPECT(harness, services.call_order == "close;prompt;");
}
void document_session_prompt_catalog_preserves_legacy_close_and_workflow_text(pp::tests::Harness& harness)
{
const auto close = pp::app::plan_document_session_prompt(
pp::app::DocumentSessionPromptKind::close_unsaved_document);
const auto workflow = pp::app::plan_document_session_prompt(
pp::app::DocumentSessionPromptKind::save_before_workflow_continue);
PP_EXPECT(harness, close.title == "Unsaved document");
PP_EXPECT(harness, close.message == "Do you want to close without saving?");
PP_EXPECT(harness, close.ok_caption == "Yes");
PP_EXPECT(harness, close.cancel_caption == "No");
PP_EXPECT(harness, close.show_cancel);
PP_EXPECT(harness, workflow.message == "Would you like to save this document before closing?");
PP_EXPECT(harness, workflow.ok_caption == "Yes");
PP_EXPECT(harness, workflow.cancel_caption == "No");
}
void document_session_prompt_catalog_preserves_overwrite_and_error_text(pp::tests::Harness& harness)
{
const auto new_doc = pp::app::plan_document_session_prompt(
pp::app::DocumentSessionPromptKind::new_document_overwrite);
const auto overwrite = pp::app::plan_document_session_prompt(
pp::app::DocumentSessionPromptKind::document_file_overwrite,
"demo");
const auto save_error = pp::app::plan_document_session_prompt(
pp::app::DocumentSessionPromptKind::document_save_error);
PP_EXPECT(harness, new_doc.title == "Warning");
PP_EXPECT(harness, new_doc.message == "A document with this name already exists, continue?");
PP_EXPECT(harness, new_doc.show_cancel);
PP_EXPECT(harness, overwrite.message == "Are you sure you want to overwrite demo?");
PP_EXPECT(harness, overwrite.show_cancel);
PP_EXPECT(harness, save_error.title == "Saving Error");
PP_EXPECT(harness, save_error.message == "There was a problem saving the document");
PP_EXPECT(harness, !save_error.show_cancel);
}
void save_clean_existing_document_is_no_op(pp::tests::Harness& harness)
{
PP_EXPECT(
@@ -757,6 +794,12 @@ int main()
harness.run("close clean document executes immediately", close_clean_document_executes_immediately);
harness.run("close dirty document opens one prompt", close_dirty_document_opens_one_prompt);
harness.run("close request executor dispatches and preserves wait", close_request_executor_dispatches_and_preserves_wait);
harness.run(
"document session prompt catalog preserves legacy close and workflow text",
document_session_prompt_catalog_preserves_legacy_close_and_workflow_text);
harness.run(
"document session prompt catalog preserves overwrite and error text",
document_session_prompt_catalog_preserves_overwrite_and_error_text);
harness.run("save clean existing document is no op", save_clean_existing_document_is_no_op);
harness.run("save executor dispatches visible work and no ops cleanly", save_executor_dispatches_visible_work_and_no_ops_cleanly);
harness.run("save new or dirty document has user visible work", save_new_or_dirty_document_has_user_visible_work);