Fix issues with group functions (#2410)
This commit is contained in:
@@ -493,57 +493,64 @@ void TestGroup::testFindEntry()
|
||||
|
||||
Entry* entry;
|
||||
|
||||
entry = db->rootGroup()->findEntry(entry1->uuidToHex());
|
||||
QVERIFY(entry != nullptr);
|
||||
entry = db->rootGroup()->findEntryByUuid(entry1->uuid());
|
||||
QVERIFY(entry);
|
||||
QCOMPARE(entry->title(), QString("entry1"));
|
||||
|
||||
entry = db->rootGroup()->findEntry(QString("entry1"));
|
||||
QVERIFY(entry != nullptr);
|
||||
entry = db->rootGroup()->findEntryByPath(QString("entry1"));
|
||||
QVERIFY(entry);
|
||||
QCOMPARE(entry->title(), QString("entry1"));
|
||||
|
||||
// We also can find the entry with the leading slash.
|
||||
entry = db->rootGroup()->findEntry(QString("/entry1"));
|
||||
QVERIFY(entry != nullptr);
|
||||
entry = db->rootGroup()->findEntryByPath(QString("/entry1"));
|
||||
QVERIFY(entry);
|
||||
QCOMPARE(entry->title(), QString("entry1"));
|
||||
|
||||
// But two slashes should not be accepted.
|
||||
entry = db->rootGroup()->findEntry(QString("//entry1"));
|
||||
QVERIFY(entry == nullptr);
|
||||
entry = db->rootGroup()->findEntryByPath(QString("//entry1"));
|
||||
QVERIFY(!entry);
|
||||
|
||||
entry = db->rootGroup()->findEntry(entry2->uuidToHex());
|
||||
QVERIFY(entry != nullptr);
|
||||
entry = db->rootGroup()->findEntryByUuid(entry2->uuid());
|
||||
QVERIFY(entry);
|
||||
QCOMPARE(entry->title(), QString("entry2"));
|
||||
|
||||
entry = db->rootGroup()->findEntry(QString("group1/entry2"));
|
||||
QVERIFY(entry != nullptr);
|
||||
entry = db->rootGroup()->findEntryByPath(QString("group1/entry2"));
|
||||
QVERIFY(entry);
|
||||
QCOMPARE(entry->title(), QString("entry2"));
|
||||
|
||||
entry = db->rootGroup()->findEntry(QString("/entry2"));
|
||||
QVERIFY(entry == nullptr);
|
||||
entry = db->rootGroup()->findEntryByPath(QString("/entry2"));
|
||||
QVERIFY(!entry);
|
||||
|
||||
// We also can find the entry with the leading slash.
|
||||
entry = db->rootGroup()->findEntry(QString("/group1/entry2"));
|
||||
QVERIFY(entry != nullptr);
|
||||
entry = db->rootGroup()->findEntryByPath(QString("/group1/entry2"));
|
||||
QVERIFY(entry);
|
||||
QCOMPARE(entry->title(), QString("entry2"));
|
||||
|
||||
// Should also find the entry only by title.
|
||||
entry = db->rootGroup()->findEntry(QString("entry2"));
|
||||
QVERIFY(entry != nullptr);
|
||||
entry = db->rootGroup()->findEntryByPath(QString("entry2"));
|
||||
QVERIFY(entry);
|
||||
QCOMPARE(entry->title(), QString("entry2"));
|
||||
|
||||
entry = db->rootGroup()->findEntry(QString("invalid/path/to/entry2"));
|
||||
QVERIFY(entry == nullptr);
|
||||
entry = db->rootGroup()->findEntryByPath(QString("invalid/path/to/entry2"));
|
||||
QVERIFY(!entry);
|
||||
|
||||
entry = db->rootGroup()->findEntry(QString("entry27"));
|
||||
QVERIFY(entry == nullptr);
|
||||
entry = db->rootGroup()->findEntryByPath(QString("entry27"));
|
||||
QVERIFY(!entry);
|
||||
|
||||
// A valid UUID that does not exist in this database.
|
||||
entry = db->rootGroup()->findEntry(QString("febfb01ebcdf9dbd90a3f1579dc75281"));
|
||||
QVERIFY(entry == nullptr);
|
||||
entry = db->rootGroup()->findEntryByUuid(QUuid("febfb01ebcdf9dbd90a3f1579dc75281"));
|
||||
QVERIFY(!entry);
|
||||
|
||||
// An invalid UUID.
|
||||
entry = db->rootGroup()->findEntry(QString("febfb01ebcdf9dbd90a3f1579dc"));
|
||||
QVERIFY(entry == nullptr);
|
||||
entry = db->rootGroup()->findEntryByUuid(QUuid("febfb01ebcdf9dbd90a3f1579dc"));
|
||||
QVERIFY(!entry);
|
||||
|
||||
// Empty strings
|
||||
entry = db->rootGroup()->findEntryByUuid({});
|
||||
QVERIFY(!entry);
|
||||
|
||||
entry = db->rootGroup()->findEntryByPath({});
|
||||
QVERIFY(!entry);
|
||||
}
|
||||
|
||||
void TestGroup::testFindGroupByPath()
|
||||
@@ -561,51 +568,51 @@ void TestGroup::testFindGroupByPath()
|
||||
Group* group;
|
||||
|
||||
group = db->rootGroup()->findGroupByPath("/");
|
||||
QVERIFY(group != nullptr);
|
||||
QVERIFY(group);
|
||||
QCOMPARE(group->uuid(), db->rootGroup()->uuid());
|
||||
|
||||
// We also accept it if the leading slash is missing.
|
||||
group = db->rootGroup()->findGroupByPath("");
|
||||
QVERIFY(group != nullptr);
|
||||
QVERIFY(group);
|
||||
QCOMPARE(group->uuid(), db->rootGroup()->uuid());
|
||||
|
||||
group = db->rootGroup()->findGroupByPath("/group1/");
|
||||
QVERIFY(group != nullptr);
|
||||
QVERIFY(group);
|
||||
QCOMPARE(group->uuid(), group1->uuid());
|
||||
|
||||
// We also accept it if the leading slash is missing.
|
||||
group = db->rootGroup()->findGroupByPath("group1/");
|
||||
QVERIFY(group != nullptr);
|
||||
QVERIFY(group);
|
||||
QCOMPARE(group->uuid(), group1->uuid());
|
||||
|
||||
// Too many slashes at the end
|
||||
group = db->rootGroup()->findGroupByPath("group1//");
|
||||
QVERIFY(group == nullptr);
|
||||
QVERIFY(!group);
|
||||
|
||||
// Missing a slash at the end.
|
||||
group = db->rootGroup()->findGroupByPath("/group1");
|
||||
QVERIFY(group != nullptr);
|
||||
QVERIFY(group);
|
||||
QCOMPARE(group->uuid(), group1->uuid());
|
||||
|
||||
// Too many slashes at the start
|
||||
group = db->rootGroup()->findGroupByPath("//group1");
|
||||
QVERIFY(group == nullptr);
|
||||
QVERIFY(!group);
|
||||
|
||||
group = db->rootGroup()->findGroupByPath("/group1/group2/");
|
||||
QVERIFY(group != nullptr);
|
||||
QVERIFY(group);
|
||||
QCOMPARE(group->uuid(), group2->uuid());
|
||||
|
||||
// We also accept it if the leading slash is missing.
|
||||
group = db->rootGroup()->findGroupByPath("group1/group2/");
|
||||
QVERIFY(group != nullptr);
|
||||
QVERIFY(group);
|
||||
QCOMPARE(group->uuid(), group2->uuid());
|
||||
|
||||
group = db->rootGroup()->findGroupByPath("group1/group2");
|
||||
QVERIFY(group != nullptr);
|
||||
QVERIFY(group);
|
||||
QCOMPARE(group->uuid(), group2->uuid());
|
||||
|
||||
group = db->rootGroup()->findGroupByPath("invalid");
|
||||
QVERIFY(group == nullptr);
|
||||
QVERIFY(!group);
|
||||
}
|
||||
|
||||
void TestGroup::testPrint()
|
||||
@@ -697,7 +704,7 @@ void TestGroup::testLocate()
|
||||
QVERIFY(results.contains("/entry1"));
|
||||
|
||||
results = db->rootGroup()->locate("invalid");
|
||||
QVERIFY(results.size() == 0);
|
||||
QVERIFY(results.isEmpty());
|
||||
|
||||
results = db->rootGroup()->locate("google");
|
||||
QVERIFY(results.size() == 1);
|
||||
@@ -725,37 +732,37 @@ void TestGroup::testAddEntryWithPath()
|
||||
group2->setParent(group1);
|
||||
|
||||
Entry* entry = db->rootGroup()->addEntryWithPath("entry1");
|
||||
QVERIFY(entry != nullptr);
|
||||
QVERIFY(entry);
|
||||
QVERIFY(!entry->uuid().isNull());
|
||||
|
||||
entry = db->rootGroup()->addEntryWithPath("entry1");
|
||||
QVERIFY(entry == nullptr);
|
||||
QVERIFY(!entry);
|
||||
|
||||
entry = db->rootGroup()->addEntryWithPath("/entry1");
|
||||
QVERIFY(entry == nullptr);
|
||||
QVERIFY(!entry);
|
||||
|
||||
entry = db->rootGroup()->addEntryWithPath("entry2");
|
||||
QVERIFY(entry != nullptr);
|
||||
QVERIFY(entry);
|
||||
QVERIFY(entry->title() == "entry2");
|
||||
QVERIFY(!entry->uuid().isNull());
|
||||
|
||||
entry = db->rootGroup()->addEntryWithPath("/entry3");
|
||||
QVERIFY(entry != nullptr);
|
||||
QVERIFY(entry);
|
||||
QVERIFY(entry->title() == "entry3");
|
||||
QVERIFY(!entry->uuid().isNull());
|
||||
|
||||
entry = db->rootGroup()->addEntryWithPath("/group1/entry4");
|
||||
QVERIFY(entry != nullptr);
|
||||
QVERIFY(entry);
|
||||
QVERIFY(entry->title() == "entry4");
|
||||
QVERIFY(!entry->uuid().isNull());
|
||||
|
||||
entry = db->rootGroup()->addEntryWithPath("/group1/group2/entry5");
|
||||
QVERIFY(entry != nullptr);
|
||||
QVERIFY(entry);
|
||||
QVERIFY(entry->title() == "entry5");
|
||||
QVERIFY(!entry->uuid().isNull());
|
||||
|
||||
entry = db->rootGroup()->addEntryWithPath("/group1/invalid_group/entry6");
|
||||
QVERIFY(entry == nullptr);
|
||||
QVERIFY(!entry);
|
||||
|
||||
delete db;
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ void TestMerge::testResolveConflictNewer()
|
||||
QVERIFY(groupDestinationInitial != nullptr);
|
||||
QCOMPARE(groupDestinationInitial->entries().size(), 2);
|
||||
|
||||
QPointer<Entry> entrySourceInitial = dbSource->rootGroup()->findEntry("entry1");
|
||||
QPointer<Entry> entrySourceInitial = dbSource->rootGroup()->findEntryByPath("entry1");
|
||||
QVERIFY(entrySourceInitial != nullptr);
|
||||
QVERIFY(entrySourceInitial->group() == groupSourceInitial);
|
||||
|
||||
@@ -159,7 +159,7 @@ void TestMerge::testResolveConflictNewer()
|
||||
QCOMPARE(groupDestinationMerged->entries().size(), 2);
|
||||
QCOMPARE(groupDestinationMerged->timeInfo(), groupDestinationInitialTimeInfo);
|
||||
|
||||
QPointer<Entry> entryDestinationMerged = dbDestination->rootGroup()->findEntry("entry1");
|
||||
QPointer<Entry> entryDestinationMerged = dbDestination->rootGroup()->findEntryByPath("entry1");
|
||||
QVERIFY(entryDestinationMerged != nullptr);
|
||||
QVERIFY(entryDestinationMerged->group() != nullptr);
|
||||
QCOMPARE(entryDestinationMerged->password(), QString("password"));
|
||||
@@ -192,7 +192,7 @@ void TestMerge::testResolveConflictExisting()
|
||||
QVERIFY(groupDestinationInitial != nullptr);
|
||||
QCOMPARE(groupSourceInitial->entries().size(), 2);
|
||||
|
||||
QPointer<Entry> entrySourceInitial = dbSource->rootGroup()->findEntry("entry1");
|
||||
QPointer<Entry> entrySourceInitial = dbSource->rootGroup()->findEntryByPath("entry1");
|
||||
QVERIFY(entrySourceInitial != nullptr);
|
||||
QVERIFY(entrySourceInitial->group() == groupSourceInitial);
|
||||
|
||||
@@ -213,7 +213,7 @@ void TestMerge::testResolveConflictExisting()
|
||||
QPointer<Group> groupDestinationUpdated = dbDestination->rootGroup()->findChildByName("group1");
|
||||
QVERIFY(groupDestinationUpdated != nullptr);
|
||||
QCOMPARE(groupDestinationUpdated->entries().size(), 2);
|
||||
QPointer<Entry> entryDestinationUpdated = dbDestination->rootGroup()->findEntry("entry1");
|
||||
QPointer<Entry> entryDestinationUpdated = dbDestination->rootGroup()->findEntryByPath("entry1");
|
||||
QVERIFY(entryDestinationUpdated != nullptr);
|
||||
QVERIFY(entryDestinationUpdated->group() == groupDestinationUpdated);
|
||||
|
||||
@@ -244,7 +244,7 @@ void TestMerge::testResolveConflictExisting()
|
||||
QCOMPARE(groupDestinationMerged->entries().size(), 2);
|
||||
QCOMPARE(groupDestinationMerged->timeInfo(), groupDestinationUpdatedNewerTimeInfo);
|
||||
|
||||
QPointer<Entry> entryDestinationMerged = dbDestination->rootGroup()->findEntry("entry1");
|
||||
QPointer<Entry> entryDestinationMerged = dbDestination->rootGroup()->findEntryByPath("entry1");
|
||||
QVERIFY(entryDestinationMerged != nullptr);
|
||||
QCOMPARE(entryDestinationMerged->password(), QString("password2"));
|
||||
QCOMPARE(entryDestinationMerged->timeInfo(), entryDestinationUpdatedNewerTimeInfo);
|
||||
@@ -382,9 +382,9 @@ void TestMerge::testResolveConflictTemplate(int mergeMode, std::function<void(Da
|
||||
|
||||
m_clock->advanceMinute(1);
|
||||
|
||||
QPointer<Entry> deletedEntryDestination = dbDestination->rootGroup()->findEntry("deletedDestination");
|
||||
QPointer<Entry> deletedEntryDestination = dbDestination->rootGroup()->findEntryByPath("deletedDestination");
|
||||
dbDestination->recycleEntry(deletedEntryDestination);
|
||||
QPointer<Entry> deletedEntrySource = dbSource->rootGroup()->findEntry("deletedSource");
|
||||
QPointer<Entry> deletedEntrySource = dbSource->rootGroup()->findEntryByPath("deletedSource");
|
||||
dbSource->recycleEntry(deletedEntrySource);
|
||||
|
||||
m_clock->advanceMinute(1);
|
||||
@@ -428,8 +428,8 @@ void TestMerge::testResolveConflictTemplate(int mergeMode, std::function<void(Da
|
||||
|
||||
verification(dbDestination.data(), timestamps);
|
||||
|
||||
QVERIFY(dbDestination->rootGroup()->findEntry("entryDestination"));
|
||||
QVERIFY(dbDestination->rootGroup()->findEntry("entrySource"));
|
||||
QVERIFY(dbDestination->rootGroup()->findEntryByPath("entryDestination"));
|
||||
QVERIFY(dbDestination->rootGroup()->findEntryByPath("entrySource"));
|
||||
}
|
||||
|
||||
void TestMerge::testDeletionConflictTemplate(int mergeMode, std::function<void(Database*, const QMap<QString, QUuid>&)> verification)
|
||||
@@ -790,7 +790,7 @@ void TestMerge::testMoveEntry()
|
||||
QScopedPointer<Database> dbSource(
|
||||
createTestDatabaseStructureClone(dbDestination.data(), Entry::CloneNoFlags, Group::CloneIncludeEntries));
|
||||
|
||||
QPointer<Entry> entrySourceInitial = dbSource->rootGroup()->findEntry("entry1");
|
||||
QPointer<Entry> entrySourceInitial = dbSource->rootGroup()->findEntryByPath("entry1");
|
||||
QVERIFY(entrySourceInitial != nullptr);
|
||||
|
||||
QPointer<Group> groupSourceInitial = dbSource->rootGroup()->findChildByName("group2");
|
||||
@@ -807,7 +807,7 @@ void TestMerge::testMoveEntry()
|
||||
Merger merger(dbSource.data(), dbDestination.data());
|
||||
merger.merge();
|
||||
|
||||
QPointer<Entry> entryDestinationMerged = dbDestination->rootGroup()->findEntry("entry1");
|
||||
QPointer<Entry> entryDestinationMerged = dbDestination->rootGroup()->findEntryByPath("entry1");
|
||||
QVERIFY(entryDestinationMerged != nullptr);
|
||||
QCOMPARE(entryDestinationMerged->group()->name(), QString("group2"));
|
||||
QCOMPARE(dbDestination->rootGroup()->entriesRecursive().size(), 2);
|
||||
@@ -824,7 +824,7 @@ void TestMerge::testMoveEntryPreserveChanges()
|
||||
QScopedPointer<Database> dbSource(
|
||||
createTestDatabaseStructureClone(dbDestination.data(), Entry::CloneNoFlags, Group::CloneIncludeEntries));
|
||||
|
||||
QPointer<Entry> entrySourceInitial = dbSource->rootGroup()->findEntry("entry1");
|
||||
QPointer<Entry> entrySourceInitial = dbSource->rootGroup()->findEntryByPath("entry1");
|
||||
QVERIFY(entrySourceInitial != nullptr);
|
||||
|
||||
QPointer<Group> group2Source = dbSource->rootGroup()->findChildByName("group2");
|
||||
@@ -835,7 +835,7 @@ void TestMerge::testMoveEntryPreserveChanges()
|
||||
entrySourceInitial->setGroup(group2Source);
|
||||
QCOMPARE(entrySourceInitial->group()->name(), QString("group2"));
|
||||
|
||||
QPointer<Entry> entryDestinationInitial = dbDestination->rootGroup()->findEntry("entry1");
|
||||
QPointer<Entry> entryDestinationInitial = dbDestination->rootGroup()->findEntryByPath("entry1");
|
||||
QVERIFY(entryDestinationInitial != nullptr);
|
||||
|
||||
m_clock->advanceSecond(1);
|
||||
@@ -849,7 +849,7 @@ void TestMerge::testMoveEntryPreserveChanges()
|
||||
Merger merger(dbSource.data(), dbDestination.data());
|
||||
merger.merge();
|
||||
|
||||
QPointer<Entry> entryDestinationMerged = dbDestination->rootGroup()->findEntry("entry1");
|
||||
QPointer<Entry> entryDestinationMerged = dbDestination->rootGroup()->findEntryByPath("entry1");
|
||||
QVERIFY(entryDestinationMerged != nullptr);
|
||||
QCOMPARE(entryDestinationMerged->group()->name(), QString("group2"));
|
||||
QCOMPARE(dbDestination->rootGroup()->entriesRecursive().size(), 2);
|
||||
@@ -892,7 +892,7 @@ void TestMerge::testMoveEntryIntoNewGroup()
|
||||
groupSourceCreated->setUuid(QUuid::createUuid());
|
||||
groupSourceCreated->setParent(dbSource->rootGroup());
|
||||
|
||||
QPointer<Entry> entrySourceMoved = dbSource->rootGroup()->findEntry("entry1");
|
||||
QPointer<Entry> entrySourceMoved = dbSource->rootGroup()->findEntryByPath("entry1");
|
||||
entrySourceMoved->setGroup(groupSourceCreated);
|
||||
|
||||
m_clock->advanceSecond(1);
|
||||
@@ -907,7 +907,7 @@ void TestMerge::testMoveEntryIntoNewGroup()
|
||||
QCOMPARE(groupDestinationMerged->name(), QString("group3"));
|
||||
QCOMPARE(groupDestinationMerged->entries().size(), 1);
|
||||
|
||||
QPointer<Entry> entryDestinationMerged = dbDestination->rootGroup()->findEntry("entry1");
|
||||
QPointer<Entry> entryDestinationMerged = dbDestination->rootGroup()->findEntryByPath("entry1");
|
||||
QVERIFY(entryDestinationMerged != nullptr);
|
||||
QCOMPARE(entryDestinationMerged->group()->name(), QString("group3"));
|
||||
}
|
||||
@@ -929,7 +929,7 @@ void TestMerge::testUpdateEntryDifferentLocation()
|
||||
|
||||
m_clock->advanceSecond(1);
|
||||
|
||||
QPointer<Entry> entryDestinationMoved = dbDestination->rootGroup()->findEntry("entry1");
|
||||
QPointer<Entry> entryDestinationMoved = dbDestination->rootGroup()->findEntryByPath("entry1");
|
||||
QVERIFY(entryDestinationMoved != nullptr);
|
||||
entryDestinationMoved->setGroup(groupDestinationCreated);
|
||||
QUuid uuidBeforeSyncing = entryDestinationMoved->uuid();
|
||||
@@ -938,7 +938,7 @@ void TestMerge::testUpdateEntryDifferentLocation()
|
||||
// Change the entry in the source db.
|
||||
m_clock->advanceSecond(1);
|
||||
|
||||
QPointer<Entry> entrySourceMoved = dbSource->rootGroup()->findEntry("entry1");
|
||||
QPointer<Entry> entrySourceMoved = dbSource->rootGroup()->findEntryByPath("entry1");
|
||||
QVERIFY(entrySourceMoved != nullptr);
|
||||
entrySourceMoved->beginUpdate();
|
||||
entrySourceMoved->setUsername("username");
|
||||
@@ -954,7 +954,7 @@ void TestMerge::testUpdateEntryDifferentLocation()
|
||||
|
||||
QCOMPARE(dbDestination->rootGroup()->entriesRecursive().size(), 2);
|
||||
|
||||
QPointer<Entry> entryDestinationMerged = dbDestination->rootGroup()->findEntry("entry1");
|
||||
QPointer<Entry> entryDestinationMerged = dbDestination->rootGroup()->findEntryByPath("entry1");
|
||||
QVERIFY(entryDestinationMerged != nullptr);
|
||||
QVERIFY(entryDestinationMerged->group() != nullptr);
|
||||
QCOMPARE(entryDestinationMerged->username(), QString("username"));
|
||||
@@ -983,7 +983,7 @@ void TestMerge::testUpdateGroup()
|
||||
dbSource->metadata()->addCustomIcon(customIconId, customIcon);
|
||||
groupSourceInitial->setIcon(customIconId);
|
||||
|
||||
QPointer<Entry> entrySourceInitial = dbSource->rootGroup()->findEntry("entry1");
|
||||
QPointer<Entry> entrySourceInitial = dbSource->rootGroup()->findEntryByPath("entry1");
|
||||
QVERIFY(entrySourceInitial != nullptr);
|
||||
entrySourceInitial->setGroup(groupSourceInitial);
|
||||
entrySourceInitial->setTitle("entry1 renamed");
|
||||
@@ -996,7 +996,7 @@ void TestMerge::testUpdateGroup()
|
||||
|
||||
QCOMPARE(dbDestination->rootGroup()->entriesRecursive().size(), 2);
|
||||
|
||||
QPointer<Entry> entryDestinationMerged = dbDestination->rootGroup()->findEntry("entry1 renamed");
|
||||
QPointer<Entry> entryDestinationMerged = dbDestination->rootGroup()->findEntryByPath("entry1 renamed");
|
||||
QVERIFY(entryDestinationMerged != nullptr);
|
||||
QVERIFY(entryDestinationMerged->group() != nullptr);
|
||||
QCOMPARE(entryDestinationMerged->group()->name(), QString("group2 renamed"));
|
||||
@@ -1125,7 +1125,7 @@ void TestMerge::testDeletedEntry()
|
||||
|
||||
m_clock->advanceSecond(1);
|
||||
|
||||
QPointer<Entry> entry1SourceInitial = dbSource->rootGroup()->findEntry("entry1");
|
||||
QPointer<Entry> entry1SourceInitial = dbSource->rootGroup()->findEntryByPath("entry1");
|
||||
QVERIFY(entry1SourceInitial != nullptr);
|
||||
QUuid entry1Uuid = entry1SourceInitial->uuid();
|
||||
delete entry1SourceInitial;
|
||||
@@ -1133,7 +1133,7 @@ void TestMerge::testDeletedEntry()
|
||||
|
||||
m_clock->advanceSecond(1);
|
||||
|
||||
QPointer<Entry> entry2DestinationInitial = dbDestination->rootGroup()->findEntry("entry2");
|
||||
QPointer<Entry> entry2DestinationInitial = dbDestination->rootGroup()->findEntryByPath("entry2");
|
||||
QVERIFY(entry2DestinationInitial != nullptr);
|
||||
QUuid entry2Uuid = entry2DestinationInitial->uuid();
|
||||
delete entry2DestinationInitial;
|
||||
@@ -1144,10 +1144,10 @@ void TestMerge::testDeletedEntry()
|
||||
Merger merger(dbSource.data(), dbDestination.data());
|
||||
merger.merge();
|
||||
|
||||
QPointer<Entry> entry1DestinationMerged = dbDestination->rootGroup()->findEntry("entry1");
|
||||
QPointer<Entry> entry1DestinationMerged = dbDestination->rootGroup()->findEntryByPath("entry1");
|
||||
QVERIFY(entry1DestinationMerged);
|
||||
QVERIFY(!dbDestination->containsDeletedObject(entry1Uuid));
|
||||
QPointer<Entry> entry2DestinationMerged = dbDestination->rootGroup()->findEntry("entry2");
|
||||
QPointer<Entry> entry2DestinationMerged = dbDestination->rootGroup()->findEntryByPath("entry2");
|
||||
QVERIFY(entry2DestinationMerged);
|
||||
// Uuid in db and deletedObjects is intended according to KeePass #1752
|
||||
QVERIFY(dbDestination->containsDeletedObject(entry2Uuid));
|
||||
@@ -1176,9 +1176,9 @@ void TestMerge::testDeletedGroup()
|
||||
|
||||
QPointer<Group> group1SourceInitial = dbSource->rootGroup()->findChildByName("group1");
|
||||
QVERIFY(group1SourceInitial != nullptr);
|
||||
QPointer<Entry> entry1SourceInitial = dbSource->rootGroup()->findEntry("entry1");
|
||||
QPointer<Entry> entry1SourceInitial = dbSource->rootGroup()->findEntryByPath("entry1");
|
||||
QVERIFY(entry1SourceInitial != nullptr);
|
||||
QPointer<Entry> entry2SourceInitial = dbSource->rootGroup()->findEntry("entry2");
|
||||
QPointer<Entry> entry2SourceInitial = dbSource->rootGroup()->findEntryByPath("entry2");
|
||||
QVERIFY(entry2SourceInitial != nullptr);
|
||||
QUuid group1Uuid = group1SourceInitial->uuid();
|
||||
QUuid entry1Uuid = entry1SourceInitial->uuid();
|
||||
@@ -1206,11 +1206,11 @@ void TestMerge::testDeletedGroup()
|
||||
QVERIFY(!dbDestination->containsDeletedObject(entry2Uuid));
|
||||
QVERIFY(!dbDestination->containsDeletedObject(group2Uuid));
|
||||
|
||||
QPointer<Entry> entry1DestinationMerged = dbDestination->rootGroup()->findEntry("entry1");
|
||||
QPointer<Entry> entry1DestinationMerged = dbDestination->rootGroup()->findEntryByPath("entry1");
|
||||
QVERIFY(entry1DestinationMerged);
|
||||
QPointer<Entry> entry2DestinationMerged = dbDestination->rootGroup()->findEntry("entry2");
|
||||
QPointer<Entry> entry2DestinationMerged = dbDestination->rootGroup()->findEntryByPath("entry2");
|
||||
QVERIFY(entry2DestinationMerged);
|
||||
QPointer<Entry> entry3DestinationMerged = dbDestination->rootGroup()->findEntry("entry3");
|
||||
QPointer<Entry> entry3DestinationMerged = dbDestination->rootGroup()->findEntryByPath("entry3");
|
||||
QVERIFY(entry3DestinationMerged);
|
||||
QPointer<Group> group1DestinationMerged = dbDestination->rootGroup()->findChildByName("group1");
|
||||
QVERIFY(group1DestinationMerged);
|
||||
@@ -1228,7 +1228,7 @@ void TestMerge::testDeletedRevertedEntry()
|
||||
|
||||
m_clock->advanceSecond(1);
|
||||
|
||||
QPointer<Entry> entry1DestinationInitial = dbDestination->rootGroup()->findEntry("entry1");
|
||||
QPointer<Entry> entry1DestinationInitial = dbDestination->rootGroup()->findEntryByPath("entry1");
|
||||
QVERIFY(entry1DestinationInitial != nullptr);
|
||||
QUuid entry1Uuid = entry1DestinationInitial->uuid();
|
||||
delete entry1DestinationInitial;
|
||||
@@ -1236,7 +1236,7 @@ void TestMerge::testDeletedRevertedEntry()
|
||||
|
||||
m_clock->advanceSecond(1);
|
||||
|
||||
QPointer<Entry> entry2SourceInitial = dbSource->rootGroup()->findEntry("entry2");
|
||||
QPointer<Entry> entry2SourceInitial = dbSource->rootGroup()->findEntryByPath("entry2");
|
||||
QVERIFY(entry2SourceInitial != nullptr);
|
||||
QUuid entry2Uuid = entry2SourceInitial->uuid();
|
||||
delete entry2SourceInitial;
|
||||
@@ -1244,11 +1244,11 @@ void TestMerge::testDeletedRevertedEntry()
|
||||
|
||||
m_clock->advanceSecond(1);
|
||||
|
||||
QPointer<Entry> entry1SourceInitial = dbSource->rootGroup()->findEntry("entry1");
|
||||
QPointer<Entry> entry1SourceInitial = dbSource->rootGroup()->findEntryByPath("entry1");
|
||||
QVERIFY(entry1SourceInitial != nullptr);
|
||||
entry1SourceInitial->setNotes("Updated");
|
||||
|
||||
QPointer<Entry> entry2DestinationInitial = dbDestination->rootGroup()->findEntry("entry2");
|
||||
QPointer<Entry> entry2DestinationInitial = dbDestination->rootGroup()->findEntryByPath("entry2");
|
||||
QVERIFY(entry2DestinationInitial != nullptr);
|
||||
entry2DestinationInitial->setNotes("Updated");
|
||||
|
||||
@@ -1259,10 +1259,10 @@ void TestMerge::testDeletedRevertedEntry()
|
||||
QVERIFY(dbDestination->containsDeletedObject(entry1Uuid));
|
||||
QVERIFY(!dbDestination->containsDeletedObject(entry2Uuid));
|
||||
|
||||
QPointer<Entry> entry1DestinationMerged = dbDestination->rootGroup()->findEntry("entry1");
|
||||
QPointer<Entry> entry1DestinationMerged = dbDestination->rootGroup()->findEntryByPath("entry1");
|
||||
QVERIFY(entry1DestinationMerged);
|
||||
QVERIFY(entry1DestinationMerged->notes() == "Updated");
|
||||
QPointer<Entry> entry2DestinationMerged = dbDestination->rootGroup()->findEntry("entry2");
|
||||
QPointer<Entry> entry2DestinationMerged = dbDestination->rootGroup()->findEntryByPath("entry2");
|
||||
QVERIFY(entry2DestinationMerged);
|
||||
QVERIFY(entry2DestinationMerged->notes() == "Updated");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user