From f5ee71993b3af8cf9cd89c605ab4bf30df30cb92 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Fri, 19 Jan 2018 10:51:01 +0100 Subject: Give Qt Quick Test its own documentation module MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It has its own QML types, so it makes sense. This also makes it easy to add documentation for C++ types later on. Task-number: QTBUG-50064 Change-Id: Ifc302c7d547d806f2ea7674dfecddf36cc1e258f Reviewed-by: Topi Reiniö --- src/qmltest/doc/qtqmltest.qdocconf | 42 +++++++++ src/qmltest/doc/src/qtquicktest-index.qdoc | 133 +++++++++++++++++++++++++++++ 2 files changed, 175 insertions(+) create mode 100644 src/qmltest/doc/qtqmltest.qdocconf create mode 100644 src/qmltest/doc/src/qtquicktest-index.qdoc (limited to 'src/qmltest/doc') diff --git a/src/qmltest/doc/qtqmltest.qdocconf b/src/qmltest/doc/qtqmltest.qdocconf new file mode 100644 index 0000000000..e51007d2b2 --- /dev/null +++ b/src/qmltest/doc/qtqmltest.qdocconf @@ -0,0 +1,42 @@ +include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) + +project = QtQuickTest +description = Qt Quick Test Reference Documentation +version = $QT_VERSION + +qhp.projects = QtQuickTest + +qhp.QtQuickTest.file = qtqmltest.qhp +qhp.QtQuickTest.namespace = org.qt-project.qtquicktest.$QT_VERSION_TAG +qhp.QtQuickTest.virtualFolder = qtquicktest +qhp.QtQuickTest.indexTitle = Qt Quick Test +qhp.QtQuickTest.indexRoot = + +qhp.QtQuickTest.filterAttributes = qtquicktest $QT_VERSION qtrefdoc +qhp.QtQuickTest.customFilters.Qt.name = QtQuickTest $QT_VERSION +qhp.QtQuickTest.customFilters.Qt.filterAttributes = qtquicktest $QT_VERSION +qhp.QtQuickTest.subprojects = qmltypes classes examples +qhp.QtQuickTest.subprojects.classes.title = C++ Classes +qhp.QtQuickTest.subprojects.classes.indexTitle = Qt Quick Test C++ Classes +qhp.QtQuickTest.subprojects.classes.selectors = class doc:headerfile +qhp.QtQuickTest.subprojects.classes.sortPages = true +qhp.QtQuickTest.subprojects.examples.title = Examples +qhp.QtQuickTest.subprojects.examples.indexTitle = Qt Quick Test Examples +qhp.QtQuickTest.subprojects.examples.selectors = doc:example +qhp.QtQuickTest.subprojects.qmltypes.title = QML Types +qhp.QtQuickTest.subprojects.qmltypes.indexTitle = Qt Quick Test QML Types +qhp.QtQuickTest.subprojects.qmltypes.selectors = qmlclass +qhp.QtQuickTest.subprojects.qmltypes.sortPages = true + + +tagfile = ../../../doc/qtquicktest/qtquicktest.tags + +depends += qtcore qtxmlpatterns qtgui qttestlib qtqml qtquick qtdoc + +headerdirs += .. + +sourcedirs += .. + +navigation.landingpage = "Qt Quick Test" +navigation.cppclassespage = "Qt Quick Test C++ Classes" +navigation.qmltypespage = "Qt Quick Test QML Types" diff --git a/src/qmltest/doc/src/qtquicktest-index.qdoc b/src/qmltest/doc/src/qtquicktest-index.qdoc new file mode 100644 index 0000000000..d2b3f0e1f4 --- /dev/null +++ b/src/qmltest/doc/src/qtquicktest-index.qdoc @@ -0,0 +1,133 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \page qtquicktest-index.html + \title Qt Quick Test + \brief Unit testing framework for QML. + + \section1 Introduction + + \l {Qt Quick Test QML Types}{Qt Quick Test} is a unit test framework for QML applications. + Test cases are written as JavaScript functions within a \l [QML] TestCase + type: + + \qml + import QtQuick 2.3 + import QtTest 1.0 + + TestCase { + name: "MathTests" + + function test_math() { + compare(2 + 2, 4, "2 + 2 = 4") + } + + function test_fail() { + compare(2 + 2, 5, "2 + 2 = 5") + } + } + \endqml + + Functions whose names start with \c{test_} are treated as test cases + to be executed. See the documentation for the \l [QML] TestCase and + \l [QML] SignalSpy types for more information on writing test cases. + + \section1 Running Tests + + Test cases are launched by a C++ harness that consists of + the following code: + + \code + #include + QUICK_TEST_MAIN(example) + \endcode + + Where "example" is the identifier to use to uniquely identify + this set of tests. You should add \c{CONFIG += qmltestcase}. + For example: + + \badcode + TEMPLATE = app + TARGET = tst_example + CONFIG += warn_on qmltestcase + SOURCES += tst_example.cpp + \endcode + + The test harness scans the specified source directory recursively + for "tst_*.qml" files. If \c{QUICK_TEST_SOURCE_DIR} is not defined, + then the current directory will be scanned when the harness is run. + Other *.qml files may appear for auxillary QML components that are + used by the test. + + The \c{-input} command-line option can be set at runtime to run + test cases from a different directory. This may be needed to run + tests on a target device where the compiled-in directory name refers + to a host. For example: + + \badcode + tst_example -input /mnt/SDCard/qmltests + \endcode + + It is also possible to run a single file using the \c{-input} option. + For example: + + \badcode + tst_example -input data/test.qml + \endcode + + \badcode + tst_example -input /test.qml + \endcode + + \note Specifying the full path to the qml test file is for example + needed for shadow builds. + + If your test case needs QML imports, then you can add them as + \c{-import} options to the test program command-line. + + If \c IMPORTPATH is specified in your .pro file, each import path added to \c IMPORTPATH + will be passed as a command-line argument when the test is run using "make check": + + \badcode + IMPORTPATH += $$PWD/../imports/my_module1 $$PWD/../imports/my_module2 + \endcode + + The \c{-functions} command-line option will return a list of the current + tests functions. It is possible to run a single test function using the name + of the test function as an argument. For example: + + \badcode + tst_example Test_Name::function1 + \endcode + + The \c{-help} command-line option will return all the options available. + + \badcode + tst_example -help + \endcode +*/ -- cgit v1.2.3