M10: cover both tools in the page_size refusal test (#3273)

Review follow-up. The test's comment said a bad page_size is refused
"on every tool", but the loop called only doc_create. It now calls
doc_create and both of doc_create_multiple's modes, so the comment is
what the test proves rather than a claim beside it.

create_separate checked page_size after creating out_dir, so a refused
request left an empty folder behind. The check moves above the mkdir
and the test asserts neither the file nor the folder appears.

The parity entry listed only doc_create under tools, although its own
notes and evidence already covered doc_create_multiple.
This commit is contained in:
Muhammad Saad committed 2026-10-31 13:19:29 +04:00
1 parent 205c7868ee
commit 86bd77fa9d
2 files changed
+13 -7

No files matched your search

+11 -5
View File
@@ -9465,13 +9465,19 @@ fn image_pages_go_on_a_chosen_paper_size_through_every_create_tool() {
let one = ok(&mut a, "doc_open", json!({ "path": "out/a_page_1.pdf" }))["doc"].as_u64().unwrap();
assert!(close(size(&mut a, one, 0), A4));
// A size that is not a paper name or a pair of points is refused, on every tool.
// A size that is not a paper name or a pair of points is refused, by every tool that takes
// one and in both of doc_create_multiple's modes, before anything is written.
for bad in [json!("A9"), json!([300]), json!(["a", "b"]), json!(5), json!({})] {
assert!(
matches!(a.call("doc_create", &json!({ "from": "images", "paths": shots, "page_size": bad })), Err(ToolError::InvalidArgs(_))),
"{bad} should be refused"
);
for (tool, args) in [
("doc_create", json!({ "from": "images", "paths": shots, "page_size": bad.clone() })),
("doc_create_multiple", json!({ "paths": shots, "page_size": bad.clone(), "out": "refused.pdf" })),
("doc_create_multiple", json!({ "paths": shots, "mode": "separate", "out_dir": "refused", "page_size": bad.clone() })),
] {
assert!(matches!(a.call(tool, &args), Err(ToolError::InvalidArgs(_))), "{tool}: {bad} should be refused");
}
}
assert!(!dir.join("refused.pdf").exists(), "a refused page_size leaves no file behind");
assert!(!dir.join("refused").exists(), "nor a folder");
}
/// Three paragraphs: Alpha (two rows), Bravo (one row) and Charlie (two rows), at the leading
+2 -2
View File
@@ -6895,8 +6895,8 @@ tier = "P0"
milestone = "M10"
status = "shipped"
commands = ["create.images"]
tools = ["doc_create"]
evidence = ["crates/create/src/tests.rs::black_and_white_images_are_stored_at_one_bit", "crates/create/src/tests.rs::jpeg_2000_images_are_embedded_as_is", "crates/create/src/tests.rs::images_export_as_jpeg_unchanged_and_others_as_png", "crates/create/src/tests.rs::embedded_icc_profiles_tag_the_image_colour_space", "crates/create/src/tests.rs::a_set_of_differently_shaped_images_lands_on_one_paper_size", "crates/automation/tests/automation.rs::image_pages_go_on_a_chosen_paper_size_through_every_create_tool"]
tools = ["doc_create", "doc_create_multiple"]
evidence = ["crates/create/src/tests.rs::black_and_white_images_are_stored_at_one_bit", "crates/create/src/tests.rs::jpeg_2000_images_are_embedded_as_is", "crates/create/src/tests.rs::images_export_as_jpeg_unchanged_and_others_as_png", "crates/create/src/tests.rs::embedded_icc_profiles_tag_the_image_colour_space", "crates/create/src/tests.rs::a_set_of_differently_shaped_images_lands_on_one_paper_size", "crates/automation/tests/it/automation.rs::image_pages_go_on_a_chosen_paper_size_through_every_create_tool"]
notes = "PNG, JPEG, TIFF (multi-page), GIF (first frame), BMP, and JPEG 2000 (JP2 or codestream, embedded as JPXDecode with its capture resolution). JPEG and PNG ICC profiles are kept as /ICCBased; TIFF profiles are not read yet. A picture of only pure black and white (a 1-bit PNG or TIFF, eight-bit grey, a two-colour palette, RGB without a profile) is stored at one bit per pixel, as CCITT Group 4 or Flate, whichever is smaller. Pages follow the image at its resolution, or sit on a chosen sheet (page_size: a paper name or points, scaled to fit, centred, turned to the image unless page_turn is false) in doc_create and doc_create_multiple; doc_combine does not take it yet, and there is no dialog for it"
[[feature]]