mirror of
https://github.com/emilk/egui.git
synced 2026-09-02 06:40:06 -04:00
Create custom egui_kittest::Node (#7138)
This adds a custom Node struct with proper support for egui types (`Key`, `Modifiers`, `egui::Event`, `Rect`) instead of needing to use the kittest / accesskit types. I also changed the `click` function to do a proper mouse move / mouse down instead of the accesskit click. Also added `accesskit_click` to trigger the accesskit event. This resulted in some changed snapshots, since the elements are now hovered. Also renamed `press_key` to `key_press` for consistency with `key_down/key_up`. Also removed the Deref to the AccessKit Node, to make it clearer when to expect egui and when to expect accesskit types. * Closes #5705 * [x] I have followed the instructions in the PR template
This commit is contained in:
@@ -113,8 +113,8 @@ impl crate::View for TextEditDemo {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use egui::{accesskit, CentralPanel};
|
||||
use egui_kittest::kittest::{Key, Queryable as _};
|
||||
use egui::{accesskit, CentralPanel, Key, Modifiers};
|
||||
use egui_kittest::kittest::Queryable as _;
|
||||
use egui_kittest::Harness;
|
||||
|
||||
#[test]
|
||||
@@ -133,8 +133,9 @@ mod tests {
|
||||
|
||||
let text_edit = harness.get_by_role(accesskit::Role::TextInput);
|
||||
assert_eq!(text_edit.value().as_deref(), Some("Hello, world!"));
|
||||
text_edit.focus();
|
||||
|
||||
text_edit.key_combination(&[Key::Command, Key::A]);
|
||||
harness.key_press_modifiers(Modifiers::COMMAND, Key::A);
|
||||
text_edit.type_text("Hi ");
|
||||
|
||||
harness.run();
|
||||
|
||||
Reference in New Issue
Block a user