From 325303732923a74e843e4584fda106468dc46489 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 2 Feb 2022 18:10:03 +0100 Subject: [PATCH] Suppress, and thus verify we do get, two warnings in tst_QSqlQuery Expected warnings are clutter for anyone reding the output, so suppress them when they're correct behavior. Change-Id: Idf47ba4fab8069237067d9b20afef3041e0c2f8c Reviewed-by: Marc Mutz --- tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp index 06469cb8324..0fcee19dba8 100644 --- a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp @@ -1762,6 +1762,7 @@ void tst_QSqlQuery::isNull() // For a non existent field, it should be returning true. QVERIFY(q.isNull(2)); + QTest::ignoreMessage(QtWarningMsg, "QSqlQuery::isNull: unknown field name 'unknown'"); QVERIFY(q.isNull("unknown")); } @@ -3039,6 +3040,10 @@ void tst_QSqlQuery::queryOnInvalidDatabase() }); // Note: destruction of db needs to happen before we call removeDatabase. QTest::ignoreMessage( QtWarningMsg, "QSqlDatabase: INVALID driver not loaded" ); +#if QT_CONFIG(regularexpression) + QTest::ignoreMessage(QtWarningMsg, + QRegularExpression("QSqlDatabase: available drivers: ")); +#endif QSqlDatabase db = QSqlDatabase::addDatabase( "INVALID", "invalidConnection" ); QVERIFY2( db.lastError().isValid(), qPrintable( QString( "db.lastError().isValid() should be true!" ) ) );