Skip to content

Commit

Permalink
Try out where the mouse moves
Browse files Browse the repository at this point in the history
  • Loading branch information
pentamassiv committed Aug 13, 2024
1 parent b4fb5ee commit 3cf4a3a
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/tests/mouse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,3 +277,27 @@ fn unit_mouse_drag() {
enigo.button(Button::Left, Release).unwrap();
}
*/

#[test]
// Print the locations to estimate the error
fn unit_print_move_mouse_rel() {
let start = (0, 0);

let mut enigo = Enigo::new(&Settings::default()).unwrap();

let delay = super::get_delay();
thread::sleep(delay);
// Github runner display is 1024x768

for i in 0..=1024 {
let rel_move = (i, 0);
enigo.move_mouse(start.0, start.1, Abs).unwrap(); // Move to absolute start position
println!("Relatively move by ({}, {})", rel_move.0, rel_move.1);
enigo.move_mouse(rel_move.0, rel_move.1, Rel).unwrap();
thread::sleep(delay);
let (x_res, y_res) = enigo.location().unwrap();

println!("New location: ({x_res}, {y_res})");
thread::sleep(delay);
}
}

0 comments on commit 3cf4a3a

Please sign in to comment.