diff options
| author | Mitch Curtis <mitch.curtis@qt.io> | 2021-06-19 11:30:54 +0200 |
|---|---|---|
| committer | Mitch Curtis <mitch.curtis@qt.io> | 2022-06-02 12:46:11 +0800 |
| commit | 36c6c1ea57ad503a2f42fe81a12d1254fcd38cca (patch) | |
| tree | af9fee349b18b0c92c3620525d683decb57e2098 /tests/auto/quickdialogs/qquickfolderdialogimpl/tst_qquickfolderdialogimpl.cpp | |
| parent | 4a32ceec401b772cc0335f03310e714555b6e9c2 (diff) | |
QtQuickTest: add API for checking for polish at window level
This adds a qIsPolishScheduled(QQuickWindow *) overload of
qIsPolishScheduled(QQuickItem *) (added in
40d6072bc8a4df0fe1a16025fe30fe653463a446) and deprecates
qWaitForItemPolished() (added in
7a3cad0619662b992154e075ec6b840bfc8a46a7) in favor of qWaitForPolish(),
which has QQuickItem* and QQuickWindow* overloads.
The existing functions that take QQuickItem are useful, but testing
Qt Quick applications can be made even easier by allowing users to
check if a window has any items that need to be polished. This
information is already present (in QQuickWindowPrivate::itemsToPolish),
so it's very efficient to check for.
This is especially useful now that Qt Quick Layouts using polishing for
their layouting, for example, as it's no longer necessary to find
individual polishable items in complex hierarchies before proceeding
to interact with child items.
[ChangeLog][QtQuickTest][QQuickTest] Added
QQuickTest::qIsPolishScheduled(QQuickWindow *) and
QQuickTest::qWaitForPolish(QQuickWindow *) functions for verifying that
updatePolish() was called on one or more items managed by a window.
[ChangeLog][QtQuickTest][QQuickTest] Deprecated
QQuickTest::qWaitForItemPolished(QQuickItem *). Use the new
QQuickTest::qWaitForPolish(QQuickItem *) function instead.
Fixes: QTBUG-93757
Change-Id: I95b6e051b3c9fd2fa93604f4d9ccda486bb29f9d
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'tests/auto/quickdialogs/qquickfolderdialogimpl/tst_qquickfolderdialogimpl.cpp')
| -rw-r--r-- | tests/auto/quickdialogs/qquickfolderdialogimpl/tst_qquickfolderdialogimpl.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/auto/quickdialogs/qquickfolderdialogimpl/tst_qquickfolderdialogimpl.cpp b/tests/auto/quickdialogs/qquickfolderdialogimpl/tst_qquickfolderdialogimpl.cpp index eadb355e82..4dccbac05c 100644 --- a/tests/auto/quickdialogs/qquickfolderdialogimpl/tst_qquickfolderdialogimpl.cpp +++ b/tests/auto/quickdialogs/qquickfolderdialogimpl/tst_qquickfolderdialogimpl.cpp @@ -496,7 +496,7 @@ void tst_QQuickFolderDialogImpl::goUp() auto barListView = qobject_cast<QQuickListView*>(breadcrumbBar->contentItem()); QVERIFY(barListView); if (QQuickTest::qIsPolishScheduled(barListView)) - QVERIFY(QQuickTest::qWaitForItemPolished(barListView)); + QVERIFY(QQuickTest::qWaitForPolish(barListView)); QVERIFY(clickButton(breadcrumbBar->upButton())); COMPARE_URL(dialogHelper.dialog->currentFolder(), QUrl::fromLocalFile(tempDir.path())); // The previous directory that we were in should now be selected (matches e.g. Windows and Ubuntu). @@ -532,7 +532,7 @@ void tst_QQuickFolderDialogImpl::goUpWhileTextEditHasFocus() auto barListView = qobject_cast<QQuickListView*>(breadcrumbBar->contentItem()); QVERIFY(barListView); if (QQuickTest::qIsPolishScheduled(barListView)) - QVERIFY(QQuickTest::qWaitForItemPolished(barListView)); + QVERIFY(QQuickTest::qWaitForPolish(barListView)); QVERIFY(clickButton(breadcrumbBar->upButton())); // The path should have changed to the parent directory. COMPARE_URL(dialogHelper.dialog->currentFolder(), QUrl::fromLocalFile(tempDir.path())); @@ -582,7 +582,7 @@ void tst_QQuickFolderDialogImpl::goIntoLargeFolder() auto folderDialogListView = dialogHelper.quickDialog->findChild<QQuickListView*>("folderDialogListView"); QVERIFY(folderDialogListView); if (QQuickTest::qIsPolishScheduled(folderDialogListView)) - QVERIFY(QQuickTest::qWaitForItemPolished(folderDialogListView)); + QVERIFY(QQuickTest::qWaitForPolish(folderDialogListView)); // Just to be safe, make sure it's at least twice as big. if (folderDialogListView->contentItem()->height() < folderDialogListView->height() * 2) { QSKIP(qPrintable(QString::fromLatin1("Expected height of folderDialogListView's contentItem (%1)" \ |
