on xenial help sign in
Test for warnings when AsyncQuery fails to init
commitb096586d992074d086aea01401ca82a64e5e47cd authorDalton Durst <dalton@ubports.com> dateMon 18 Jan 2021, 11:51 (6 years ago) parentf20cd94
2 files changed+4−2
plugins/Utils/windowstatestorage.cpp+2−2 tests/plugins/Utils/WindowStateStorageTest.cpp+2
plugins/Utils/windowstatestorage.cpp+2−2
@@ -58,7 +58,7 @@ public:
5858 connection.setDatabaseName(m_dbName);
5959 connection.setConnectOptions(QStringLiteral("QSQLITE_BUSY_TIMEOUT=1000"));
6060 if (!connection.open()) {
61− qWarning() << "Error opening state database " << m_dbName << connection.lastError().driverText() << connection.lastError().databaseText();
61+ qWarning() << "AsyncQuery::initdb: Error opening state database " << m_dbName << connection.lastError().driverText() << connection.lastError().databaseText();
6262 return false;
6363 }
6464 QSqlQuery query(connection);
@@ -259,7 +259,7 @@ WindowStateStorage::WindowStateStorage(const QString& dbName, QObject *parent):
259259 Qt::BlockingQueuedConnection,
260260 Q_RETURN_ARG(bool, queryInitSuccessful));
261261 if (!queryInitSuccessful) {
262− qWarning() << "Failed to initialize WindowStateStorage! Windows will not be restored to their previous location.";
262+ qWarning() << "WindowStateStorage Failed to initialize AsyncQuery! Windows will not be restored to their previous location.";
263263 m_asyncOk = false;
264264 m_thread.quit();
265265 } else {
tests/plugins/Utils/WindowStateStorageTest.cpp+2
@@ -59,6 +59,8 @@ private Q_SLOTS:
5959 WindowStateStorage::WindowState defaultState{WindowStateStorage::WindowState::WindowStateMaximizedBottomRight};
6060
6161 delete storage;
62+ QTest::ignoreMessage(QtWarningMsg, "AsyncQuery::initdb: Error opening state database \"/nonexistent/there/is/no/way/this/exists/\" \"Error opening database\" \"unable to open database file\"");
63+ QTest::ignoreMessage(QtWarningMsg, "WindowStateStorage Failed to initialize AsyncQuery! Windows will not be restored to their previous location.");
6264 storage = new WindowStateStorage(QStringLiteral("/nonexistent/there/is/no/way/this/exists/"), this);
6365 QCOMPARE(storage->getDbName(), QStringLiteral("ERROR"));
6466