2017-09-05 10:28:47 -04:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 2 or (at your option)
|
|
|
|
* version 3 of the License.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef KEEPASSX_TESTMERGE_H
|
|
|
|
#define KEEPASSX_TESTMERGE_H
|
|
|
|
|
|
|
|
#include "core/Database.h"
|
2018-09-30 08:45:06 -04:00
|
|
|
#include <functional>
|
2017-09-05 10:28:47 -04:00
|
|
|
|
|
|
|
class TestMerge : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
private slots:
|
|
|
|
void initTestCase();
|
2018-09-30 08:45:06 -04:00
|
|
|
void init();
|
|
|
|
void cleanup();
|
2017-09-05 10:28:47 -04:00
|
|
|
void testMergeIntoNew();
|
|
|
|
void testMergeNoChanges();
|
|
|
|
void testResolveConflictNewer();
|
2018-09-30 08:45:06 -04:00
|
|
|
void testResolveConflictExisting();
|
2017-11-03 16:29:42 -04:00
|
|
|
void testResolveGroupConflictOlder();
|
2018-11-04 15:59:13 -05:00
|
|
|
void testMergeNotModified();
|
|
|
|
void testMergeModified();
|
2018-09-30 08:45:06 -04:00
|
|
|
void testResolveConflictEntry_Synchronize();
|
|
|
|
void testResolveConflictEntry_KeepNewer();
|
|
|
|
void testDeletionConflictEntry_Synchronized();
|
|
|
|
void testDeletionConflictEntry_KeepNewer();
|
2017-09-05 10:28:47 -04:00
|
|
|
void testMoveEntry();
|
|
|
|
void testMoveEntryPreserveChanges();
|
|
|
|
void testMoveEntryIntoNewGroup();
|
|
|
|
void testCreateNewGroups();
|
|
|
|
void testUpdateEntryDifferentLocation();
|
2017-11-03 16:29:42 -04:00
|
|
|
void testUpdateGroup();
|
|
|
|
void testUpdateGroupLocation();
|
2017-09-05 10:28:47 -04:00
|
|
|
void testMergeAndSync();
|
2017-10-07 10:40:29 -04:00
|
|
|
void testMergeCustomIcons();
|
2019-04-12 06:21:20 -04:00
|
|
|
void testMergeDuplicateCustomIcons();
|
2018-09-30 08:45:06 -04:00
|
|
|
void testMetadata();
|
2019-09-16 14:01:13 -04:00
|
|
|
void testCustomData();
|
2018-09-30 08:45:06 -04:00
|
|
|
void testDeletedEntry();
|
|
|
|
void testDeletedGroup();
|
|
|
|
void testDeletedRevertedEntry();
|
|
|
|
void testDeletedRevertedGroup();
|
2017-09-05 10:28:47 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
Database* createTestDatabase();
|
2018-09-30 08:45:06 -04:00
|
|
|
Database* createTestDatabaseStructureClone(Database* source, int entryFlags, int groupFlags);
|
2018-10-31 23:27:38 -04:00
|
|
|
void testResolveConflictTemplate(int mergeMode,
|
|
|
|
std::function<void(Database*, const QMap<const char*, QDateTime>&)> verification);
|
|
|
|
void testDeletionConflictTemplate(int mergeMode,
|
|
|
|
std::function<void(Database*, const QMap<QString, QUuid>&)> verification);
|
|
|
|
static void assertDeletionNewerOnly(Database* db, const QMap<QString, QUuid>& identifiers);
|
|
|
|
static void assertDeletionLocalOnly(Database* db, const QMap<QString, QUuid>& identifiers);
|
|
|
|
static void assertUpdateMergedEntry1(Entry* entry, const QMap<const char*, QDateTime>& timestamps);
|
|
|
|
static void assertUpdateReappliedEntry2(Entry* entry, const QMap<const char*, QDateTime>& timestamps);
|
|
|
|
static void assertUpdateReappliedEntry1(Entry* entry, const QMap<const char*, QDateTime>& timestamps);
|
|
|
|
static void assertUpdateMergedEntry2(Entry* entry, const QMap<const char*, QDateTime>& timestamps);
|
2017-09-05 10:28:47 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // KEEPASSX_TESTMERGE_H
|