summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2021-09-21 16:32:47 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2021-09-23 16:57:03 +0200
commit78c8f0cd4d0df7feaa1f3128b085565961be875d (patch)
treea058fb588dcf1f44e4d9542ee1bad1119dd37015
parent5b525e8e54384600b92415b08b5ec94020faf40c (diff)
Deprecate QTest::qWarn() and replace its last use
The one place that actually called it with file and line number was internal to QtTest, so could call QtTestLog::warn(). Change-Id: I8be10fc81996cc3de4d2eea3ecedc59671ffe759 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
-rw-r--r--src/testlib/qtestcase.cpp8
-rw-r--r--src/testlib/qtestcase.h16
2 files changed, 10 insertions, 14 deletions
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index aec7b986a9..ce10b0a8eb 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -2064,12 +2064,16 @@ bool QTest::qExpectFail(const char *dataIndex, const char *comment,
return QTestResult::expectFail(dataIndex, qstrdup(comment), mode, file, line);
}
-/*! \internal
+#if QT_DEPRECATED_SINCE(6, 3)
+/*!
+ \internal
+ \deprecated [6.3] Use qWarning() instead
*/
void QTest::qWarn(const char *message, const char *file, int line)
{
QTestLog::warn(message, file, line);
}
+#endif
/*!
Ignores messages created by qDebug(), qInfo() or qWarning(). If the \a message
@@ -2315,7 +2319,7 @@ QString QTest::qFindTestData(const QString& base, const char *file, int line, co
if (found.isEmpty()) {
- QTest::qWarn(qPrintable(
+ QTestLog::warn(qPrintable(
QString::fromLatin1("testdata %1 could not be located!").arg(base)),
file, line);
} else if (QTestLog::verboseLevel() >= 1) {
diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h
index 55419551fa..1541afc084 100644
--- a/src/testlib/qtestcase.h
+++ b/src/testlib/qtestcase.h
@@ -311,7 +311,10 @@ namespace QTest
Q_TESTLIB_EXPORT void qSkip(const char *message, const char *file, int line);
Q_TESTLIB_EXPORT bool qExpectFail(const char *dataIndex, const char *comment, TestFailMode mode,
const char *file, int line);
+#if QT_DEPRECATED_SINCE(6, 3)
+ QT_DEPRECATED_VERSION_X_6_3("Use qWarning() instead")
Q_TESTLIB_EXPORT void qWarn(const char *message, const char *file = nullptr, int line = 0);
+#endif
Q_TESTLIB_EXPORT void ignoreMessage(QtMsgType type, const char *message);
#if QT_CONFIG(regularexpression)
Q_TESTLIB_EXPORT void ignoreMessage(QtMsgType type, const QRegularExpression &messagePattern);
@@ -573,18 +576,7 @@ namespace QTest
#undef QTEST_COMPARE_DECL
-#if QT_DEPRECATED_SINCE(6, 2)
-namespace QTestPrivate {
-QT_DEPRECATED_VERSION_X_6_2("Use qWarning() instead")
-Q_DECL_UNUSED static inline void qWarnMacro(const char *message, const char *file = nullptr, int line = 0)
-{
- QTest::qWarn(message, file, line);
-}
-}
-#endif
-
-#define QWARN(msg) \
- QTestPrivate::qWarnMacro(static_cast<const char *>(msg), __FILE__, __LINE__)
+#define QWARN(msg) QTest::qWarn(static_cast<const char *>(msg), __FILE__, __LINE__)
QT_END_NAMESPACE