input_synthesis

Function multi_finger_swipe_command

Source
pub async fn multi_finger_swipe_command(
    start_fingers: Vec<(u32, u32)>,
    end_fingers: Vec<(u32, u32)>,
    width: u32,
    height: u32,
    move_event_count: usize,
    duration: Duration,
) -> Result<(), Error>
Expand description

Simulates swipe with fingers starting at start_fingers, and moving to end_fingers, for a touchscreen for a touchscreen with horizontal resolution width and vertical resolution height. Finger positions should be specified in absolute coordinations, with x values normally in the range (0, width), and y values normally in the range (0, height).

Linearly interpolates move_event_count touch-move events between the start positions and end positions, over duration time. (duration is the total time from the touch-down event to the touch-up event, inclusive of all move events in between.)

§Requirements

  • start_fingers and end_fingers must have the same length
  • start_fingers.len() and end_finger.len() must be representable within a u32

§Resolves to

  • Ok(()) if the arguments met the requirements above, and the events were successfully injected.
  • Err(Error) otherwise.

§Corner case handling

  • move_event_count of zero is permitted, and will result in just the DOWN and UP events being generated.
  • duration.as_nanos() < move_event_count is allowed, and will result in all events having the same timestamp.
  • width and height are permitted to be zero; such values are left to the interpretation of the system under test.
  • finger positions may exceed the expected bounds; such values are left to the interpretation of the sytem under test.