diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2022-02-18 14:12:06 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2022-02-19 20:13:53 +0100 |
commit | 6391a379bfc040d31c5980394acb42a2c3d2b866 (patch) | |
tree | 5d33067f688269349a34ced3aa70ce443915d5cc | |
parent | a22656bfd105baf7bf252d6734f2d76c1678d406 (diff) | |
download | qtbase-6391a379bfc040d31c5980394acb42a2c3d2b866.tar.gz |
Fix test to pass with QT_FORCE_ASSERTS
Add QT_FORCE_ASSERTS to condition with standard comment.
Change-Id: If493c7cdea8164f010228a755915a211c1cf1b39
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 1af068332bd8a834ae684cfa8c586f71f7e7bd28)
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r-- | tests/auto/corelib/itemmodels/qsortfilterproxymodel_common/tst_qsortfilterproxymodel.cpp | 3 | ||||
-rw-r--r-- | tests/auto/widgets/widgets/qabstractspinbox/tst_qabstractspinbox.cpp | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel_common/tst_qsortfilterproxymodel.cpp b/tests/auto/corelib/itemmodels/qsortfilterproxymodel_common/tst_qsortfilterproxymodel.cpp index 6da65e59e8..535bd0db2b 100644 --- a/tests/auto/corelib/itemmodels/qsortfilterproxymodel_common/tst_qsortfilterproxymodel.cpp +++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel_common/tst_qsortfilterproxymodel.cpp @@ -3196,7 +3196,8 @@ void tst_QSortFilterProxyModel::mapFromToSource() QCOMPARE(proxy.mapFromSource(QModelIndex()), QModelIndex()); QCOMPARE(proxy.mapToSource(QModelIndex()), QModelIndex()); -#ifdef QT_NO_DEBUG //if Qt is compiled in debug mode, this will assert + // Will assert in debug, so only test in release +#if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) QTest::ignoreMessage(QtWarningMsg, "QSortFilterProxyModel: index from wrong model passed to mapToSource"); QCOMPARE(proxy.mapToSource(source.index(2, 3)), QModelIndex()); QTest::ignoreMessage(QtWarningMsg, "QSortFilterProxyModel: index from wrong model passed to mapFromSource"); diff --git a/tests/auto/widgets/widgets/qabstractspinbox/tst_qabstractspinbox.cpp b/tests/auto/widgets/widgets/qabstractspinbox/tst_qabstractspinbox.cpp index 6898cf18dc..23effb60a5 100644 --- a/tests/auto/widgets/widgets/qabstractspinbox/tst_qabstractspinbox.cpp +++ b/tests/auto/widgets/widgets/qabstractspinbox/tst_qabstractspinbox.cpp @@ -115,8 +115,9 @@ void tst_QAbstractSpinBox::getSetCheck() QLineEdit *var3 = new QLineEdit(0); obj1.setLineEdit(var3); QCOMPARE(var3, obj1.lineEdit()); -#ifndef QT_DEBUG - obj1.setLineEdit((QLineEdit *)0); // Will assert in debug, so only test in release + // Will assert in debug, so only test in release +#if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) + obj1.setLineEdit(nullptr); QCOMPARE(var3, obj1.lineEdit()); // Setting 0 should keep the current editor #endif // delete var3; // No delete, since QAbstractSpinBox takes ownership |