diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/gui/TestGui.cpp | 29 | ||||
-rw-r--r-- | tests/gui/TestGui.h | 1 |
2 files changed, 30 insertions, 0 deletions
diff --git a/tests/gui/TestGui.cpp b/tests/gui/TestGui.cpp index e167b9a30..5ca7ccdbe 100644 --- a/tests/gui/TestGui.cpp +++ b/tests/gui/TestGui.cpp @@ -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"); diff --git a/tests/gui/TestGui.h b/tests/gui/TestGui.h index cd329dd06..8d82e021e 100644 --- a/tests/gui/TestGui.h +++ b/tests/gui/TestGui.h @@ -61,6 +61,7 @@ private slots: void testDragAndDropEntry(); void testDragAndDropGroup(); void testSaveAs(); + void testSaveBackup(); void testSave(); void testDatabaseSettings(); void testKeePass1Import(); |