Merge pull request #9107 from dotCooCoo/fix/print-dialog-field-names

Accessibility: Save PDF and Print field name tests
This commit is contained in:
BFlat
2026-11-26 16:58:31 +07:00
committed by GitHub
3 changed files with 58 additions and 0 deletions
@@ -1015,3 +1015,23 @@ fn save_pdf_opens_with_the_flattener_options_given_and_refuses_bad_ones() {
assert!(!is_open(&app), "{bad}");
}
}
/// The number and length fields of the sections that name them: the page range, the bleed sides and the font
/// subset threshold.
#[test]
fn the_range_bleed_and_subset_fields_are_named() {
let (mut app, _) = app();
app.run("file.export.pdf", json!({})).unwrap();
let sections: [(&str, &[&str]); 3] =
[("general", &["Range"]), ("marks", &["Offset", "Top", "Bottom", "Left", "Right"]), ("advanced", &["Subset fonts below"])];
for (section, expected) in sections {
set_field(&app, "section", json!(section));
pump(&mut app);
let ctx = app.ui_ctx.clone().expect("a UI context");
let out = crate::testing::app_frame(&mut app, &ctx, Default::default());
let names = super::super::tests_print::field_names(&out);
for name in expected {
assert!(names.iter().any(|n| n == name), "{section}: {name} in {names:?}");
}
}
}
+37
View File
@@ -538,3 +538,40 @@ fn a_spot_inks_icon_converts_it_to_process_and_back() {
pump(&mut app);
assert_eq!(inks(&app), json!([{"name": "Gold", "print": true, "convertToProcess": false}]));
}
/// The names screen readers give the number and text fields in `out`'s accessibility tree: a field's own
/// name, else the text of a label it is labeled by, else "".
pub(super) fn field_names(out: &egui::FullOutput) -> Vec<String> {
use egui::accesskit::Role;
let nodes = &out.platform_output.accesskit_update.as_ref().expect("an accessibility tree").nodes;
let text_of = |id| nodes.iter().find(|(n, _)| *n == id).and_then(|(_, n)| n.label().or(n.value())).map(str::to_string);
nodes
.iter()
.filter(|(_, n)| matches!(n.role(), Role::TextInput | Role::SpinButton))
.map(|(_, n)| n.label().map(str::to_string).or_else(|| n.labelled_by().iter().find_map(|l| text_of(*l))).unwrap_or_default())
.collect()
}
/// Every number and length field of the dialog's sections has a name that tells it from the others in its row.
#[test]
fn every_number_and_length_field_is_named() {
let (mut app, _) = app();
app.run("file.print", json!({})).unwrap();
pump(&mut app);
let sections: [(&str, &[&str]); 4] = [
("General", &["Copies", "Range", "Width", "Height", "Overlap", "Tile Range", "Gutter", "Scale 1", "Scale 2"]),
("Marks and Bleed", &["Offset", "Top", "Bottom", "Left", "Right"]),
("Graphics", &["Flatness"]),
("Advanced", &["Unprintable margin"]),
];
for (section, expected) in sections {
set(&mut app, "section", json!(section));
pump(&mut app);
let ctx = ctx(&app);
let out = crate::testing::app_frame(&mut app, &ctx, Default::default());
let names = field_names(&out);
for name in expected {
assert!(names.iter().any(|n| n == name), "{section}: {name} in {names:?}");
}
}
}
+1
View File
@@ -815,6 +815,7 @@ since 2026-10-01.
- **EPS Options custom flattener settings:** the help page describes flattening an EPS's transparency with a preset or with custom options, adjusted through Custom ([saving in EPS](https://helpx.adobe.com/illustrator/desktop/save-and-export/export-files-to-different-formats/save-artwork-in-eps-format.html)). EPS Options now has Custom… beside the flattener Preset. It opens Custom Transparency Flattener Options on the settings the export would use: the raster/vector balance, both resolutions, the text and stroke outline switches, Clip Complex Regions and Anti-alias Rasters. OK goes back to EPS Options with the preset shown as [Custom], the export flattens with those settings, and the next EPS Options start from them; choosing a preset drops them, and Cancel goes back to EPS Options unchanged. Preserve Alpha Transparency stays off, and overprints are kept only with Overprints set to Preserve. The [Custom] label, the remembering, the Cancel behavior, Anti-alias Rasters and the ranges (balance 0 to 100, resolutions 1 to 2400 ppi) are VectorCraft's own. Evidence: `dialogs::tests_eps::custom_flattener_options_start_from_the_preset_and_cancel_goes_back_unchanged`, `custom_flattener_options_are_exported_and_remembered_until_a_preset_is_chosen`, `bad_custom_flattener_options_keep_the_dialog_open`.
- **EPS export and Discard White Overprint:** the help page describes Discard White Overprint as taking the overprint attribute off white objects in output, without changing the artwork ([white overprint](https://helpx.adobe.com/illustrator/desktop/manage-colors/apply-transparency-and-blending/white-overprint.html)). EPS export and PostScript printing, composite and separated, now follow Discard White Overprint in Output (Document Setup), as PDF export does: a white fill or stroke marked to overprint knocks out while the setting is on and overprints while it is off. The same page says the setting covers process white and not spot white, so a white fill linked to a spot swatch that has a color keeps overprinting. The tiles of an overprinting pattern fill overprint with it. Evidence: `cmd::fileio::tests_eps::overprints_are_kept_or_discarded`, `tests::tiles_overprint_with_their_overprinting_pattern`, `tests::white_type_fills_knock_out_with_discard_white_overprint`, `tests::spot_white_fills_overprint_with_discard_white_overprint`, `print::tests::white_overprints_knock_out_on_postscript_plates_with_discard_white_overprint`.
- **Save PDF custom flattener settings:** the help page describes the Advanced section's flattener preset for PDF 1.3 saves of transparent art, with a Custom button for adjusting the flattener settings, and says neither is available at PDF 1.4 and later ([PDF options](https://helpx.adobe.com/illustrator/using/pdf-options.html)). Save PDF › Advanced now has Custom… beside Flattener preset, enabled for PDF 1.3, PDF/X-1a and PDF/X-3. It opens Custom Transparency Flattener Options on the settings the save would use: the raster/vector balance, both resolutions, the text and stroke outline switches and Anti-alias Rasters; Clip Complex Regions shows on, as the PDF 1.3 writer always clips, overprints are kept only with Overprint set to Preserve, and Preserve Alpha Transparency shows off, as PDF 1.3 rasters keep no alpha. OK goes back to Save PDF with the preset shown as [Custom] and the save flattens with those settings; settings equal to the preset's leave its name, choosing a preset drops them, and Cancel goes back unchanged. PDF presets keep the flattener preset but not these settings, and Save Preset… says so while they are set. `ui.savePdfDialog` keeps a `flattener` it is given. The [Custom] label, the Cancel behavior, Anti-alias Rasters, the editor's absence from the PDF preset editor and the ranges (balance 0 to 100, resolutions 1 to 2400 ppi) are VectorCraft's own. Evidence: `dialogs::save_pdf::tests::custom_is_enabled_where_the_save_flattens`, `custom_starts_from_the_preset_and_cancel_goes_back_unchanged`, `custom_options_are_written_until_a_preset_is_chosen`, `custom_options_equal_to_the_preset_leave_its_name`, `custom_shows_alpha_as_the_pdf_1_3_writer_drops_it`, `save_preset_says_it_leaves_the_custom_flattener_options_out`, `save_pdf_opens_with_the_flattener_options_given_and_refuses_bad_ones`.
- **Save PDF and Print field names for screen readers:** the number, length and range fields of Print (copies, range, width, height, overlap, tile range, gutter, scale, bleed sides, flatness, unprintable margin) and of Save PDF (range, bleed sides, font subset threshold) have a name in the accessibility tree. Evidence: `dialogs::save_pdf::tests::the_range_bleed_and_subset_fields_are_named`, `dialogs::tests_print::every_number_and_length_field_is_named`.
- **Raster export backgrounds (#6125):** a raster export draws its background under the finished art, and blend modes read only the art below them, as on the canvas. An Outer Glow in Screen mode on the bare page shows in a PNG on white and in a JPEG. Flatten Transparency puts its white under the finished art the same way. Evidence: `tests::file::a_screen_outer_glow_is_in_raster_exports`, `tests::objectfx::a_screen_outer_glow_on_the_bare_page_shows_on_a_background`, `tests::knockout::page_knockout_and_isolated_blending`, `tests::knockout::no_blend_mode_reads_the_background`, `tests::cmykflatten::every_blend_mode_flattens_to_the_canvas_pixels_in_cmyk`.