How to Test iOS Applications

The iOS Convenience API provides functions for executing common user interface actions, such as tapping and gestures.

How to Use the GestureBuilder class

The readGesture(gesture-file) function returns an instance of the GestureBuilder class. You can create an instance of a gesture in the script code and use it for playing back gestures, instead of recoding them. Use the Gesture creation methods to dynamically create a gesture.

Here is an example of a 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);

Here is an example of a zoom gesture, that is, two fingers moving away from each other, also in one second. This time it is 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());

© 2023 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.