on xenial help sign in
Test for warnings when AsyncQuery fails to init
b096586Dalton Durst
plugins/Utils/windowstatestorage.cpp+2−2
@@ -58,7 +58,7 @@ public:
58 connection.setDatabaseName(m_dbName);
58 connection.setDatabaseName(m_dbName);
59 connection.setConnectOptions(QStringLiteral("QSQLITE_BUSY_TIMEOUT=1000"));
59 connection.setConnectOptions(QStringLiteral("QSQLITE_BUSY_TIMEOUT=1000"));
60 if (!connection.open()) {
60 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();
62 return false;
62 return false;
63 }
63 }
64 QSqlQuery query(connection);
64 QSqlQuery query(connection);
@@ -259,7 +259,7 @@ WindowStateStorage::WindowStateStorage(const QString& dbName, QObject *parent):
259 Qt::BlockingQueuedConnection,
259 Qt::BlockingQueuedConnection,
260 Q_RETURN_ARG(bool, queryInitSuccessful));
260 Q_RETURN_ARG(bool, queryInitSuccessful));
261 if (!queryInitSuccessful) {
261 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.";
263 m_asyncOk = false;
263 m_asyncOk = false;
264 m_thread.quit();
264 m_thread.quit();
265 } else {
265 } else {
tests/plugins/Utils/WindowStateStorageTest.cpp+2
@@ -59,6 +59,8 @@ private Q_SLOTS:
59 WindowStateStorage::WindowState defaultState{WindowStateStorage::WindowState::WindowStateMaximizedBottomRight};
59 WindowStateStorage::WindowState defaultState{WindowStateStorage::WindowState::WindowStateMaximizedBottomRight};
60
60
61 delete storage;
61 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.");
62 storage = new WindowStateStorage(QStringLiteral("/nonexistent/there/is/no/way/this/exists/"), this);
64 storage = new WindowStateStorage(QStringLiteral("/nonexistent/there/is/no/way/this/exists/"), this);
63 QCOMPARE(storage->getDbName(), QStringLiteral("ERROR"));
65 QCOMPARE(storage->getDbName(), QStringLiteral("ERROR"));
64
66