Disable auto save for GUI tests

This commit is contained in:
Jonathan White 2018-01-28 14:06:17 -05:00
parent 6a4b275d40
commit 8c8a61ddfe
No known key found for this signature in database
GPG Key ID: 440FC65F2E0C6E01

View File

@ -67,6 +67,9 @@ void TestGui::initTestCase()
{
QVERIFY(Crypto::init());
Config::createTempFileInstance();
// Disable autosave so we can test the modified file indicator
Config::instance()->set("AutoSaveAfterEveryChange", false);
m_mainWindow = new MainWindow();
m_tabWidget = m_mainWindow->findChild<DatabaseTabWidget*>("tabWidget");
m_mainWindow->show();
@ -141,7 +144,6 @@ void TestGui::testCreateDatabase()
DatabaseWidget* dbWidget = m_tabWidget->currentDatabaseWidget();
QWidget* databaseNewWidget = dbWidget->findChild<QWidget*>("changeMasterKeyWidget");
QList<QWidget*> databaseNewWidgets = dbWidget->findChildren<QWidget*>("changeMasterKeyWidget");
PasswordEdit* editPassword = databaseNewWidget->findChild<PasswordEdit*>("enterPasswordEdit");
QVERIFY(editPassword->isVisible());
@ -154,6 +156,7 @@ void TestGui::testCreateDatabase()
QTest::keyClicks(editPasswordRepeat, "test");
QTest::keyClick(editPasswordRepeat, Qt::Key_Enter);
// Auto-save after every change is enabled by default, ensure the db saves right away
QTRY_VERIFY(m_tabWidget->tabText(m_tabWidget->currentIndex()).contains("*"));
m_db = m_tabWidget->currentDatabaseWidget()->database();