Skip to content

Commit 7fd9791

Browse files
Kataccclaude
andcommitted
Test the Language dialog's default with nothing selected
With no text or shape selected, Review › Language must apply to the whole presentation without choosing it, and Selected text must be disabled. The existing test still covers switching to Whole presentation while text is selected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent f77cb0b commit 7fd9791

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

‎crates/ui-egui/src/lib.rs‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3041,6 +3041,41 @@ mod tests {
30413041
}
30423042
}
30433043

3044+
/// With nothing selected, Review > Language applies to the whole presentation without
3045+
/// choosing it, and Selected text can't be picked.
3046+
#[test]
3047+
fn the_language_dialog_marks_the_whole_presentation_with_nothing_selected() {
3048+
use egui_kittest::kittest::{NodeT, Queryable};
3049+
let mut harness = egui_kittest::Harness::builder().with_size(egui::vec2(1200.0, 800.0)).build_ui_state(
3050+
|ui, app: &mut SlideApp| {
3051+
app.logic(ui.ctx());
3052+
app.ui(ui);
3053+
},
3054+
SlideApp::new(Session::with_new(), Services::default()),
3055+
);
3056+
harness.run_steps(2);
3057+
let s = &mut harness.state_mut().session;
3058+
let title = s.active().unwrap().doc.slides[0].shapes[0].id.0;
3059+
s.execute("text.edit", &json!({"id": title})).unwrap();
3060+
s.execute("text.insert", &json!({"text": "Hola"})).unwrap();
3061+
s.execute("slide.new", &json!({"title": "Adiós"})).unwrap();
3062+
s.execute("edit.select", &json!({"ids": []})).unwrap();
3063+
assert!(s.active().unwrap().selection.text.is_none() && s.active().unwrap().selection.shapes.is_empty());
3064+
harness.state_mut().run("app.dialog", json!({"id": "language"})).unwrap();
3065+
harness.run_steps(4);
3066+
assert!(harness.get_by_label("Selected text").accesskit_node().is_disabled());
3067+
harness.get_by_label("Español (España)").click();
3068+
harness.run_steps(2);
3069+
harness.get_by_label("OK").click();
3070+
harness.run_steps(2);
3071+
assert!(harness.state().dialog.is_none());
3072+
let d = harness.state().session.active().unwrap();
3073+
for sl in &d.doc.slides {
3074+
let body = sl.shapes[0].text.as_ref().unwrap();
3075+
assert_eq!(body.paragraphs[0].runs[0].props.lang.as_deref(), Some("es-ES"));
3076+
}
3077+
}
3078+
30443079
/// Speaker notes keep their formatting when edited in the notes pane: typing into a bold
30453080
/// heading, Enter in a bulleted point, then saving as .pptx and reopening.
30463081
#[test]

0 commit comments

Comments
 (0)