mirror of
https://github.com/emilk/egui.git
synced 2026-06-26 22:53:14 -04:00
Test(egui_kittest): add a snapshot test
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6664509aa41a9a235657d8af7f73bc3f1fcaf3df1aa20db1e06e02f0a2c8aeab
|
||||
size 9005
|
||||
@@ -214,3 +214,39 @@ fn test_remove_cursor() {
|
||||
"The button appearance should change"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_ime_composition_visuals() {
|
||||
let mut harness = Harness::new_ui_state(
|
||||
|ui, state| {
|
||||
egui::TextEdit::multiline(state)
|
||||
.desired_width(120.0)
|
||||
.desired_rows(5)
|
||||
.show(ui);
|
||||
},
|
||||
"Hello. Bye.".to_owned(),
|
||||
);
|
||||
|
||||
harness.fit_contents();
|
||||
|
||||
let text_edit = harness.get_by_role(egui::accesskit::Role::MultilineTextInput);
|
||||
text_edit.focus();
|
||||
harness.run();
|
||||
|
||||
harness.key_press(egui::Key::Home);
|
||||
for _ in 0.."Hello. ".len() {
|
||||
harness.key_press(egui::Key::ArrowRight);
|
||||
}
|
||||
harness.event(egui::Event::Ime(egui::ImeEvent::Preedit {
|
||||
text: "Have you ever seen an IME composing English text? You now see it. ".to_owned(),
|
||||
active_range_chars: Some(
|
||||
"Have you ever ".chars().count()
|
||||
.."Have you ever seen an IME composing English text? "
|
||||
.chars()
|
||||
.count(),
|
||||
),
|
||||
}));
|
||||
harness.run();
|
||||
|
||||
harness.snapshot("test_ime_composition_visuals");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user