Restore python macro capability
Note 1: This capability seemed to be abandoned, it didn't even compile, so I didn't try hard to preserve 'old' ways of doing things.
Note 2: I only tested using python 3
Note 3: It was abandoned before the 'check' event type was added. I didn't have enough time to implement any of the 'check' logic paths. We've been doing all the test assertions using boost test.
Note 4: I didn't realize the core library didn't depend on QtTest until I created this branch (I've been building using our own CMakeLists.txt) I'm only using it for QSignalSpy. I suspect it could be useful elsewhere though, i.e. when synthesizing playback events, I was surprised it wasn't used. If adding this dependency is is a problem I think I can implement a version of QSignalSpy without QtTest if need be.
Inspired by squish, I created a number of waitFor[X] commands to help with playback timing issues. I also created some wiki-marked up documentation pasted below:
==== QtTesting python module functions ====
== void playCommand( objectIdentifier: str, command: str, arguments: str ) ==
This is the most common command. You'll usually not need to create this yourself as it is created for you when you record actions. These are played back on a fixed time interval. If a playCommand starts before a previous one is complete, you'll need to mannually add one of the 'wait' functions defined below.
QtTesting.playCommand('MainWindow/mMenuBar/mFileMenu', 'activate', 'mOpenProjectAction' )
== Tuple waitForSignal( objectIdentifier: str, signal: str, millisecondTimout: str ) ==
Wait for the signal to fire from the object. The signal string must be formatted as if it were inside the Qt SIGNAL() macro within a connect call. Timeout is an error condition and will terminate macro execution. Returns a Tuple containing the string representation of the QVariant argument value. i.e. if the the signal passes a single int value, 5, then the Tuple will contain one string value that represents that int, '5'. If any of the arguments are a QStringList or a QList< QVariant>, then that argument will be represented with a semicolon separated list of strings.
QtTesting.waitForSignal( 'MainWindow/EditorPane/Editor', 'objectChanged()', 2000 )
== None waitForProperty( objectIdentifier: str, propertyName: str, propertyValue: str, millisecondTimeout: int) ==
Wait until a [[https://doc.qt.io/qt-5/properties.html|Qt property]] is a specified value. The propertyValue must be formated as if using [[https://doc.qt.io/qt-5/qvariant.html#toString|QVariant::toString()]]. If the variant is a container, the elements of the container are concatenated with a ';' i.e. '5;1;3'. Timeout is an error condition and will terminate macro execution QtTesting.waitForProperty( 'MainWindow/EditorPane/Editor/MyButton', 'enabled', 'true', 10000 )
== str waitForObject( objectIdentifier: str, millisecondTimeout: int ) ==
Wait until the object can be discovered from the objectIdentifer. Returns the objectIdentifer so that the function can be used as an argument to playCommand
QtTesting.playCommand( QtTesting.waitForObject( 'MainWindow/LongProcessCompletedMessageBox/OkButton', 5000 ), 'activate', '' )
== None waitForProgressComplete( progressBarIdentifier: str, int millisecondTimoutPerStep: str ) == Wait until the progress bar reaches it's maximum value. This is particularly useful when using a separate thread for long running operations. The timeout is per step, specifically between valueChanged(int) signals.
== str getProperty( objectIdentifer: str, propertyName: str ) == Returns the QVariant::toString()representation of the object property.
== None setProperty( objectIdentifer: str, propertyName: str, propertyValue: str ) == Set the an object property from the QVariant::toString() representation of the value
== str getChildren( objectIdentifer: str ) == Return a comma delimited list of child object identifiers
== str invokeMethod( objectIdentifier: str, method: str )== Invoke a Qt slot with the signature "QVariant foo()" using [[https://doc.qt.io/qt-5/qmetaobject.html#invokeMethod|QMetaObject::invokeMethod]] Returns the QVariant::toString() representation of the result.