diff options
Diffstat (limited to 'sources/pyside6/PySide6/doc/qtquicktest.rst')
-rw-r--r-- | sources/pyside6/PySide6/doc/qtquicktest.rst | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/sources/pyside6/PySide6/doc/qtquicktest.rst b/sources/pyside6/PySide6/doc/qtquicktest.rst new file mode 100644 index 000000000..9df2af071 --- /dev/null +++ b/sources/pyside6/PySide6/doc/qtquicktest.rst @@ -0,0 +1,62 @@ +// @snippet quick_test_main_documentation + +Sets up the entry point for a Qt Quick Test application. +The ``name`` argument uniquely identifies this set of tests. + +``sys.argv`` should be passed to the ``argv`` argument to ensure +propagation of the command line arguments. + +.. note:: The function assumes that your test sources are in the current + directory, unless the ``QUICK_TEST_SOURCE_DIR`` environment + variable is set or a directory is passed in ``dir``. + +The following snippet demonstrates the use of this function: + +.. code-block:: Python + + import sys + from PySide6.QtQuickTest import QUICK_TEST_MAIN + + ex = QUICK_TEST_MAIN("example", sys.argv) + sys.exit(ex) + + +// @snippet quick_test_main_documentation + +// @snippet quick_test_main_with_setup_documentation + +Sets up the entry point for a Qt Quick Test application. +The ``name`` argument uniquely identifies this set of tests. + +``sys.argv`` should be passed to the ``argv`` argument to ensure +propagation of the command line arguments. + +This function is identical to ``QUICK_TEST_MAIN()``, except that it takes an +additional argument ``setup``, the type of a ``QObject``-derived +class which will be instantiated. With this class, it is possible to define +additional setup code to execute before running the QML test. + +The following snippet demonstrates the use of this function: + +.. code-block:: Python + + import sys + from PySide6.QtQuickTest import QUICK_TEST_MAIN_WITH_SETUP + + class CustomTestSetup(QObject): + def __init__(self, parent=None): + super().__init__(parent) + + @Slot(QQmlEngine) + def qmlEngineAvailable(self, qmlEngine): + pass + + ex = QUICK_TEST_MAIN_WITH_SETUP("qquicktestsetup", CustomTestSetup, sys.argv) + sys.exit(ex) + + +.. note:: The function assumes that your test sources are in the current + directory, unless the ``QUICK_TEST_SOURCE_DIR`` environment + variable is set or a directory is passed in ``dir``. + +// @snippet quick_test_main_with_setup_documentation |