summaryrefslogtreecommitdiffstats
path: root/tests/auto/other
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2021-07-31 18:25:42 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2021-08-04 19:31:51 +0200
commitbef57b317f2efc0e73f2275d594be9d69f5a75d0 (patch)
treefc277768e0812c65c5a860a2971b859a833c5088 /tests/auto/other
parentfe9c705e9aa0e25760646695820bd876de590893 (diff)
testlib: Deprecate QWARN() in favor of qWarning()
The QtTest best practices documentations recommends using output mechanisms such as qDebug() and qWarning() for diagnostic messages, and this is also what most of our own tests do. The QWARN() macro and corresponding internal QTest::qWarn() function was added when QtTest was first implemented, but was likely meant as an internal implementation detail, like its cousin QTestLog::info(), which does not have any corresponding macro. This theory is backed by our own QtTest self-test (tst_silent) describing the output from QWARN() as "an internal testlib warning". The only difference between QWARN() and qWarning(), besides the much richer feature set of the latter, is that qWarning() will not pass on file and line number information in release mode, but QWARN() will. This is an acceptable loss of functionality, considering that the user can override this behavior by defining QT_MESSAGELOGCONTEXT. [ChangeLog][QtTest] QWARN() has been deprecated in favor of qWarning() Pick-to: 6.2 Change-Id: I5a2431ce48c47392244560dd520953b9fc735c85 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/other')
-rw-r--r--tests/auto/other/lancelot/tst_lancelot.cpp2
-rw-r--r--tests/auto/other/qfocusevent/tst_qfocusevent.cpp4
2 files changed, 3 insertions, 3 deletions
diff --git a/tests/auto/other/lancelot/tst_lancelot.cpp b/tests/auto/other/lancelot/tst_lancelot.cpp
index 407b14be94..6ed3b83e83 100644
--- a/tests/auto/other/lancelot/tst_lancelot.cpp
+++ b/tests/auto/other/lancelot/tst_lancelot.cpp
@@ -127,7 +127,7 @@ void tst_Lancelot::initTestCase()
QDir qpsDir(scriptsDir);
qpsFiles = qpsDir.entryList(QStringList() << QLatin1String("*.qps"), QDir::Files | QDir::Readable);
if (qpsFiles.isEmpty()) {
- QWARN("No qps script files found in " + qpsDir.path().toLatin1());
+ qWarning() << "No qps script files found in" << qpsDir.path();
QSKIP("Aborted due to errors.");
}
diff --git a/tests/auto/other/qfocusevent/tst_qfocusevent.cpp b/tests/auto/other/qfocusevent/tst_qfocusevent.cpp
index 08dcceb39b..cd00f4cc9c 100644
--- a/tests/auto/other/qfocusevent/tst_qfocusevent.cpp
+++ b/tests/auto/other/qfocusevent/tst_qfocusevent.cpp
@@ -344,7 +344,7 @@ void tst_QFocusEvent::checkReason_ActiveWindow()
#if defined(Q_OS_WIN)
if (QSysInfo::kernelVersion() == "10.0.15063") {
// Activate window of testFocusWidget, focus in that window goes to childFocusWidgetOne
- QWARN("Windows 10 Creators Update (10.0.15063) requires explicit activateWindow()");
+ qWarning("Windows 10 Creators Update (10.0.15063) requires explicit activateWindow()");
testFocusWidget->activateWindow();
}
#endif
@@ -359,7 +359,7 @@ void tst_QFocusEvent::checkReason_ActiveWindow()
if (!QGuiApplication::platformName().compare(QLatin1String("offscreen"), Qt::CaseInsensitive)
|| !QGuiApplication::platformName().compare(QLatin1String("minimal"), Qt::CaseInsensitive)) {
// Activate window of testFocusWidget, focus in that window goes to childFocusWidgetOne
- QWARN("Platforms offscreen and minimal require explicit activateWindow()");
+ qWarning("Platforms offscreen and minimal require explicit activateWindow()");
testFocusWidget->activateWindow();
}