QQuickTest Namespace
Functions
bool | qIsPolishScheduled(const QQuickItem *item) |
bool | qWaitForItemPolished(const QQuickItem *item, int timeout = 5000) |
Function Documentation
bool QQuickTest::qIsPolishScheduled(const QQuickItem *item)
Returns true
if updatePolish() has not been called on item since the last call to polish(), otherwise returns 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:
QVERIFY(QQuickTest::qIsPolishScheduled(item)); QVERIFY(QQuickTest::qWaitForItemPolished(item));
Without the call to qIsPolishScheduled()
above, the call to 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 isPolishScheduled().
This function was introduced in Qt 5.13.
See also QQuickItem::polish() and QQuickItem::updatePolish().
bool QQuickTest::qWaitForItemPolished(const QQuickItem *item, int timeout = 5000)
Waits for timeout milliseconds or until updatePolish() has been called on item.
Returns true
if updatePolish()
was called on item within timeout milliseconds, otherwise returns false
.
The QML equivalent of this function is waitForItemPolished().
This function was introduced in Qt 5.13.
See also QQuickItem::polish(), QQuickItem::updatePolish(), and QQuickTest::qIsPolishScheduled().