mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-01 10:51:11 +01:00
Wait for the plug-in dialog to settle before clicking its slider
This commit is contained in:
1 parent
0d15529634
commit
38efbf1e4b
1 file changed
+7
-1
@@ -193,8 +193,13 @@ fn filter_dialog_previews_and_commits_one_undo_step() {
|
||||
assert_eq!(fields(h.state())["amount"], json!(100.0));
|
||||
// A click in the visible slider must reach the same values the live preview reads.
|
||||
use egui_kittest::kittest::Queryable as _;
|
||||
// Let the modal finish its opening placement before reading a widget's screen bounds.
|
||||
for _ in 0..3 {
|
||||
step(&mut h);
|
||||
}
|
||||
let at = h.get_by_role(egui::accesskit::Role::Dialog).get_by_role(egui::accesskit::Role::Slider).rect().center();
|
||||
h.input_mut().events.push(egui::Event::PointerMoved(at));
|
||||
step(&mut h);
|
||||
for pressed in [true, false] {
|
||||
h.input_mut().events.push(egui::Event::PointerButton {
|
||||
pos: at,
|
||||
@@ -204,7 +209,8 @@ fn filter_dialog_previews_and_commits_one_undo_step() {
|
||||
});
|
||||
step(&mut h);
|
||||
}
|
||||
assert!(fields(h.state())["amount"].as_f64().is_some_and(|amount| amount > 0.0 && amount < 100.0));
|
||||
let clicked = fields(h.state());
|
||||
assert!(clicked["amount"].as_f64().is_some_and(|amount| amount > 0.0 && amount < 100.0), "slider at {at:?}: {clicked}");
|
||||
// Agents set fields like `ui.dialog.set` does; the frame previews them.
|
||||
set_field(&mut h, "amount", json!(50)).unwrap();
|
||||
step(&mut h);
|
||||
|
||||
Reference in new issue
Block a user