Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-93757

Add API to QQuickTest that checks if windows have any items to be polished

    XMLWordPrintable

    Details

    • Type: Suggestion
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 6.4.0 Beta1, 6.5.0 FF
    • Component/s: Testing: QuickTest
    • Labels:
      None
    • Commits:
      36c6c1ea57 (qt/qtdeclarative/dev)

      Description

      After QTBUG-71224, QQuickTest::qWaitForItemPolished() and QQuickTest::qIsPolishScheduled() were added. These are useful, but testing Qt Quick applications could 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, so it's very efficient to check for.

      This would greatly simplify testing of Qt Quick applications, especially now that Qt Quick Layouts using polishing for their layouting, for example.

      In terms of naming, we could either be consistent with the existing API:

      diff --git a/src/qmltest/quicktest.h b/src/qmltest/quicktest.h
      index 8e3510c9a5..14d9fb9783 100644
      --- a/src/qmltest/quicktest.h
      +++ b/src/qmltest/quicktest.h
      @@ -102,7 +102,9 @@ Q_QUICK_TEST_EXPORT int quick_test_main_with_setup(int argc, char **argv, const
       
       namespace QQuickTest {
       Q_QUICK_TEST_EXPORT bool qIsPolishScheduled(const QQuickItem *item);
      +Q_QUICK_TEST_EXPORT bool qIsPolishScheduled(const QQuickWindow *window);
       Q_QUICK_TEST_EXPORT bool qWaitForItemPolished(const QQuickItem *item, int timeout = 5000);
      +Q_QUICK_TEST_EXPORT bool qWaitForWindowPolished(const QQuickWindow *window, int timeout = 5000);
       }
       
       QT_END_NAMESPACE
      

      Or take the opportunity to consistently use overloads:

      diff --git a/src/qmltest/quicktest.h b/src/qmltest/quicktest.h
      index 8e3510c9a5..4b796b6a84 100644
      --- a/src/qmltest/quicktest.h
      +++ b/src/qmltest/quicktest.h
      @@ -102,7 +102,15 @@ Q_QUICK_TEST_EXPORT int quick_test_main_with_setup(int argc, char **argv, const
       
       namespace QQuickTest {
       Q_QUICK_TEST_EXPORT bool qIsPolishScheduled(const QQuickItem *item);
      -Q_QUICK_TEST_EXPORT bool qWaitForItemPolished(const QQuickItem *item, int timeout = 5000);
      +Q_QUICK_TEST_EXPORT bool qIsPolishScheduled(const QQuickWindow *window);
      +#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
      +#if QT_DEPRECATED_SINCE(6, 4)
      +    QT_DEPRECATED_X("Use qWaitForPolish(QQuickItem *) instead")
      +    Q_QUICK_TEST_EXPORT bool qWaitForItemPolished(const QQuickItem *item, int timeout = 5000);
      +#endif
      +#endif
      +Q_QUICK_TEST_EXPORT bool qWaitForPolish(const QQuickItem *item, int timeout = 5000);
      +Q_QUICK_TEST_EXPORT bool qWaitForPolish(const QQuickWindow *window, int timeout = 5000);
       }
       
       QT_END_NAMESPACE
      

      Or take the opportunity to consistently use distinctly named functions:

      diff --git a/src/qmltest/quicktest.h b/src/qmltest/quicktest.h
      index 8e3510c9a5..80016deb15 100644
      --- a/src/qmltest/quicktest.h
      +++ b/src/qmltest/quicktest.h
      @@ -101,8 +101,16 @@ 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);
      +#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
      +#if QT_DEPRECATED_SINCE(6, 4)
      +    QT_DEPRECATED_X("Use qIsItemPolishScheduled() or qIsWindowPolishScheduled() instead")
      +    Q_QUICK_TEST_EXPORT bool qIsPolishScheduled(const QQuickItem *item);
      +#endif
      +#endif
      +Q_QUICK_TEST_EXPORT bool qIsItemPolishScheduled(const QQuickItem *item);
      +Q_QUICK_TEST_EXPORT bool qIsWindowPolishScheduled(const QQuickWindow *window);
       Q_QUICK_TEST_EXPORT bool qWaitForItemPolished(const QQuickItem *item, int timeout = 5000);
      +Q_QUICK_TEST_EXPORT bool qWaitForWindowPolished(const QQuickWindow *window, int timeout = 5000);
       }
       
       QT_END_NAMESPACE
      

        Attachments

          Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Activity

              People

              Assignee:
              mitch_curtis Mitch Curtis
              Reporter:
              mitch_curtis Mitch Curtis
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes