Hyphenation: the focused-edit test clicks another option after typing

The focused-edit test now clicks Hyphenate Capitalized Words after typing a
Words Longer Than count and pressing Tab, and checks that the draft keeps the
typed count while the checkbox changes, in every language and every answer
it runs. OK and the confirmation commit both edits. The docs/mcp.md sentence
on the disabled options is wrapped to the paragraph's width.
This commit is contained in:
dotCooCoo committed 2026-12-02 22:16:30 -08:00
1 parent 0ff5dc45d8
commit ad7aebf303
2 files changed
+17 -5

No files matched your search

+13 -1
View File
@@ -227,15 +227,17 @@ mod tests {
let modal = control(&tree, "Hyphenation", Role::Dialog, None);
let count = control(&tree, "Words Longer Than:", Role::SpinButton, Some(modal));
let enabled = control(&tree, "Hyphenation", Role::CheckBox, Some(modal));
let capitalized = control(&tree, "Hyphenate Capitalized Words", Role::CheckBox, Some(modal));
let footer = control(&tree, if apply { "OK" } else { "Cancel" }, Role::Button, Some(modal));
assert!(screen.expand(0.5).contains_rect(modal));
for bounds in [count, enabled, footer] {
for bounds in [count, enabled, capitalized, footer] {
assert!(bounds.is_positive() && modal.expand(0.5).contains_rect(bounds), "{lang}: {bounds:?} outside {modal:?}");
}
let before = driver::fields(&app);
assert_eq!(before.number("wordsLongerThan"), Some(5.0));
assert_eq!(before.bool("hyphenate"), Some(false));
assert!(before.is_mixed("afterFirst"));
assert_eq!(before.bool("hyphenateCapitalized"), Some(true));
// The counts take input once Hyphenation is on.
click(&mut app, &mut frame, enabled.center());
settle(&mut app, &mut frame);
@@ -251,6 +253,15 @@ mod tests {
if checked != Some(true) || kept != (Some(8.0), Some(true)) || !driver::fields(&app).is_mixed("afterFirst") {
failures.push(format!("{lang} {answer}: {checked:?}, {kept:?}"));
}
// Clicking another option after typing keeps the typed count.
click(&mut app, &mut frame, capitalized.center());
settle(&mut app, &mut frame);
let inspected = draft(&app, &ctx);
let other = (inspected["wordsLongerThan"].as_f64(), inspected["hyphenateCapitalized"].as_bool());
eprintln!("{lang}, {answer}: ui.inspect after the second checkbox {other:?}");
if other != (Some(8.0), Some(false)) {
failures.push(format!("{lang} {answer}: after the second checkbox {other:?}"));
}
assert_eq!(paras(&app, id), original, "{lang}: only the draft changes while open");
if answer == "ui.dialog.confirm" {
let (request, _) = ControlRequest::new(answer, json!({}));
@@ -279,6 +290,7 @@ mod tests {
for p in [&mut expected.0, &mut expected.1] {
p.hyphenation.words_longer_than = 8;
p.hyphenate = true;
p.hyphenation.capitalized = false;
}
if actual != expected || undo_delta != 1 {
failures.push(format!(
+4 -4
View File
@@ -14179,10 +14179,10 @@ listed word. The options are saved with the paragraph (`hyphenation` in `para`)
defaults, and paragraph styles carry them (`paraStyle.new {attrs: {hyphenation: {words_longer_than: 8}}}`). One undo
step. `ui.hyphenation` opens the Hyphenation dialog on the values the Paragraph panel shows; OK sends the values that
changed. The options below the Hyphenation checkbox take input only while it is checked, and Hyphenation Zone is
disabled while no paragraph in scope uses a single-line composer. The UI command `type.hyphenate` (Cmd+Alt+Shift+H, in remote mode `press_key {key: "H", mods: {cmd: true,
alt: true, shift: true}}` or `invoke_menu`) does what the Hyphenate checkbox does: it turns `hyphenate` off when
every paragraph of the selected type (or every paragraph the Type tool's selection touches) hyphenates, else on, and
returns the new value.
disabled while no paragraph in scope uses a single-line composer. The UI command `type.hyphenate` (Cmd+Alt+Shift+H,
in remote mode `press_key {key: "H", mods: {cmd: true, alt: true, shift: true}}` or `invoke_menu`) does what the
Hyphenate checkbox does: it turns `hyphenate` off when every paragraph of the selected type (or every paragraph the
Type tool's selection touches) hyphenates, else on, and returns the new value.
```json
{"name":"run_command","arguments":{"command":"text.setFormat","params":{"hyphenate":true,"wordsLongerThan":8,"hyphenLimit":2}}}