use QTemporaryFile when creating a database for guitest

This commit is contained in:
thez3ro 2017-11-02 19:58:45 +01:00
parent c3c67f18b8
commit d6e8e1be6e
No known key found for this signature in database
GPG Key ID: F628F9E41DD7C073

View File

@ -122,7 +122,12 @@ void TestGui::cleanup()
void TestGui::testCreateDatabase()
{
fileDialog()->setNextFileName(QString(KEEPASSX_TEST_DATA_DIR).append("/NewTestDatabase.kdbx"));
QTemporaryFile tmpFile;
QVERIFY(tmpFile.open());
QString tmpFileName = tmpFile.fileName();
tmpFile.remove();
fileDialog()->setNextFileName(tmpFileName);
triggerAction("actionDatabaseNew");
DatabaseWidget* dbWidget = m_tabWidget->currentDatabaseWidget();
@ -148,13 +153,10 @@ void TestGui::testCreateDatabase()
// there is a new empty db
QCOMPARE(m_db->rootGroup()->children().size(), 0);
// clean
// close the new database
MessageBox::setNextAnswer(QMessageBox::No);
triggerAction("actionDatabaseClose");
Tools::wait(100);
QFile dbfile(QString(KEEPASSX_TEST_DATA_DIR).append("/NewTestDatabase.kdbx"));
dbfile.remove();
}
void TestGui::testMergeDatabase()