How to Use the iOS API

How to Use the GestureBuilder class

The readGesture(gesture-file) 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 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());

© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.