mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Store the filename instead of a QTemporaryFile in TestGui.
On Windows QTemporaryFile keeps the file handle open which conflicts with QSaveFile.
This commit is contained in:
parent
9eac5f35d8
commit
8b8e55aa17
@ -17,6 +17,7 @@
|
||||
|
||||
#include "TestGui.h"
|
||||
|
||||
#include <QtCore/QTemporaryFile>
|
||||
#include <QtTest/QTest>
|
||||
#include <QtGui/QAction>
|
||||
#include <QtGui/QApplication>
|
||||
@ -276,10 +277,12 @@ void TestGui::testSaveAs()
|
||||
|
||||
m_db->metadata()->setName("SaveAs");
|
||||
|
||||
QTemporaryFile* tmpFile = new QTemporaryFile();
|
||||
// open temporary file so it creates a filename
|
||||
QVERIFY(m_tmpFile.open());
|
||||
m_tmpFile.close();
|
||||
fileDialog()->setNextFileName(m_tmpFile.fileName());
|
||||
QVERIFY(tmpFile->open());
|
||||
m_tmpFileName = tmpFile->fileName();
|
||||
delete tmpFile;
|
||||
fileDialog()->setNextFileName(m_tmpFileName);
|
||||
|
||||
triggerAction("actionDatabaseSaveAs");
|
||||
|
||||
@ -357,6 +360,7 @@ void TestGui::testDatabaseLocking()
|
||||
void TestGui::cleanupTestCase()
|
||||
{
|
||||
delete m_mainWindow;
|
||||
QFile::remove(m_tmpFileName);
|
||||
}
|
||||
|
||||
void TestGui::checkDatabase()
|
||||
@ -364,7 +368,7 @@ void TestGui::checkDatabase()
|
||||
CompositeKey key;
|
||||
key.addKey(PasswordKey("a"));
|
||||
KeePass2Reader reader;
|
||||
QScopedPointer<Database> dbSaved(reader.readDatabase(m_tmpFile.fileName(), key));
|
||||
QScopedPointer<Database> dbSaved(reader.readDatabase(m_tmpFileName, key));
|
||||
QVERIFY(dbSaved);
|
||||
QVERIFY(!reader.hasError());
|
||||
QCOMPARE(dbSaved->metadata()->name(), m_db->metadata()->name());
|
||||
|
@ -20,7 +20,6 @@
|
||||
|
||||
#include <QtCore/QAbstractItemModel>
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QTemporaryFile>
|
||||
|
||||
class Database;
|
||||
class DatabaseTabWidget;
|
||||
@ -57,7 +56,7 @@ private:
|
||||
MainWindow* m_mainWindow;
|
||||
DatabaseTabWidget* m_tabWidget;
|
||||
DatabaseWidget* m_dbWidget;
|
||||
QTemporaryFile m_tmpFile;
|
||||
QString m_tmpFileName;
|
||||
Database* m_db;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user