aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmltest
diff options
context:
space:
mode:
Diffstat (limited to 'src/qmltest')
-rw-r--r--src/qmltest/doc/qtqmltest.qdocconf22
-rw-r--r--src/qmltest/doc/snippets/src_qmltest_qquicktest.cpp81
-rw-r--r--src/qmltest/doc/src/qtquicktest-cppapi.qdoc59
-rw-r--r--src/qmltest/doc/src/qtquicktest-index.qdoc46
-rw-r--r--src/qmltest/doc/src/qtquicktest-qmltypes.qdoc46
-rw-r--r--src/qmltest/doc/src/qtquicktest.qdoc79
-rw-r--r--src/qmltest/qmltest.pro2
-rw-r--r--src/qmltest/quicktest.cpp59
-rw-r--r--src/qmltest/quicktest.h13
-rw-r--r--src/qmltest/quicktestresult.cpp16
-rw-r--r--src/qmltest/quicktestresult_p.h3
11 files changed, 373 insertions, 53 deletions
diff --git a/src/qmltest/doc/qtqmltest.qdocconf b/src/qmltest/doc/qtqmltest.qdocconf
index a819546fba..9a3e16b64d 100644
--- a/src/qmltest/doc/qtqmltest.qdocconf
+++ b/src/qmltest/doc/qtqmltest.qdocconf
@@ -15,28 +15,28 @@ qhp.QtQmlTest.indexRoot =
qhp.QtQmlTest.filterAttributes = qtqmltest $QT_VERSION qtrefdoc
qhp.QtQmlTest.customFilters.Qt.name = QtQmlTest $QT_VERSION
qhp.QtQmlTest.customFilters.Qt.filterAttributes = qtqmltest $QT_VERSION
-qhp.QtQmlTest.subprojects = qmltypes classes examples
-qhp.QtQmlTest.subprojects.classes.title = C++ Classes
-qhp.QtQmlTest.subprojects.classes.indexTitle = Qt Quick Test C++ Classes
-qhp.QtQmlTest.subprojects.classes.selectors = class doc:headerfile
+
+qhp.QtQmlTest.subprojects = qmltypes classes
+qhp.QtQmlTest.subprojects.classes.title = C++ API
+qhp.QtQmlTest.subprojects.classes.indexTitle = Qt Quick Test C++ API
+qhp.QtQmlTest.subprojects.classes.selectors = class namespace doc:headerfile
qhp.QtQmlTest.subprojects.classes.sortPages = true
-qhp.QtQmlTest.subprojects.examples.title = Examples
-qhp.QtQmlTest.subprojects.examples.indexTitle = Qt Quick Test Examples
-qhp.QtQmlTest.subprojects.examples.selectors = doc:example
qhp.QtQmlTest.subprojects.qmltypes.title = QML Types
qhp.QtQmlTest.subprojects.qmltypes.indexTitle = Qt Quick Test QML Types
qhp.QtQmlTest.subprojects.qmltypes.selectors = qmlclass
qhp.QtQmlTest.subprojects.qmltypes.sortPages = true
-
-tagfile = ../../../doc/qtqmltest/qtqmltest.tags
+tagfile = qtqmltest.tags
depends += qtcore qtgui qttestlib qtqml qtquick qtdoc
headerdirs += ..
-sourcedirs += ..
+sourcedirs += .. \
+ ../../imports/testlib
+
+exampledirs += snippets
navigation.landingpage = "Qt Quick Test"
-navigation.cppclassespage = "Qt Quick Test C++ Classes"
+navigation.cppclassespage = "Qt Quick Test C++ API"
navigation.qmltypespage = "Qt Quick Test QML Types"
diff --git a/src/qmltest/doc/snippets/src_qmltest_qquicktest.cpp b/src/qmltest/doc/snippets/src_qmltest_qquicktest.cpp
new file mode 100644
index 0000000000..191f693a9a
--- /dev/null
+++ b/src/qmltest/doc/snippets/src_qmltest_qquicktest.cpp
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** 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:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [1]
+//! [0]
+#include <QtQuickTest>
+//! [0]
+QUICK_TEST_MAIN(example)
+//! [1]
+
+//! [2]
+// tst_mytest.cpp
+#include <QtQuickTest>
+#include <QQmlEngine>
+#include <QQmlContext>
+
+class Setup : public QObject
+{
+ Q_OBJECT
+
+public:
+ Setup() {}
+
+public slots:
+ void qmlEngineAvailable(QQmlEngine *engine)
+ {
+ engine->rootContext()->setContextProperty("myContextProperty", QVariant(true));
+ }
+};
+
+QUICK_TEST_MAIN_WITH_SETUP(mytest, Setup)
+
+#include "tst_mytest.moc"
+//! [2]
diff --git a/src/qmltest/doc/src/qtquicktest-cppapi.qdoc b/src/qmltest/doc/src/qtquicktest-cppapi.qdoc
new file mode 100644
index 0000000000..0e5dab8887
--- /dev/null
+++ b/src/qmltest/doc/src/qtquicktest-cppapi.qdoc
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+/*!
+ \module QtQuickTest
+ \keyword Qt Quick Test C++ API
+ \title Qt Quick Test C++ API
+ \ingroup modules
+
+ \brief Provides macros and functions for tests.
+
+ The C++ macros and functions can be included into your application using
+ the following include statement:
+
+ \snippet src_qmltest_qquicktest.cpp 0
+
+ There are two ways to link against the corresponding C++ library. If your
+ test project uses a QML \l TestCase, you should already have the following
+ line in your project file:
+
+ \badcode
+ CONFIG += qmltestcase
+ \endcode
+
+ This will cause the test to link to the C++ \QtQuickTest library.
+
+ If you have a C++-only test project, you can add the following line
+ to your project file:
+
+ \badcode
+ QT += qmltest
+ \endcode
+
+ \sa {Executing C++ Before QML Tests}
+*/
diff --git a/src/qmltest/doc/src/qtquicktest-index.qdoc b/src/qmltest/doc/src/qtquicktest-index.qdoc
index 4fad21e080..a7a840f2b3 100644
--- a/src/qmltest/doc/src/qtquicktest-index.qdoc
+++ b/src/qmltest/doc/src/qtquicktest-index.qdoc
@@ -30,6 +30,7 @@
\title Qt Quick Test
\brief Unit testing framework for QML.
+ \target Introduction to Qt Quick Test
\section1 Introduction
\l {Qt Quick Test QML Types}{Qt Quick Test} is a unit test framework for QML applications.
@@ -62,15 +63,13 @@
only guaranteed to work with the Qt version it was developed against.
However, source compatibility is guaranteed.
+ \target Running Qt Quick Tests
\section1 Running Tests
Test cases are launched by a C++ harness that consists of
the following code:
- \code
- #include <QtQuickTest/quicktest.h>
- QUICK_TEST_MAIN(example)
- \endcode
+ \snippet src_qmltest_qquicktest.cpp 1
Where "example" is the identifier to use to uniquely identify
this set of tests. Finally, add \c{CONFIG += qmltestcase} to the project
@@ -139,7 +138,7 @@
\section1 Executing C++ Before QML Tests
To execute C++ code before any of the QML tests are run, the
- \c QUICK_TEST_MAIN_WITH_SETUP macro can be used. This can be useful for
+ \l QUICK_TEST_MAIN_WITH_SETUP macro can be used. This can be useful for
setting context properties on the QML engine, amongst other things.
The macro is identical to \c QUICK_TEST_MAIN, except that it takes an
@@ -152,13 +151,13 @@
\li Purpose
\li Since
\row
- \li void applicationAvailable()
+ \li \c {void applicationAvailable()}
\li Called right after the QApplication object was instantiated.
Use this function to perform setup that does not require a
\l QQmlEngine instance.
\li Qt 5.12
\row
- \li void qmlEngineAvailable(QQmlEngine*)
+ \li \c {void qmlEngineAvailable(QQmlEngine *)}
\li Called when the QML engine is available.
Any \l {QQmlEngine::addImportPath}{import paths},
\l {QQmlEngine::addPluginPath}{plugin paths},
@@ -175,7 +174,7 @@
amongst other things.
\li Qt 5.11
\row
- \li void cleanupTestCase()
+ \li \c {void cleanupTestCase()}
\li Called right after the test execution has finished.
Use this function to clean up before everything will start to be destructed.
\li Qt 5.12
@@ -184,29 +183,7 @@
The following example demonstrates how the macro can be used to set context
properties on the QML engine:
- \code
- #include <QtQuickTest>
- #include <QQmlEngine>
- #include <QQmlContext>
-
- class Setup : public QObject
- {
- Q_OBJECT
-
- public:
- Setup() {}
-
- public slots:
- void qmlEngineAvailable(QQmlEngine *engine)
- {
- engine->rootContext()->setContextProperty("myContextProperty", QVariant(true));
- }
- };
-
- QUICK_TEST_MAIN_WITH_SETUP(mytest, Setup)
-
- #include "tst_mytest.moc"
- \endcode
+ \snippet src_qmltest_qquicktest.cpp 2
The \c .moc include is based on the file name of the \c .cpp file.
For example, in the example above, the \c .cpp file is named
@@ -217,6 +194,13 @@
#include "MyTest.moc"
\endcode
+ \section1 Reference
+
+ \list
+ \li \l{Qt Quick Test QML Types}{QML Types}
+ \li \l{Qt Quick Test C++ API}{C++ API}
+ \endlist
+
\section1 Licenses
Qt Quick Tests is available under commercial licenses from \l{The Qt Company}.
diff --git a/src/qmltest/doc/src/qtquicktest-qmltypes.qdoc b/src/qmltest/doc/src/qtquicktest-qmltypes.qdoc
new file mode 100644
index 0000000000..0ed8c6faa0
--- /dev/null
+++ b/src/qmltest/doc/src/qtquicktest-qmltypes.qdoc
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+/*!
+ \qmlmodule QtTest 1.\QtMinorVersion
+ \title Qt Quick Test QML Types
+ \brief Provides QML types to unit test your QML application.
+ \ingroup qmlmodules
+
+ You can import this module using the following statement:
+
+ \qml \QtMinorVersion
+ import QtTest 1.\1
+ \endqml
+
+ \section1 QML Types
+ \generatelist {qmltypesbymodule QtTest}
+ \noautolist
+
+ For more information about how to use these types, see
+ \l{Qt Quick Test}.
+*/
diff --git a/src/qmltest/doc/src/qtquicktest.qdoc b/src/qmltest/doc/src/qtquicktest.qdoc
new file mode 100644
index 0000000000..31c097ed76
--- /dev/null
+++ b/src/qmltest/doc/src/qtquicktest.qdoc
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+/*!
+ \namespace QQuickTest
+ \inmodule QtQuickTest
+
+ \brief The QQuickTest namespace contains all the functions and
+ macros related to Qt Quick Test.
+
+ See the \l{Introduction to Qt Quick Test} for information about how to write
+ Qt Quick unit tests.
+
+ To link to the Qt Quick Test C++ library, see \l {Qt Quick Test C++ API}.
+
+ \sa {Executing C++ Before QML Tests}
+*/
+
+/*!
+ \macro QUICK_TEST_MAIN(name)
+ \relates QQuickTest
+
+ \brief Sets up the entry point for a Qt Quick Test application.
+ The \a name argument uniquely identifies this set of tests.
+
+ \snippet src_qmltest_qquicktest.cpp 1
+
+ \note The macro assumes that your test sources are in the current
+ directory, unless the \c QUICK_TEST_SOURCE_DIR environment variable is set.
+
+ \sa QUICK_TEST_MAIN_WITH_SETUP(), {Running Qt Quick Tests}
+
+*/
+
+/*!
+ \macro QUICK_TEST_MAIN_WITH_SETUP(name, QuickTestSetupClass)
+ \relates QQuickTest
+
+ \brief Sets up the entry point for a Qt Quick Test application.
+ The \a name argument uniquely identifies this set of tests.
+
+ This macro is identical to QUICK_TEST_MAIN(), except that it takes an
+ additional argument \a QuickTestSetupClass, a pointer to a QObject-derived
+ class. With this class it is possible to define additional setup code to
+ execute before running the QML test.
+
+ \note The macro assumes that your test sources are in the current
+ directory, unless the \c QUICK_TEST_SOURCE_DIR environment variable is set.
+
+ The following snippet demonstrates the use of this macro:
+
+ \snippet src_qmltest_qquicktest.cpp 2
+
+ \sa QUICK_TEST_MAIN(), {Running Qt Quick Tests}
+*/
diff --git a/src/qmltest/qmltest.pro b/src/qmltest/qmltest.pro
index e2200e5abb..0bf05093be 100644
--- a/src/qmltest/qmltest.pro
+++ b/src/qmltest/qmltest.pro
@@ -4,7 +4,7 @@ QMAKE_DOCS = $$PWD/doc/qtqmltest.qdocconf
DEFINES += QT_NO_URL_CAST_FROM_STRING QT_NO_FOREACH
QT = core testlib-private
-QT_PRIVATE = quick qml-private gui core-private gui-private
+QT_PRIVATE = quick quick-private qml-private gui core-private gui-private
# Testlib is only a private dependency, which results in our users not
# inheriting testlibs's MODULE_CONFIG transitively. Make it explicit.
diff --git a/src/qmltest/quicktest.cpp b/src/qmltest/quicktest.cpp
index 22d329bb80..9cddf61543 100644
--- a/src/qmltest/quicktest.cpp
+++ b/src/qmltest/quicktest.cpp
@@ -44,10 +44,14 @@
#include <QtQml/qqml.h>
#include <QtQml/qqmlengine.h>
#include <QtQml/qqmlcontext.h>
+#include <QtQuick/private/qquickitem_p.h>
+#include <QtQuick/qquickitem.h>
#include <QtQuick/qquickview.h>
#include <QtQml/qjsvalue.h>
#include <QtQml/qjsengine.h>
#include <QtQml/qqmlpropertymap.h>
+#include <QtQuick/private/qquickitem_p.h>
+#include <QtQuick/qquickitem.h>
#include <QtGui/qopengl.h>
#include <QtCore/qurl.h>
#include <QtCore/qfileinfo.h>
@@ -73,6 +77,61 @@
QT_BEGIN_NAMESPACE
+/*!
+ \since 5.13
+
+ Returns \c true if \l {QQuickItem::}{updatePolish()} has not been called
+ on \a item since the last call to \l {QQuickItem::}{polish()},
+ otherwise returns \c false.
+
+ When assigning values to properties in QML, any layouting the item
+ must do as a result of the assignment might not take effect immediately,
+ but can instead be postponed until the item is polished. For these cases,
+ you can use this function to ensure that the item has been polished
+ before the execution of the test continues. For example:
+
+ \code
+ QVERIFY(QQuickTest::qIsPolishScheduled(item));
+ QVERIFY(QQuickTest::qWaitForItemPolished(item));
+ \endcode
+
+ Without the call to \c qIsPolishScheduled() above, the
+ call to \c qWaitForItemPolished() might see that no polish
+ was scheduled and therefore pass instantly, assuming that
+ the item had already been polished. This function
+ makes it obvious why an item wasn't polished and allows tests to
+ fail early under such circumstances.
+
+ The QML equivalent of this function is
+ \l {TestCase::}{isPolishScheduled()}.
+
+ \sa QQuickItem::polish(), QQuickItem::updatePolish()
+*/
+bool QQuickTest::qIsPolishScheduled(const QQuickItem *item)
+{
+ return QQuickItemPrivate::get(item)->polishScheduled;
+}
+
+/*!
+ \since 5.13
+
+ Waits for \a timeout milliseconds or until
+ \l {QQuickItem::}{updatePolish()} has been called on \a item.
+
+ Returns \c true if \c updatePolish() was called on \a item within
+ \a timeout milliseconds, otherwise returns \c false.
+
+ The QML equivalent of this function is
+ \l {TestCase::}{waitForItemPolished()}.
+
+ \sa QQuickItem::polish(), QQuickItem::updatePolish(),
+ QQuickTest::qIsPolishScheduled()
+*/
+bool QQuickTest::qWaitForItemPolished(const QQuickItem *item, int timeout)
+{
+ return QTest::qWaitFor([&]() { return !QQuickItemPrivate::get(item)->polishScheduled; }, timeout);
+}
+
class QTestRootObject : public QObject
{
Q_OBJECT
diff --git a/src/qmltest/quicktest.h b/src/qmltest/quicktest.h
index 62ed749722..8e3510c9a5 100644
--- a/src/qmltest/quicktest.h
+++ b/src/qmltest/quicktest.h
@@ -45,7 +45,7 @@
QT_BEGIN_NAMESPACE
-QTEST_ADD_GPU_BLACKLIST_SUPPORT_DEFS
+class QQuickItem;
Q_QUICK_TEST_EXPORT int quick_test_main(int argc, char **argv, const char *name, const char *sourceDir);
Q_QUICK_TEST_EXPORT int quick_test_main_with_setup(int argc, char **argv, const char *name, const char *sourceDir, QObject *setup);
@@ -55,7 +55,6 @@ Q_QUICK_TEST_EXPORT int quick_test_main_with_setup(int argc, char **argv, const
#define QUICK_TEST_MAIN(name) \
int main(int argc, char **argv) \
{ \
- QTEST_ADD_GPU_BLACKLIST_SUPPORT \
QTEST_SET_MAIN_SOURCE_PATH \
return quick_test_main(argc, argv, #name, QUICK_TEST_SOURCE_DIR); \
}
@@ -63,7 +62,6 @@ Q_QUICK_TEST_EXPORT int quick_test_main_with_setup(int argc, char **argv, const
#define QUICK_TEST_OPENGL_MAIN(name) \
int main(int argc, char **argv) \
{ \
- QTEST_ADD_GPU_BLACKLIST_SUPPORT \
QTEST_SET_MAIN_SOURCE_PATH \
return quick_test_main(argc, argv, #name, QUICK_TEST_SOURCE_DIR); \
}
@@ -71,7 +69,6 @@ Q_QUICK_TEST_EXPORT int quick_test_main_with_setup(int argc, char **argv, const
#define QUICK_TEST_MAIN_WITH_SETUP(name, QuickTestSetupClass) \
int main(int argc, char **argv) \
{ \
- QTEST_ADD_GPU_BLACKLIST_SUPPORT \
QTEST_SET_MAIN_SOURCE_PATH \
QuickTestSetupClass setup; \
return quick_test_main_with_setup(argc, argv, #name, QUICK_TEST_SOURCE_DIR, &setup); \
@@ -82,7 +79,6 @@ Q_QUICK_TEST_EXPORT int quick_test_main_with_setup(int argc, char **argv, const
#define QUICK_TEST_MAIN(name) \
int main(int argc, char **argv) \
{ \
- QTEST_ADD_GPU_BLACKLIST_SUPPORT \
QTEST_SET_MAIN_SOURCE_PATH \
return quick_test_main(argc, argv, #name, nullptr); \
}
@@ -90,7 +86,6 @@ Q_QUICK_TEST_EXPORT int quick_test_main_with_setup(int argc, char **argv, const
#define QUICK_TEST_OPENGL_MAIN(name) \
int main(int argc, char **argv) \
{ \
- QTEST_ADD_GPU_BLACKLIST_SUPPORT \
QTEST_SET_MAIN_SOURCE_PATH \
return quick_test_main(argc, argv, #name, nullptr); \
}
@@ -98,7 +93,6 @@ Q_QUICK_TEST_EXPORT int quick_test_main_with_setup(int argc, char **argv, const
#define QUICK_TEST_MAIN_WITH_SETUP(name, QuickTestSetupClass) \
int main(int argc, char **argv) \
{ \
- QTEST_ADD_GPU_BLACKLIST_SUPPORT \
QTEST_SET_MAIN_SOURCE_PATH \
QuickTestSetupClass setup; \
return quick_test_main_with_setup(argc, argv, #name, nullptr, &setup); \
@@ -106,6 +100,11 @@ Q_QUICK_TEST_EXPORT int quick_test_main_with_setup(int argc, char **argv, const
#endif
+namespace QQuickTest {
+Q_QUICK_TEST_EXPORT bool qIsPolishScheduled(const QQuickItem *item);
+Q_QUICK_TEST_EXPORT bool qWaitForItemPolished(const QQuickItem *item, int timeout = 5000);
+}
+
QT_END_NAMESPACE
#endif
diff --git a/src/qmltest/quicktestresult.cpp b/src/qmltest/quicktestresult.cpp
index 3225dc95cd..4dbec585c4 100644
--- a/src/qmltest/quicktestresult.cpp
+++ b/src/qmltest/quicktestresult.cpp
@@ -39,6 +39,7 @@
****************************************************************************/
#include "quicktestresult_p.h"
+#include "quicktest.h"
#include <QtTest/qtestcase.h>
#include <QtTest/qtestsystem.h>
#include <QtTest/private/qtestblacklist_p.h>
@@ -787,6 +788,16 @@ QObject *QuickTestResult::findChild(QObject *parent, const QString &objectName)
return parent ? parent->findChild<QObject*>(objectName) : 0;
}
+bool QuickTestResult::isPolishScheduled(QQuickItem *item) const
+{
+ return QQuickTest::qIsPolishScheduled(item);
+}
+
+bool QuickTestResult::waitForItemPolished(QQuickItem *item, int timeout)
+{
+ return QQuickTest::qWaitForItemPolished(item, timeout);
+}
+
namespace QTest {
void qtest_qParseArgs(int argc, char *argv[], bool qml);
};
@@ -802,7 +813,6 @@ void QuickTestResult::setProgramName(const char *name)
{
if (name) {
QTestPrivate::parseBlackList();
- QTestPrivate::parseGpuBlackList();
QTestResult::reset();
} else if (!name && loggingStarted) {
QTestResult::setCurrentTestObject(globalProgramName);
@@ -829,7 +839,7 @@ int QuickTestResult::exitCode()
#endif
}
+QT_END_NAMESPACE
+
#include "quicktestresult.moc"
#include "moc_quicktestresult_p.cpp"
-
-QT_END_NAMESPACE
diff --git a/src/qmltest/quicktestresult_p.h b/src/qmltest/quicktestresult_p.h
index b2eeefdfff..3643826e5d 100644
--- a/src/qmltest/quicktestresult_p.h
+++ b/src/qmltest/quicktestresult_p.h
@@ -160,6 +160,9 @@ public Q_SLOTS:
Q_REVISION(1) QObject *findChild(QObject *parent, const QString &objectName);
+ Q_REVISION(13) bool isPolishScheduled(QQuickItem *item) const;
+ Q_REVISION(13) bool waitForItemPolished(QQuickItem *item, int timeout);
+
public:
// Helper functions for the C++ main() shell.
static void parseArgs(int argc, char *argv[]);