diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2022-06-07 10:23:31 +0800 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2022-07-05 14:34:37 +0800 |
commit | 234afb5502ab20b4f58ddd9b01a4245330a7e5a4 (patch) | |
tree | 44f3bea37e8fd6abddf5f7d26095373c7dd0b44f /tests/auto/quickdialogs | |
parent | 7112b4e0cc9b7625288d0464c02d92390ab0f193 (diff) |
Add convenience API for making QQmlDataTest-based tests fail on warnings
After this patch, if a QQmlDataTest-derived class passes
FailOnWarningsPolicy::FailOnWarnings to the base constructor, any
non-empty warning encountered by that test will result in a test
failure.
This avoids the need to duplicate the catch-all regex in tests that
want to fail on warnings.
The goal is to gradually enable failure-on-warnings over time.
Leave comments and explicitly pass DoNotFailOnWarnings for tests that
should never fail on warnings.
Task-number: QTBUG-98718
Pick-to: 6.2 6.3 6.4
Change-Id: I4b647d93a0f28ac891c4bdb19ef74569f2918e8f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests/auto/quickdialogs')
3 files changed, 15 insertions, 3 deletions
diff --git a/tests/auto/quickdialogs/qquickfiledialogimpl/tst_qquickfiledialogimpl.cpp b/tests/auto/quickdialogs/qquickfiledialogimpl/tst_qquickfiledialogimpl.cpp index 2a72bea9af..93ca308338 100644 --- a/tests/auto/quickdialogs/qquickfiledialogimpl/tst_qquickfiledialogimpl.cpp +++ b/tests/auto/quickdialogs/qquickfiledialogimpl/tst_qquickfiledialogimpl.cpp @@ -106,8 +106,11 @@ private: const QKeySequence editPathKeySequence = QKeySequence(Qt::CTRL | Qt::Key_L); }; +// We don't want to fail on warnings until QTBUG-98964 is fixed, +// as we deliberately prevent deferred execution in some of the tests here, +// which causes warnings. tst_QQuickFileDialogImpl::tst_QQuickFileDialogImpl() - : QQmlDataTest(QT_QMLTEST_DATADIR) + : QQmlDataTest(QT_QMLTEST_DATADIR, FailOnWarningsPolicy::DoNotFailOnWarnings) { } diff --git a/tests/auto/quickdialogs/qquickfontdialogimpl/tst_qquickfontdialogimpl.cpp b/tests/auto/quickdialogs/qquickfontdialogimpl/tst_qquickfontdialogimpl.cpp index e2398ba254..78a0060824 100644 --- a/tests/auto/quickdialogs/qquickfontdialogimpl/tst_qquickfontdialogimpl.cpp +++ b/tests/auto/quickdialogs/qquickfontdialogimpl/tst_qquickfontdialogimpl.cpp @@ -108,8 +108,11 @@ private: QVERIFY2(closePopup(&dialogHelper, BUTTON, errorMessage), qPrintable(errorMessage)); \ QTRY_VERIFY(!dialogHelper.quickDialog->isVisible()); +// We don't want to fail on warnings until QTBUG-98964 is fixed, +// as we deliberately prevent deferred execution in some of the tests here, +// which causes warnings. tst_QQuickFontDialogImpl::tst_QQuickFontDialogImpl() - : QQmlDataTest(QT_QMLTEST_DATADIR) + : QQmlDataTest(QT_QMLTEST_DATADIR, FailOnWarningsPolicy::DoNotFailOnWarnings) { } diff --git a/tests/auto/quickdialogs/qquickmessagedialogimpl/tst_qquickmessagedialogimpl.cpp b/tests/auto/quickdialogs/qquickmessagedialogimpl/tst_qquickmessagedialogimpl.cpp index d2ca9c4711..93b29d6a16 100644 --- a/tests/auto/quickdialogs/qquickmessagedialogimpl/tst_qquickmessagedialogimpl.cpp +++ b/tests/auto/quickdialogs/qquickmessagedialogimpl/tst_qquickmessagedialogimpl.cpp @@ -41,7 +41,13 @@ private slots: void detailedText(); }; -tst_QQuickMessageDialogImpl::tst_QQuickMessageDialogImpl() : QQmlDataTest(QT_QMLTEST_DATADIR) { } +// We don't want to fail on warnings until QTBUG-98964 is fixed, +// as we deliberately prevent deferred execution in some of the tests here, +// which causes warnings. +tst_QQuickMessageDialogImpl::tst_QQuickMessageDialogImpl() + : QQmlDataTest(QT_QMLTEST_DATADIR, FailOnWarningsPolicy::DoNotFailOnWarnings) +{ +} void tst_QQuickMessageDialogImpl::changeText_data() { |