mirror of
https://github.com/emilk/egui.git
synced 2026-09-02 23:00:04 -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:
@@ -1,6 +1,6 @@
|
||||
use egui::{include_image, Modifiers, Vec2};
|
||||
use egui_kittest::Harness;
|
||||
use kittest::{Key, Queryable as _};
|
||||
use kittest::Queryable as _;
|
||||
|
||||
#[test]
|
||||
fn test_shrink() {
|
||||
@@ -39,17 +39,15 @@ fn test_modifiers() {
|
||||
State::default(),
|
||||
);
|
||||
|
||||
harness.get_by_label("Click me").key_down(Key::Command);
|
||||
// This run isn't necessary, but allows us to test whether modifiers are remembered between frames
|
||||
harness.run();
|
||||
harness.get_by_label("Click me").click();
|
||||
harness.get_by_label("Click me").key_up(Key::Command);
|
||||
harness
|
||||
.get_by_label("Click me")
|
||||
.click_modifiers(Modifiers::COMMAND);
|
||||
harness.run();
|
||||
|
||||
harness.press_key_modifiers(Modifiers::COMMAND, egui::Key::Z);
|
||||
harness.key_press_modifiers(Modifiers::COMMAND, egui::Key::Z);
|
||||
harness.run();
|
||||
|
||||
harness.node().key_combination(&[Key::Command, Key::Y]);
|
||||
harness.key_combination_modifiers(Modifiers::COMMAND, &[egui::Key::Y]);
|
||||
harness.run();
|
||||
|
||||
let state = harness.state();
|
||||
|
||||
Reference in New Issue
Block a user