Merge pull request #8402 from dotCooCoo/feat/prefs-descriptions-plugins-scratch

Preferences: the line under the fields describes each Plug-ins & Scratch Disks setting
This commit is contained in:
BFlat authored and GitHub committed 2026-11-20 02:36:37 +07:00
commit d5d1f84005
2 files changed
+67 -5

No files matched your search

+66 -4
View File
@@ -2432,6 +2432,38 @@ fn keyboard_focus_on_a_slices_row_shows_its_description() {
assert!(described.iter().any(|d| d == numbers), "the focused control carries the sentence: {described:?}");
}
/// Whether `sentence` is one of `texts` and is drawn on the description line of the frame that
/// painted them.
fn painted_on_line(ctx: &egui::Context, texts: &[(String, egui::Rect)], sentence: &str) -> bool {
let line = description_line_rects(ctx).line;
texts.iter().any(|(t, r)| t == sentence && r.intersects(line))
}
/// Tab from the search field, which must have the keyboard, until each of `sentences` has shown on
/// the description line. Other controls may come between them, but a sentence that shows before the
/// ones ahead of it in `sentences` fails the test. → For each sentence, the description of the focused
/// accessibility node and the focused widget when it first showed.
fn tab_to_each(a: &mut VectorcraftApp, ctx: &egui::Context, sentences: &[&str]) -> Vec<(Option<String>, Option<egui::Id>)> {
assert!(ctx.memory(|m| m.has_focus(search_edit_id())), "the search field has the keyboard before the first Tab");
let mut first = vec![];
for _ in 0..40 {
if first.len() == sentences.len() {
break;
}
let (texts, described) = description_frame(a, ctx, key_press(egui::Key::Tab, egui::Modifiers::NONE));
if let Some(i) = sentences.iter().position(|s| painted_on_line(ctx, &texts, s)) {
assert!(i <= first.len(), "Tab reaches {:?} before {:?}", sentences[i], sentences[first.len()]);
if i == first.len() {
first.push((described, ctx.memory(|m| m.focused())));
}
}
}
if let Some(missing) = sentences.get(first.len()) {
panic!("Tab does not reach the row of {missing:?}");
}
first
}
/// The pointer over Hyphenation's Default Language row and over its Exceptions row shows each
/// row's sentence.
#[test]
@@ -2449,10 +2481,10 @@ fn hovering_a_hyphenation_row_shows_its_description() {
let exceptions = descriptions::description("hyphenationExceptions").expect("Exceptions has a sentence");
description_frame(&mut a, &ctx, vec![egui::Event::PointerMoved(row(&texts, "Default Language:"))]);
let (after, _) = description_frame(&mut a, &ctx, vec![]);
assert!(painted(&after, language) && !painted(&after, exceptions), "the Default Language row's sentence shows: {after:?}");
assert!(painted_on_line(&ctx, &after, language) && !painted(&after, exceptions), "the Default Language row's sentence shows: {after:?}");
description_frame(&mut a, &ctx, vec![egui::Event::PointerMoved(row(&texts, "Exceptions"))]);
let (after, _) = description_frame(&mut a, &ctx, vec![]);
assert!(painted(&after, exceptions) && !painted(&after, language), "the Exceptions row's sentence shows: {after:?}");
assert!(painted_on_line(&ctx, &after, exceptions) && !painted(&after, language), "the Exceptions row's sentence shows: {after:?}");
}
/// Tab from the search field reaches Hyphenation's Default Language menu and then its Exceptions
@@ -2494,7 +2526,37 @@ fn hovering_a_plugins_and_scratch_disks_row_shows_its_description() {
description_frame(&mut a, &ctx, vec![egui::Event::PointerMoved(row(&texts, label))]);
let (after, _) = description_frame(&mut a, &ctx, vec![]);
for (j, sentence) in sentences.iter().enumerate() {
assert_eq!(painted(&after, sentence), i == j, "pointer over `{label}`, sentence {j}: {after:?}");
let shown = if i == j { painted_on_line(&ctx, &after, sentence) } else { painted(&after, sentence) };
assert_eq!(shown, i == j, "pointer over `{label}`, sentence {j}: {after:?}");
}
}
}
/// Tab from the search field reaches the Additional Plug-ins Folder field, then Primary, then
/// Secondary: the line shows each one's sentence in turn, and a screen reader gets it as the focused
/// field's description. With a folder picker, Choose… shares the folder's row, and the folder's
/// text field still has the keyboard when its sentence first shows.
#[test]
fn keyboard_focus_on_a_plugins_and_scratch_disks_row_shows_its_description() {
let keys = ["pluginsFolder", "scratchPrimary", "scratchSecondary"];
let sentences: Vec<_> = keys.iter().map(|key| descriptions::description(key).unwrap_or_else(|| panic!("`{key}` has a sentence"))).collect();
for picker in [false, true] {
let mut a = app();
if picker {
a.services.pick_folder = Some(Box::new(|| None));
}
open(&mut a, Some("Plug-ins & Scratch Disks"));
let ctx = egui::Context::default();
ctx.enable_accesskit();
crate::theme::install_fonts(&ctx);
description_frame(&mut a, &ctx, vec![]);
let (texts, _) = description_frame(&mut a, &ctx, vec![]);
assert_eq!(texts.iter().any(|(t, _)| t == "Choose…"), picker, "Choose… shows only with a folder picker: {texts:?}");
let visits = tab_to_each(&mut a, &ctx, &sentences);
for ((described, focused), (key, sentence)) in visits.iter().zip(keys.iter().zip(&sentences)) {
let field = focused.is_some_and(|id| egui::text_edit::TextEditState::load(&ctx, id).is_some());
assert!(field, "the `{key}` text field has the keyboard (picker {picker})");
assert!(described.iter().any(|d| d == sentence), "the focused `{key}` field carries the sentence (picker {picker}): {described:?}");
}
}
}
@@ -2503,7 +2565,7 @@ fn hovering_a_plugins_and_scratch_disks_row_shows_its_description() {
/// Budget menu, then Primary, then Secondary: the line shows each one's sentence in turn, and a
/// screen reader gets it as the focused control's description.
#[test]
fn keyboard_focus_on_a_plugins_and_scratch_disks_row_shows_its_description() {
fn keyboard_focus_on_the_plugin_instruction_budget_menu_shows_its_description() {
let mut a = app();
open(&mut a, Some("Plug-ins & Scratch Disks"));
let ctx = egui::Context::default();
+1 -1
View File
@@ -871,7 +871,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
- **Preferences › General describes its settings:** the line under the Preferences fields shows a sentence for each of the 32 General settings, Enable Contextual Task Bar included, when the pointer is over the setting's row or its control has the keyboard focus, and a screen reader gets the same sentence. The sentences are VectorCraft's own and state what the app does with each setting. Sentences: `crates/ui-egui/src/prefs_dialog/descriptions.rs`. Tests: `crates/ui-egui/src/prefs_dialog/tests.rs`.
- **Preferences › Selection & Anchor Display describes its settings:** the line under the Preferences fields shows a sentence for each of the 14 Selection & Anchor Display settings, from Tolerance to the Curvature Tool rubber band, on hover and on keyboard focus, and a screen reader gets the same sentence. The Snap to Point sentence states that the Smart Guides Snapping Tolerance applies while Smart Guides is on. Sentences: `crates/ui-egui/src/prefs_dialog/descriptions.rs`. Tests: `crates/ui-egui/src/prefs_dialog/tests.rs`.
- **Preferences › Guides & Grid describes its settings:** the line under the Preferences fields shows a sentence for each of the 12 Guides & Grid settings, from Snap to Grid to Pattern Editing's Tile Edge Color, on hover and on keyboard focus, and a screen reader gets the same sentence. The Show Pixel Grid sentence states that the pixel grid shows from 600% zoom. Sentences: `crates/ui-egui/src/prefs_dialog/descriptions.rs`. Tests: `crates/ui-egui/src/prefs_dialog/tests.rs`.
- **Preferences › Plug-ins & Scratch Disks describes its settings:** the line under the Preferences fields shows a sentence for Additional Plug-ins Folder, Primary and Secondary on hover and on keyboard focus, and a screen reader gets the same sentence. The sentences state VectorCraft's own behavior: on the desktop the folder's `.wasm` plug-ins load at startup and when OK sets a new folder, except in Safe Mode, and the web version does not load them; Primary and Secondary take Startup, None or a folder path and are stored, but no scratch disk is used yet (G12 stays open). Sentences: `crates/ui-egui/src/prefs_dialog/descriptions.rs`. Tests: `crates/ui-egui/src/prefs_dialog/tests.rs`.
- **Preferences › Plug-ins & Scratch Disks describes its settings:** the line under the Preferences fields shows a sentence for Additional Plug-ins Folder, Plug-in Instruction Budget, Primary and Secondary on hover and on keyboard focus, and a screen reader gets the same sentence. The sentences state VectorCraft's own behavior: on the desktop the folder's `.wasm` plug-ins load at startup and when OK sets a new folder, except in Safe Mode, and the web version does not load them; the larger Plug-in Instruction Budget gives each object filter run five times the base instructions with the same allowance for each byte of input, and heavy filters, live effects, exporters and importers keep their own limits; Primary and Secondary take Startup, None or a folder path and are stored, but no scratch disk is used yet (G12 stays open). Sentences: `crates/ui-egui/src/prefs_dialog/descriptions.rs`. Tests: `crates/ui-egui/src/prefs_dialog/tests.rs`.
- **Preferences › User Interface describes its settings:** the line under the Preferences fields shows a sentence for each of the 13 User Interface settings, from Brightness to Language, System Title Bar and VectorCraft Title Bar on Every Desktop included where the platform shows them, on hover and on keyboard focus, and a screen reader gets the same sentence. The sentences state VectorCraft's own behavior: Accent Color is dimmed while the color scheme has its own accent; Outline view shows the canvas white whatever Canvas Color says; with Auto-Collapse Iconic Panels on, a panel opened from its icon closes on Esc or a click outside it; Open Documents As Tabs applies to documents opened or created afterwards; both title bar settings apply from the next start; UI Scaling leaves the size of art at a given zoom alone; Scale Cursor Proportional to UI sizes only the pointers VectorCraft draws; the dialog shows a chosen language before OK. Sentences: `crates/ui-egui/src/prefs_dialog/descriptions.rs`. Tests: `crates/ui-egui/src/prefs_dialog/tests.rs`.
- **Preferences › Performance describes its settings:** the line under the Preferences fields shows a sentence for each of the 8 Performance settings, from GPU Performance to Use Monitor Profile for Canvas, Linux Display Server included on Linux, on hover and on keyboard focus, and a screen reader gets the same sentence. The sentences state VectorCraft's own behavior: GPU Performance only allows Animated Zoom; Animated Zoom makes wheel zooms glide and the Zoom tool zoom as it is dragged or held; Graphics Processor applies to the desktop version from the next start, and Automatic prefers the processor that drives the display; History States caps each document's undo steps, and the memory budget can drop older steps sooner; with Real-time Drawing and Editing off, outlines follow a drag and the art changes on release, while a ruler guide still moves; Render Threads sets the canvas rasterizer's workers, and the web version uses none; Linux Display Server's X11 choice always uses XWayland on a Wayland desktop and the others only with a pen attached; Use Monitor Profile for Canvas converts the canvas to the display's profile unless the system does so, and off draws it in sRGB. Units, General, Selection & Anchor Display, Guides & Grid, Smart Guides, Slices, Hyphenation, Plug-ins & Scratch Disks, User Interface, Performance and Type have sentences, and the other categories leave the line empty. Sentences: `crates/ui-egui/src/prefs_dialog/descriptions.rs`. Tests: `crates/ui-egui/src/prefs_dialog/tests.rs`.
- **Preferences › Hyphenation describes its settings:** the line under the Preferences fields shows a sentence for Default Language and for Exceptions (comma separated) on hover and on keyboard focus, and a screen reader gets the same sentence. The sentences state VectorCraft's own behavior: new type takes the Default Language while Document Setup's language is English: USA and [Normal Character Style] sets no language, and type already in a document keeps its own; in paragraphs with Hyphenate on, a listed word breaks only at the hyphens typed in it, or nowhere without one, in any case, except that Korean words take no hyphen and Indian-language words do not break inside a character cluster. Units, General, Selection & Anchor Display, Guides & Grid, Smart Guides, Slices, Hyphenation and Type have sentences, and the other categories leave the line empty. Sentences: `crates/ui-egui/src/prefs_dialog/descriptions.rs`. Tests: `crates/ui-egui/src/prefs_dialog/tests.rs`.