diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2018-12-06 12:15:30 +0100 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2018-12-10 10:45:21 +0000 |
commit | 028617688b0f86ac057248470563a09414fc0ef0 (patch) | |
tree | 02d618314ebd33f2d5a26204579f7c9f088cf817 /src/qmltest | |
parent | 50f234df500829a0023ed5d396c486f995ad71ef (diff) |
TestCase: add isPolishScheduled() and waitForItemPolished()
These were introduced to the C++ QQuickTest namespace in 40d6072b and
7a3cad06, respectively. QML-only tests should also have access to them.
[ChangeLog][QtQuickTest][TestCase] Added isPolishScheduled()
function to allow checking if updatePolish() has been called on
an item since the last call to its polish() function.
This is useful to verify that a polish has been scheduled.
[ChangeLog][QtQuickTest][TestCase] Added waitForItemPolished()
for verifying that updatePolish() was called on an item.
Change-Id: I3e3a488197e74546358e2d5b0da7a902793c1954
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/qmltest')
-rw-r--r-- | src/qmltest/quicktestresult.cpp | 11 | ||||
-rw-r--r-- | src/qmltest/quicktestresult_p.h | 3 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/qmltest/quicktestresult.cpp b/src/qmltest/quicktestresult.cpp index 1cc4705e56..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); }; diff --git a/src/qmltest/quicktestresult_p.h b/src/qmltest/quicktestresult_p.h index b2eeefdfff..0659919a39 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); + bool isPolishScheduled(QQuickItem *item) const; + bool waitForItemPolished(QQuickItem *item, int timeout); + public: // Helper functions for the C++ main() shell. static void parseArgs(int argc, char *argv[]); |