Custom gestures

These are the scripts, functions, and parameters used to draw custom gestures during a manual session.

A manual session with gestures open.

Scripts

Scripts contain one or more space-separated functions. Depending on the specific function, zero or more parameters can be assigned to the function. If a parameter is required for a function, it’ll be surrounded with <>, otherwise it’ll be surrounded with [].

down(0%, 0%, 3) move(50%, 50%, 3) up(3) // Places the 4th finger on the screen at 0%, 0%, moves the finger to 50%, 50%, and then removes the finger.

Functions

arc(<x>, <y>, <angle>, [finger], [duration])

arc() draws an arc from -360 to 360 degrees. Use x and y to set the center of the arc, and angle to set the arc’s angle in degrees.

By default, finger is set to 0 and duration is set to 2s.

down(50%, 50%) arc(50%, 50%, 180) // Draws a semi-circle starting and ending at the center of the screen.
down(50%, 50%) arc(50%, 50%, 0) // Draws a point at the center of the screen.
down(50%, 50%) arc(50%, 50%, 360) // Draws a full circle starting and ending at the center of the screen.

down(<x>, <y>, [finger])

dow() places a finger on the screen at the x and y coordinates. By default, finger will be set to 0, unless you choose a different finger. The finger won’t move unless called in another function.

down(1px, 400px) // Places a finger at 1px, 400px using the pixels of your computer monitor.
down(400dp, 1dp) // Places a finger at 400px, 1px using the pixels of the mobile device screen.
down(1%, 100%) // Places a finger at 1%, 100% by multiplying the length of the mobile device screen by its relevant axis.

move(<x>, <y>, [finger], [duration])

move() swipes a finger from its current location to the location specified in move(). By default, finger will be set to 0 and duration will be set to 2s.

If there’s no finger on the screen yet, down() will be called instead.
down(50%, 50%) move(75%, 75%) // Places a finger at 50%, 50% then moves it to 75%, 75%.
down(50%, 50%) move(25%, 25%) // Places a finger at 50%, 50% then moves it to 25%, 25%.
down(50%, 50%) move(100%, 0%) // Places a finger at 50%, 50% then moves it to 100%, 0%.

sync([finger])

sync() waits for all function calls to finish before calling more functions. If finger is assigned, sync() only applies to function calls using that finger.

down(0) sync() down(1) // Wait for all functions to finish before placing the 2nd finger down.
down(0) sync(1) down(1) // Wait for the 1st finger to finish before placing the 2nd finger down.
down(0) sync(0) down(1) // Place the 2nd finger down immediately, since sync() was only applied to the 1st finger.

up([finger])

up() removes a finger from the screen. By default, finger will be set to 0, unless you choose a different finger.

up() // Removes the 1st finger from the screen since a finger wasn't specified.
up(5) // Removes the 6th finger from the screen.

wait(<duration>)

wait() waits for duration before calling more functions.

wait(20ms) // Waits for 20 milliseconds before calling another function.
wait(30s) // Waits for 30 seconds before calling another function.

Parameters

angle

angle determines the angle of arc(). Set to an integer ranging from -360 to 360.Positive integers are draw arc() clockwise and negative integers draw arc() counterclockwise.

down(50%, 50%) arc(50%, 50%, 180) // Draws a semi-circle starting and ending at the center of the screen.
down(50%, 50%) arc(50%, 50%, 0) // Draws a point at the center of the screen.
down(50%, 50%) arc(50%, 50%, 360) // Draws a full circle starting and ending at the center of the screen.

duration

duration determines the duration of a function and can be set to any positive integer. By default, milliseconds (ms) is used as the unit of measurement, however seconds (s) can be used instead.

wait(50) // Waits for 50 milliseconds.
wait(30ms) // Waits for 30 milliseconds.
wait(8s) // Waits for 8 seconds.

finger

finger determines which finger to use for a gesture and can be set to an integer ranging from 0 to 9. By default, finger is set to 0. Use a different finger for different functions to create multi-touch gestures, like a two-finger swipe or pinch.

down(50%, 50%, 0) // Places the first finger on the center of the screen.
move(1px, 400px, 8) // Swipes the ninth finger from pixel 1 to pixel 400 on the screen.
up(4) // Removes the fifth finger from the screen.

x and y

x and y determines the function’s location on the device screen. By default, pixels (px) is used as the unit of measurement, but device-independent pixels (dp) or a screen percentage (%) can be used instead.

down(1px, 400px) // Places a finger at 1px, 400px using the pixels of your computer monitor.
down(400dp, 1dp) // Places a finger at 400px, 1px using the pixels of the mobile device screen.
down(1%, 100%) // Places a finger at 1%, 100% by multiplying the length of the mobile device screen by its relevant axis.

Units of measurement

px

px, or pixel, is an integer that represents the exact location of a pixel on the display running the test session (not the test device). While px allows for pixel-perfect placement of functions, integers assigned to px may represent different pixel locations on different displays. To use a relative pixel location instead, see dp.

dp

dp, or device-independent pixel, is an integer that represents the relative location of a pixel on the display running the test session (not the test device). While dp allows gestures to be used on different displays more easily, functions can’t be placed pixel-perfect. To use an exact pixel location instead, see px.

%

An integer between 0 and 100 that represents a location on the display running the test session (not the test device)--for example, (50%, 50%) represents the center of the screen. The location of % is determined by multiplying the length of the test screen by the relevant axis.

s

An integer that represents the measure of time in seconds.

ms

An integer that represents the measure of time in milliseconds.