Plan document file saves in app core
This commit is contained in:
@@ -115,6 +115,34 @@ void workflow_with_dirty_canvas_prompts_for_save(pp::tests::Harness& harness)
|
||||
== pp::app::DocumentWorkflowDecision::prompt_save_before_continue);
|
||||
}
|
||||
|
||||
void document_file_target_rejects_empty_name(pp::tests::Harness& harness)
|
||||
{
|
||||
const auto target = pp::app::make_document_file_target("D:/Paint", "");
|
||||
PP_EXPECT(harness, !target);
|
||||
PP_EXPECT(harness, target.status().code == pp::foundation::StatusCode::invalid_argument);
|
||||
}
|
||||
|
||||
void document_file_target_builds_legacy_ppi_path(pp::tests::Harness& harness)
|
||||
{
|
||||
const auto target = pp::app::make_document_file_target("D:/Paint", "demo");
|
||||
PP_EXPECT(harness, target);
|
||||
PP_EXPECT(harness, target.value().name == "demo");
|
||||
PP_EXPECT(harness, target.value().directory == "D:/Paint");
|
||||
PP_EXPECT(harness, target.value().path == "D:/Paint/demo.ppi");
|
||||
}
|
||||
|
||||
void document_file_write_prompts_only_for_existing_targets(pp::tests::Harness& harness)
|
||||
{
|
||||
PP_EXPECT(
|
||||
harness,
|
||||
pp::app::plan_document_file_write(false)
|
||||
== pp::app::DocumentFileWriteDecision::save_now);
|
||||
PP_EXPECT(
|
||||
harness,
|
||||
pp::app::plan_document_file_write(true)
|
||||
== pp::app::DocumentFileWriteDecision::prompt_overwrite);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int main()
|
||||
@@ -131,5 +159,8 @@ int main()
|
||||
harness.run("workflow without canvas is unavailable", workflow_without_canvas_is_unavailable);
|
||||
harness.run("workflow with clean canvas continues now", workflow_with_clean_canvas_continues_now);
|
||||
harness.run("workflow with dirty canvas prompts for save", workflow_with_dirty_canvas_prompts_for_save);
|
||||
harness.run("document file target rejects empty name", document_file_target_rejects_empty_name);
|
||||
harness.run("document file target builds legacy ppi path", document_file_target_builds_legacy_ppi_path);
|
||||
harness.run("document file write prompts only for existing targets", document_file_write_prompts_only_for_existing_targets);
|
||||
return harness.finish();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user