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 <marc.mutz@qt.io>
This commit is contained in:
Edward Welbourne 2022-02-02 18:10:03 +01:00
parent 9030ffdffb
commit 3253037329

View File

@ -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!" ) ) );