mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-12-04 15:39:34 +01:00
Implement 'Save Database Backup' option
Add an option in the 'Database' menu to save a backup of the current database. Add unit test for saving database copy * Open a test database, mark it as modified, and save a copy * Fail if the copy is not a valid database * Fail if the original database is saved * Fail if the original database is no longer marked as modified
This commit is contained in:
committed by
Jonathan White
parent
2237cf0188
commit
45848c3f61
@@ -1212,6 +1212,35 @@ void TestGui::testSaveAs()
|
||||
tmpFile.remove();
|
||||
}
|
||||
|
||||
void TestGui::testSaveBackup()
|
||||
{
|
||||
m_db->metadata()->setName("testSaveBackup");
|
||||
|
||||
QFileInfo fileInfo(m_dbFilePath);
|
||||
QDateTime lastModified = fileInfo.lastModified();
|
||||
|
||||
// open temporary file so it creates a filename
|
||||
TemporaryFile tmpFile;
|
||||
QVERIFY(tmpFile.open());
|
||||
QString tmpFileName = tmpFile.fileName();
|
||||
tmpFile.remove();
|
||||
|
||||
// wait for modified timer
|
||||
QTRY_COMPARE(m_tabWidget->tabText(m_tabWidget->currentIndex()), QString("testSaveBackup*"));
|
||||
|
||||
fileDialog()->setNextFileName(tmpFileName);
|
||||
|
||||
triggerAction("actionDatabaseSaveBackup");
|
||||
|
||||
QCOMPARE(m_tabWidget->tabName(m_tabWidget->currentIndex()), QString("testSaveBackup*"));
|
||||
|
||||
checkDatabase(tmpFileName);
|
||||
|
||||
fileInfo.refresh();
|
||||
QCOMPARE(fileInfo.lastModified(), lastModified);
|
||||
tmpFile.remove();
|
||||
}
|
||||
|
||||
void TestGui::testSave()
|
||||
{
|
||||
m_db->metadata()->setName("testSave");
|
||||
|
||||
@@ -61,6 +61,7 @@ private slots:
|
||||
void testDragAndDropEntry();
|
||||
void testDragAndDropGroup();
|
||||
void testSaveAs();
|
||||
void testSaveBackup();
|
||||
void testSave();
|
||||
void testDatabaseSettings();
|
||||
void testKeePass1Import();
|
||||
|
||||
Reference in New Issue
Block a user