Plan save-as file writes in app core
This commit is contained in:
@@ -175,6 +175,33 @@ void document_file_write_prompts_only_for_existing_targets(pp::tests::Harness& h
|
||||
== pp::app::DocumentFileWriteDecision::prompt_overwrite);
|
||||
}
|
||||
|
||||
void document_file_save_plan_combines_target_and_write_decision(pp::tests::Harness& harness)
|
||||
{
|
||||
const auto plan = pp::app::plan_document_file_save(
|
||||
"D:/Paint",
|
||||
"demo",
|
||||
[](const std::string& path) {
|
||||
return path == "D:/Paint/demo.ppi";
|
||||
});
|
||||
PP_EXPECT(harness, plan);
|
||||
PP_EXPECT(harness, plan.value().target.name == "demo");
|
||||
PP_EXPECT(harness, plan.value().target.directory == "D:/Paint");
|
||||
PP_EXPECT(harness, plan.value().target.path == "D:/Paint/demo.ppi");
|
||||
PP_EXPECT(
|
||||
harness,
|
||||
plan.value().write_decision == pp::app::DocumentFileWriteDecision::prompt_overwrite);
|
||||
}
|
||||
|
||||
void document_file_save_plan_rejects_empty_name(pp::tests::Harness& harness)
|
||||
{
|
||||
const auto plan = pp::app::plan_document_file_save(
|
||||
"D:/Paint",
|
||||
"",
|
||||
[](const std::string&) { return false; });
|
||||
PP_EXPECT(harness, !plan);
|
||||
PP_EXPECT(harness, plan.status().code == pp::foundation::StatusCode::invalid_argument);
|
||||
}
|
||||
|
||||
void document_resolution_index_maps_legacy_choices(pp::tests::Harness& harness)
|
||||
{
|
||||
const auto first = pp::app::document_resolution_from_index(0);
|
||||
@@ -320,6 +347,10 @@ int main()
|
||||
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);
|
||||
harness.run(
|
||||
"document file save plan combines target and write decision",
|
||||
document_file_save_plan_combines_target_and_write_decision);
|
||||
harness.run("document file save plan rejects empty name", document_file_save_plan_rejects_empty_name);
|
||||
harness.run("document resolution index maps legacy choices", document_resolution_index_maps_legacy_choices);
|
||||
harness.run("document resolution index rejects out of range", document_resolution_index_rejects_out_of_range);
|
||||
harness.run(
|
||||
|
||||
Reference in New Issue
Block a user