From bef57b317f2efc0e73f2275d594be9d69f5a75d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Sat, 31 Jul 2021 18:25:42 +0200 Subject: [PATCH] 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 --- src/testlib/qtestcase.h | 16 +++++++++++++--- src/testlib/qtestcase.qdoc | 1 + .../auto/corelib/io/largefile/tst_largefile.cpp | 11 +++++------ .../auto/corelib/io/qfileinfo/tst_qfileinfo.cpp | 6 +++--- .../auto/corelib/io/qsettings/tst_qsettings.cpp | 2 +- .../tst_qstring_no_cast_from_bytearray.cpp | 2 +- tests/auto/gui/kernel/qwindow/tst_qwindow.cpp | 4 ++-- .../auto/gui/painting/qpainter/tst_qpainter.cpp | 6 +++--- .../ssl/qsslcertificate/tst_qsslcertificate.cpp | 2 +- tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp | 2 +- tests/auto/other/lancelot/tst_lancelot.cpp | 2 +- tests/auto/other/qfocusevent/tst_qfocusevent.cpp | 4 ++-- .../auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp | 6 +++--- .../selftests/blacklisted/tst_blacklisted.cpp | 2 +- .../testlib/selftests/expected_junit.junitxml | 4 ++-- tests/auto/testlib/selftests/junit/tst_junit.cpp | 2 +- .../auto/testlib/selftests/silent/tst_silent.cpp | 2 +- tests/auto/tools/rcc/tst_rcc.cpp | 6 ++---- .../dialogs/qfontdialog/tst_qfontdialog.cpp | 2 +- .../qgraphicsscene/tst_qgraphicsscene.cpp | 2 +- .../qabstractitemview/tst_qabstractitemview.cpp | 2 +- .../widgets/widgets/qcombobox/tst_qcombobox.cpp | 2 +- .../qdoublespinbox/tst_qdoublespinbox.cpp | 4 ++-- tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp | 2 +- .../widgets/widgets/qmenubar/tst_qmenubar.cpp | 2 +- .../gui/painting/lancebench/tst_lancebench.cpp | 2 +- 26 files changed, 53 insertions(+), 45 deletions(-) diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h index 158fce4e3d..55419551fa 100644 --- a/src/testlib/qtestcase.h +++ b/src/testlib/qtestcase.h @@ -208,9 +208,6 @@ do {\ return;\ } while (false) -#define QWARN(msg)\ - QTest::qWarn(static_cast(msg), __FILE__, __LINE__) - #ifdef QT_TESTCASE_BUILDDIR #ifndef QT_TESTCASE_SOURCEDIR @@ -576,6 +573,19 @@ 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(msg), __FILE__, __LINE__) + QT_END_NAMESPACE #endif diff --git a/src/testlib/qtestcase.qdoc b/src/testlib/qtestcase.qdoc index 2a480fb349..9950418a5c 100644 --- a/src/testlib/qtestcase.qdoc +++ b/src/testlib/qtestcase.qdoc @@ -336,6 +336,7 @@ \relates QTest \threadsafe + \deprecated Use qWarning() instead. Appends \a message as a warning to the test log. This macro can be used anywhere in your tests. diff --git a/tests/auto/corelib/io/largefile/tst_largefile.cpp b/tests/auto/corelib/io/largefile/tst_largefile.cpp index fcc0a31763..d05c5bca9f 100644 --- a/tests/auto/corelib/io/largefile/tst_largefile.cpp +++ b/tests/auto/corelib/io/largefile/tst_largefile.cpp @@ -299,7 +299,7 @@ void tst_LargeFile::createSparseFile() DWORD bytes; if (!::DeviceIoControl(handle, FSCTL_SET_SPARSE, NULL, 0, NULL, 0, &bytes, NULL)) { - QWARN("Unable to set test file as sparse. " + qWarning("Unable to set test file as sparse. " "Limiting test file to 16MiB."); maxSizeBits = 24; } @@ -347,11 +347,10 @@ void tst_LargeFile::fillFileSparsely() { if (failed) { this_->maxSizeBits = lastKnownGoodIndex; - QWARN( qPrintable( - QString("QFile::error %1: '%2'. Maximum size bits reset to %3.") - .arg(this_->largeFile.error()) - .arg(this_->largeFile.errorString()) - .arg(this_->maxSizeBits)) ); + qWarning("QFile::error %d: '%s'. Maximum size bits reset to %d.", + this_->largeFile.error(), + qPrintable(this_->largeFile.errorString()), + this_->maxSizeBits); } else lastKnownGoodIndex = qMax(index_, lastKnownGoodIndex); } diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp index 4d74fe4d98..461d2c03d4 100644 --- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp @@ -1360,7 +1360,7 @@ void tst_QFileInfo::isSymbolicLink_data() #if defined(Q_OS_WIN) const auto creationResult = FileSystem::createSymbolicLink("symlink", m_sourceFile); if (creationResult.dwErr == ERROR_PRIVILEGE_NOT_HELD) { - QWARN(msgInsufficientPrivileges(creationResult.errorMessage)); + qWarning() << qPrintable(msgInsufficientPrivileges(creationResult.errorMessage)); } else { QVERIFY2(creationResult.dwErr == ERROR_SUCCESS, qPrintable(creationResult.errorMessage)); QTest::newRow("NTFS-symlink") @@ -1423,7 +1423,7 @@ void tst_QFileInfo::link_data() #if defined(Q_OS_WIN) auto creationResult = FileSystem::createSymbolicLink("link", m_sourceFile); if (creationResult.dwErr == ERROR_PRIVILEGE_NOT_HELD) { - QWARN(msgInsufficientPrivileges(creationResult.errorMessage)); + qWarning() << qPrintable(msgInsufficientPrivileges(creationResult.errorMessage)); } else { QVERIFY2(creationResult.dwErr == ERROR_SUCCESS, qPrintable(creationResult.errorMessage)); QTest::newRow("link") @@ -1432,7 +1432,7 @@ void tst_QFileInfo::link_data() creationResult = FileSystem::createSymbolicLink("brokenlink", "dummyfile"); if (creationResult.dwErr == ERROR_PRIVILEGE_NOT_HELD) { - QWARN(msgInsufficientPrivileges(creationResult.errorMessage)); + qWarning() << qPrintable(msgInsufficientPrivileges(creationResult.errorMessage)); } else { QVERIFY2(creationResult.dwErr == ERROR_SUCCESS, qPrintable(creationResult.errorMessage)); QTest::newRow("broken link") diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp index 9ae8fcf61f..065e2b402b 100644 --- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp +++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp @@ -2073,7 +2073,7 @@ void SettingsThread::run() settings.setValue(QString::number((param * NumIterations) + i), param); settings.sync(); if (settings.status() != QSettings::NoError) { - QWARN(qPrintable(QString("Unexpected QSettings status %1").arg((int)settings.status()))); + qWarning() << qPrintable(QString("Unexpected QSettings status %1").arg((int)settings.status())); ++numThreadSafetyFailures; } } diff --git a/tests/auto/corelib/text/qstring_no_cast_from_bytearray/tst_qstring_no_cast_from_bytearray.cpp b/tests/auto/corelib/text/qstring_no_cast_from_bytearray/tst_qstring_no_cast_from_bytearray.cpp index dfd53bbb3a..8212eaac48 100644 --- a/tests/auto/corelib/text/qstring_no_cast_from_bytearray/tst_qstring_no_cast_from_bytearray.cpp +++ b/tests/auto/corelib/text/qstring_no_cast_from_bytearray/tst_qstring_no_cast_from_bytearray.cpp @@ -38,7 +38,7 @@ private Q_SLOTS: void tst_QString_NoCastFromByteArray::initTestCase() { - QWARN("This is a compile test only"); + qWarning("This is a compile test only"); } QTEST_APPLESS_MAIN(tst_QString_NoCastFromByteArray) diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp index f5fb92b32b..e4cee0e89c 100644 --- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp @@ -2063,7 +2063,7 @@ void tst_QWindow::modalDialog() QGuiApplication::processEvents(); if (isPlatformOffscreenOrMinimal()) { - QWARN("Focus stays in normalWindow on offscreen/minimal platforms"); + qWarning("Focus stays in normalWindow on offscreen/minimal platforms"); QTRY_COMPARE(QGuiApplication::focusWindow(), &normalWindow); return; } @@ -2109,7 +2109,7 @@ void tst_QWindow::modalDialogClosingOneOfTwoModal() QGuiApplication::processEvents(); if (isPlatformOffscreenOrMinimal()) { - QWARN("Focus is lost when closing modal dialog on offscreen/minimal platforms"); + qWarning("Focus is lost when closing modal dialog on offscreen/minimal platforms"); QTRY_COMPARE(QGuiApplication::focusWindow(), nullptr); return; } diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp index a028990a16..1679d5b8df 100644 --- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp +++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp @@ -599,7 +599,7 @@ QImage tst_QPainter::getResImage( const QString &dir, const QString &addition, c QImage res; QString resFilename = dir + QLatin1String("/res_") + addition + QLatin1Char('.') + extension; if ( !res.load( resFilename ) ) { - QWARN(QString("Could not load result data %s %1").arg(resFilename).toLatin1()); + qWarning() << "Could not load result data" << resFilename; return QImage(); } return res; @@ -610,14 +610,14 @@ QBitmap tst_QPainter::getBitmap( const QString &dir, const QString &filename, bo QBitmap bm; QString bmFilename = dir + QLatin1Char('/') + filename + QLatin1String(".xbm"); if ( !bm.load( bmFilename ) ) { - QWARN(QString("Could not load bitmap '%1'").arg(bmFilename).toLatin1()); + qWarning() << "Could not load bitmap" << bmFilename; return QBitmap(); } if ( mask ) { QBitmap mask; QString maskFilename = dir + QLatin1Char('/') + filename + QLatin1String("-mask.xbm"); if (!mask.load(maskFilename)) { - QWARN(QString("Could not load mask '%1'").arg(maskFilename).toLatin1()); + qWarning() << "Could not load mask" << maskFilename; return QBitmap(); } bm.setMask( mask ); diff --git a/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp index 7ef866bd9f..d915f01d22 100644 --- a/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp +++ b/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp @@ -180,7 +180,7 @@ static QByteArray readFile(const QString &absFilePath) { QFile file(absFilePath); if (!file.open(QIODevice::ReadOnly)) { - QWARN("failed to open file"); + qWarning("failed to open file"); return QByteArray(); } return file.readAll(); diff --git a/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp b/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp index cea49350f1..e57409c665 100644 --- a/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp +++ b/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp @@ -212,7 +212,7 @@ static QByteArray readFile(const QString &absFilePath) { QFile file(absFilePath); if (!file.open(QIODevice::ReadOnly)) { - QWARN("failed to open file"); + qWarning("failed to open file"); return QByteArray(); } return file.readAll(); 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(); } diff --git a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp index d43a922ec8..409038c909 100644 --- a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp @@ -1888,10 +1888,10 @@ void tst_QSqlQuery::precision() // TDS has crappy precisions by default if (dbType == QSqlDriver::Sybase) { if (i < 18) - QWARN("TDS didn't return the right precision"); + qWarning("TDS didn't return the right precision"); } else { - QWARN(QString(tst_Databases::dbToString(db) + " didn't return the right precision (" + - QString::number(i) + " out of 21), " + val).toUtf8()); + qWarning() << tst_Databases::dbToString(db) << "didn't return the right precision (" + << i << "out of 21)," << val; } } } // SQLITE scope diff --git a/tests/auto/testlib/selftests/blacklisted/tst_blacklisted.cpp b/tests/auto/testlib/selftests/blacklisted/tst_blacklisted.cpp index a419c13160..86f445b926 100644 --- a/tests/auto/testlib/selftests/blacklisted/tst_blacklisted.cpp +++ b/tests/auto/testlib/selftests/blacklisted/tst_blacklisted.cpp @@ -89,7 +89,7 @@ static void abort_handler(int) void tst_Blacklisted::messages() { qWarning("This is a warning that should not appear in silent test output"); - QWARN("This is an internal testlib warning that should not appear in silent test output"); + QTestLog::warn("This is an internal testlib warning that should not appear in silent test output", __FILE__, __LINE__); qDebug("This is a debug message that should not appear in silent test output"); qCritical("This is a critical message that should not appear in silent test output"); qInfo("This is an info message that should not appear in silent test output"); diff --git a/tests/auto/testlib/selftests/expected_junit.junitxml b/tests/auto/testlib/selftests/expected_junit.junitxml index b3591a6868..787c422251 100644 --- a/tests/auto/testlib/selftests/expected_junit.junitxml +++ b/tests/auto/testlib/selftests/expected_junit.junitxml @@ -7,7 +7,7 @@ - + @@ -38,6 +38,6 @@ - + diff --git a/tests/auto/testlib/selftests/junit/tst_junit.cpp b/tests/auto/testlib/selftests/junit/tst_junit.cpp index 77f369b779..c434704d83 100644 --- a/tests/auto/testlib/selftests/junit/tst_junit.cpp +++ b/tests/auto/testlib/selftests/junit/tst_junit.cpp @@ -51,7 +51,7 @@ tst_JUnit::tst_JUnit() void tst_JUnit::testFunc1() { - QWARN("just a QWARN() !"); + qWarning("just a qWarning() !"); QCOMPARE(1,1); } diff --git a/tests/auto/testlib/selftests/silent/tst_silent.cpp b/tests/auto/testlib/selftests/silent/tst_silent.cpp index f21f7798eb..34b33e1391 100644 --- a/tests/auto/testlib/selftests/silent/tst_silent.cpp +++ b/tests/auto/testlib/selftests/silent/tst_silent.cpp @@ -86,7 +86,7 @@ static void abort_handler(int) void tst_Silent::messages() { qWarning("This is a warning that should not appear in silent test output"); - QWARN("This is an internal testlib warning that should not appear in silent test output"); + QTestLog::warn("This is an internal testlib warning that should not appear in silent test output", __FILE__, __LINE__); qDebug("This is a debug message that should not appear in silent test output"); qCritical("This is a critical message that should not appear in silent test output"); qInfo("This is an info message that should not appear in silent test output"); diff --git a/tests/auto/tools/rcc/tst_rcc.cpp b/tests/auto/tools/rcc/tst_rcc.cpp index 359ee7021e..9f4960fc7c 100644 --- a/tests/auto/tools/rcc/tst_rcc.cpp +++ b/tests/auto/tools/rcc/tst_rcc.cpp @@ -181,10 +181,8 @@ static QStringList readLinesFromFile(const QString &fileName, QFile file(fileName); bool ok = file.open(QIODevice::ReadOnly | QIODevice::Text); - if (!ok) { - QWARN(qPrintable(QString::fromLatin1("Could not open testdata file %1: %2") - .arg(fileName, file.errorString()))); - } + if (!ok) + qWarning() << "Could not open testdata file" << fileName << ":" << file.errorString(); return QString::fromUtf8(file.readAll()).split(QLatin1Char('\n'), splitBehavior); } diff --git a/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp b/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp index 6032acf00c..4b02a36f24 100644 --- a/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp +++ b/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp @@ -260,7 +260,7 @@ void tst_QFontDialog::testNonStandardFontSize() if (accepted) QCOMPARE(testFont.pointSize(), resultFont.pointSize()); else - QWARN("Fail using a non-standard font size."); + qWarning("Fail using a non-standard font size."); } QTEST_MAIN(tst_QFontDialog) diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp index 19c6ba3f19..1b7d645eba 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp @@ -1219,7 +1219,7 @@ void tst_QGraphicsScene::addPath() QVERIFY(scene.items(QPointF(-10, 20)).isEmpty()); QVERIFY(scene.items(QPointF(10, 20)).isEmpty()); if (sizeof(qreal) != sizeof(double)) - QWARN("Skipping test because of rounding errors when qreal != double"); + qWarning("Skipping test because of rounding errors when qreal != double"); else QVERIFY(scene.items(QPointF(-10, 30)).isEmpty()); QVERIFY(scene.items(QPointF(10.1, 30)).isEmpty()); diff --git a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp index 669428dd35..2ac1e927d9 100644 --- a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp +++ b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp @@ -967,7 +967,7 @@ void tst_QAbstractItemView::dragAndDrop() if (successes < attempts) { QString msg = QString("# successes (%1) < # attempts (%2)").arg(successes).arg(attempts); - QWARN(msg.toLatin1()); + qWarning() << qPrintable(msg); } QVERIFY(successes > 0); // allow for some "event unstability" (i.e. unless // successes == 0, QAbstractItemView is probably ok!) diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp index 1c15f67bd3..4146a6632d 100644 --- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp @@ -3460,7 +3460,7 @@ void tst_QComboBox::task_QTBUG_52027_mapCompleterIndex() completer->setModel(model); if (QGuiApplication::platformName() == "offscreen") { - QWARN("Offscreen platform requires explicit activateWindow()"); + qWarning("Offscreen platform requires explicit activateWindow()"); cbox.activateWindow(); } diff --git a/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp b/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp index a3f4f353d1..dd67de2287 100644 --- a/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp +++ b/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp @@ -1045,7 +1045,7 @@ void tst_QDoubleSpinBox::undoRedo() QVERIFY(!spin.lineEdit()->isUndoAvailable()); QVERIFY(spin.lineEdit()->isRedoAvailable()); } else { - QWARN("Undo not tested because no key sequence associated to QKeySequence::Redo"); + qWarning("Undo not tested because no key sequence associated to QKeySequence::Redo"); } @@ -1058,7 +1058,7 @@ void tst_QDoubleSpinBox::undoRedo() QVERIFY(!spin.lineEdit()->isRedoAvailable()); QVERIFY(spin.lineEdit()->isUndoAvailable()); } else { - QWARN("Redo not tested because no key sequence associated to QKeySequence::Redo"); + qWarning("Redo not tested because no key sequence associated to QKeySequence::Redo"); } diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp index 0dc4c07069..e52df3c84c 100644 --- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp +++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp @@ -1811,7 +1811,7 @@ void tst_QMenu::menuSize_Scrolling() QSize s = size(); if (!QGuiApplication::platformName().compare(QLatin1String("minimal"), Qt::CaseInsensitive) || !QGuiApplication::platformName().compare(QLatin1String("offscreen"), Qt::CaseInsensitive)) { - QWARN("Skipping test on minimal/offscreen platforms - QTBUG-73522"); + qWarning("Skipping test on minimal/offscreen platforms - QTBUG-73522"); QMenu::showEvent(e); return; } diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp index bac7962c6a..1b8de0b75c 100644 --- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp +++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp @@ -921,7 +921,7 @@ void tst_QMenuBar::check_escKey() if (!QGuiApplication::platformName().compare(QLatin1String("minimal"), Qt::CaseInsensitive) || !QGuiApplication::platformName().compare(QLatin1String("offscreen"), Qt::CaseInsensitive)) { - QWARN("Skipping menu button test on minimal/offscreen platforms"); + qWarning("Skipping menu button test on minimal/offscreen platforms"); return; } diff --git a/tests/benchmarks/gui/painting/lancebench/tst_lancebench.cpp b/tests/benchmarks/gui/painting/lancebench/tst_lancebench.cpp index 1c17f86cf9..418f0623b3 100644 --- a/tests/benchmarks/gui/painting/lancebench/tst_lancebench.cpp +++ b/tests/benchmarks/gui/painting/lancebench/tst_lancebench.cpp @@ -101,7 +101,7 @@ void tst_LanceBench::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."); }