Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'tests/TestMerge.cpp')
-rw-r--r--tests/TestMerge.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/TestMerge.cpp b/tests/TestMerge.cpp
index a09eb32e6..03eae32ef 100644
--- a/tests/TestMerge.cpp
+++ b/tests/TestMerge.cpp
@@ -1127,6 +1127,34 @@ void TestMerge::testMergeCustomIcons()
QVERIFY(dbDestination->metadata()->containsCustomIcon(customIconId));
}
+/**
+ * No duplicate icons should be created
+ */
+void TestMerge::testMergeDuplicateCustomIcons()
+{
+ QScopedPointer<Database> dbDestination(new Database());
+ QScopedPointer<Database> dbSource(createTestDatabase());
+
+ m_clock->advanceSecond(1);
+
+ QUuid customIconId = QUuid::createUuid();
+ QImage customIcon;
+
+ dbSource->metadata()->addCustomIcon(customIconId, customIcon);
+ dbDestination->metadata()->addCustomIcon(customIconId, customIcon);
+ // Sanity check.
+ QVERIFY(dbSource->metadata()->containsCustomIcon(customIconId));
+ QVERIFY(dbDestination->metadata()->containsCustomIcon(customIconId));
+
+ m_clock->advanceSecond(1);
+
+ Merger merger(dbSource.data(), dbDestination.data());
+ merger.merge();
+
+ QVERIFY(dbDestination->metadata()->containsCustomIcon(customIconId));
+ QCOMPARE(dbDestination->metadata()->customIcons().count(), 1);
+}
+
void TestMerge::testMetadata()
{
QSKIP("Sophisticated merging for Metadata not implemented");