Table of Contents
The readGesture
returns an instance of
the GestureBuilder
class. But if you want to create gestures
in script code rather than recording, you can also create an instance in
the script code and use it for playing back gestures.
control or dependency on runtime state information. You can use the
Gesture creation (Section 6.9.1.1) methods to
dynaically create a gesture.
Here is an example of a gesture with two finger gesture making a curved
counter clockwise movement (for iOS tests it is recommended to use
LogicalPoint
as the unit since playback does not differ on
retina and non-retina devices):
var tb = new GestureBuilder(320, 480, GestureBuilder.LogicalPoint); tb.addStroke( 300, 200 ); tb.curveTo(1000, 250, 150, 150, 150, 100, 200 ); tb.addStroke( 100, 400 ); tb.curveTo(1000, 150, 450, 250, 450, 300, 400); tb.build(); gesture(waitForObject(":some_object"), tb);
And here an example of a zoom gesture, two finger gesture moving away from each other, also in one second. This time written as one statement.
gesture(waitForObject(":some_object"), new GestureBuilder(320, 480, GestureBuilder.LogicalPoint) .addStroke( 180, 200 ) .lineTo(1000, 100, 120 ) .addStroke( 220, 240 ) .lineTo(1000, 300, 320) .build());