diff options
author | Christian Kamm <mail@ckamm.de> | 2018-03-28 15:37:21 +0300 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2018-06-11 15:40:40 +0300 |
commit | 77fcff5bdfac54d24ce726273b2316705d620c01 (patch) | |
tree | 1448cb1ec6c71bfcae3eedc0cbf9d21263204469 /test | |
parent | a9d633c7effc8e25a916254af749e99e4917ccda (diff) |
Conflicts: Change tags to be more user friendly #6365
From "_conflict-user-yyyymmdd-hhmmss"
to " (conflicted copy user yyyy-mm-dd hhmmss)"
Diffstat (limited to 'test')
-rw-r--r-- | test/testchunkingng.cpp | 2 | ||||
-rw-r--r-- | test/testexcludedfiles.cpp | 1 | ||||
-rw-r--r-- | test/testsyncconflict.cpp | 70 | ||||
-rw-r--r-- | test/testsyncmove.cpp | 4 |
4 files changed, 55 insertions, 22 deletions
diff --git a/test/testchunkingng.cpp b/test/testchunkingng.cpp index 74ef4cbac..b4ad91897 100644 --- a/test/testchunkingng.cpp +++ b/test/testchunkingng.cpp @@ -289,7 +289,7 @@ private slots: // There is a conflict file with our version auto &stateAChildren = localState.find("A")->children; auto it = std::find_if(stateAChildren.cbegin(), stateAChildren.cend(), [&](const FileInfo &fi) { - return fi.name.startsWith("a0_conflict"); + return fi.name.startsWith("a0 (conflicted copy"); }); QVERIFY(it != stateAChildren.cend()); QCOMPARE(it->contentChar, 'B'); diff --git a/test/testexcludedfiles.cpp b/test/testexcludedfiles.cpp index 5043768ec..11d0a3282 100644 --- a/test/testexcludedfiles.cpp +++ b/test/testexcludedfiles.cpp @@ -37,6 +37,7 @@ private slots: QVERIFY(!excluded.isExcluded("/a/.b", "/a", keepHidden)); QVERIFY(excluded.isExcluded("/a/.Trashes", "/a", keepHidden)); QVERIFY(excluded.isExcluded("/a/foo_conflict-bar", "/a", keepHidden)); + QVERIFY(excluded.isExcluded("/a/foo (conflicted copy bar)", "/a", keepHidden)); QVERIFY(excluded.isExcluded("/a/.b", "/a", excludeHidden)); } }; diff --git a/test/testsyncconflict.cpp b/test/testsyncconflict.cpp index 4bc297a36..8703ccc41 100644 --- a/test/testsyncconflict.cpp +++ b/test/testsyncconflict.cpp @@ -42,7 +42,7 @@ QStringList findConflicts(const FileInfo &dir) { QStringList conflicts; for (const auto &item : dir.children) { - if (item.name.contains("conflict")) { + if (item.name.contains("(conflicted copy")) { conflicts.append(item.path()); } } @@ -56,7 +56,7 @@ bool expectAndWipeConflict(FileModifier &local, FileInfo state, const QString pa if (!base) return false; for (const auto &item : base->children) { - if (item.name.startsWith(pathComponents.fileName()) && item.name.contains("_conflict")) { + if (item.name.startsWith(pathComponents.fileName()) && item.name.contains("(conflicted copy")) { local.remove(item.path()); return true; } @@ -128,7 +128,7 @@ private slots: QCOMPARE(Utility::conflictFileBaseName(conflictMap[a1FileId].toUtf8()), QByteArray("A/a1")); // Check that the conflict file contains the username - QVERIFY(conflictMap[a1FileId].contains(QString("-%1-").arg(fakeFolder.syncEngine().account()->davDisplayName()))); + QVERIFY(conflictMap[a1FileId].contains(QString("(conflicted copy %1 ").arg(fakeFolder.syncEngine().account()->davDisplayName()))); QCOMPARE(remote.find(conflictMap[a1FileId])->contentChar, 'L'); QCOMPARE(remote.find("A/a1")->contentChar, 'R'); @@ -160,7 +160,7 @@ private slots: // file didn't finish in the same sync run that the conflict was created. // To do that we need to create a mock conflict record. auto a1FileId = fakeFolder.remoteModifier().find("A/a1")->fileId; - QString conflictName = QLatin1String("A/a1_conflict-me-1234"); + QString conflictName = QLatin1String("A/a1 (conflicted copy me 1234)"); fakeFolder.localModifier().insert(conflictName, 64, 'L'); ConflictRecord conflictRecord; conflictRecord.path = conflictName.toUtf8(); @@ -210,10 +210,10 @@ private slots: QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState()); // With no headers from the server - fakeFolder.remoteModifier().insert("A/a1_conflict-1234"); + fakeFolder.remoteModifier().insert("A/a1 (conflicted copy 1234)"); QVERIFY(fakeFolder.syncOnce()); QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState()); - auto conflictRecord = fakeFolder.syncJournal().conflictRecord("A/a1_conflict-1234"); + auto conflictRecord = fakeFolder.syncJournal().conflictRecord("A/a1 (conflicted copy 1234)"); QVERIFY(conflictRecord.isValid()); QCOMPARE(conflictRecord.baseFileId, fakeFolder.remoteModifier().find("A/a1")->fileId); @@ -312,40 +312,72 @@ private slots: QTest::addColumn<QString>("input"); QTest::addColumn<QString>("output"); - QTest::newRow("") + QTest::newRow("nomatch1") << "a/b/foo" << ""; - QTest::newRow("") + QTest::newRow("nomatch2") << "a/b/foo.txt" << ""; - QTest::newRow("") + QTest::newRow("nomatch3") << "a/b/foo_conflict" << ""; - QTest::newRow("") + QTest::newRow("nomatch4") << "a/b/foo_conflict.txt" << ""; - QTest::newRow("") + QTest::newRow("match1") << "a/b/foo_conflict-123.txt" << "a/b/foo.txt"; - QTest::newRow("") + QTest::newRow("match2") << "a/b/foo_conflict-foo-123.txt" << "a/b/foo.txt"; - QTest::newRow("") + QTest::newRow("match3") << "a/b/foo_conflict-123" << "a/b/foo"; - QTest::newRow("") + QTest::newRow("match4") << "a/b/foo_conflict-foo-123" << "a/b/foo"; + // new style + QTest::newRow("newmatch1") + << "a/b/foo (conflicted copy 123).txt" + << "a/b/foo.txt"; + QTest::newRow("newmatch2") + << "a/b/foo (conflicted copy foo 123).txt" + << "a/b/foo.txt"; + + QTest::newRow("newmatch3") + << "a/b/foo (conflicted copy 123)" + << "a/b/foo"; + QTest::newRow("newmatch4") + << "a/b/foo (conflicted copy foo 123)" + << "a/b/foo"; + + QTest::newRow("newmatch5") + << "a/b/foo (conflicted copy foo 123) bla" + << "a/b/foo bla"; + + QTest::newRow("newmatch6") + << "a/b/foo (conflicted copy foo.bar 123)" + << "a/b/foo"; + // double conflict files - QTest::newRow("") + QTest::newRow("double1") << "a/b/foo_conflict-123_conflict-456.txt" << "a/b/foo_conflict-123.txt"; - QTest::newRow("") + QTest::newRow("double2") << "a/b/foo_conflict-foo-123_conflict-bar-456.txt" << "a/b/foo_conflict-foo-123.txt"; + QTest::newRow("double3") + << "a/b/foo (conflicted copy 123) (conflicted copy 456).txt" + << "a/b/foo (conflicted copy 123).txt"; + QTest::newRow("double4") + << "a/b/foo (conflicted copy 123)_conflict-456.txt" + << "a/b/foo (conflicted copy 123).txt"; + QTest::newRow("double5") + << "a/b/foo_conflict-123 (conflicted copy 456).txt" + << "a/b/foo_conflict-123.txt"; } void testConflictFileBaseName() @@ -509,8 +541,8 @@ private slots: auto conflicts = findConflicts(fakeFolder.currentLocalState()); std::sort(conflicts.begin(), conflicts.end()); QVERIFY(conflicts.size() == 2); - QVERIFY(conflicts[0].contains("A_conflict")); - QVERIFY(conflicts[1].contains("B_conflict")); + QVERIFY(conflicts[0].contains("A (conflicted copy")); + QVERIFY(conflicts[1].contains("B (conflicted copy")); for (auto conflict : conflicts) QDir(fakeFolder.localPath() + conflict).removeRecursively(); QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState()); @@ -548,7 +580,7 @@ private slots: // inside of them! auto conflicts = findConflicts(fakeFolder.currentLocalState()); QVERIFY(conflicts.size() == 1); - QVERIFY(conflicts[0].contains("A_conflict")); + QVERIFY(conflicts[0].contains("A (conflicted copy")); for (auto conflict : conflicts) QDir(fakeFolder.localPath() + conflict).removeRecursively(); diff --git a/test/testsyncmove.cpp b/test/testsyncmove.cpp index 67d3c22be..e51ea114b 100644 --- a/test/testsyncmove.cpp +++ b/test/testsyncmove.cpp @@ -42,7 +42,7 @@ QStringList findConflicts(const FileInfo &dir) { QStringList conflicts; for (const auto &item : dir.children) { - if (item.name.contains("conflict")) { + if (item.name.contains("(conflicted copy")) { conflicts.append(item.path()); } } @@ -56,7 +56,7 @@ bool expectAndWipeConflict(FileModifier &local, FileInfo state, const QString pa if (!base) return false; for (const auto &item : base->children) { - if (item.name.startsWith(pathComponents.fileName()) && item.name.contains("_conflict")) { + if (item.name.startsWith(pathComponents.fileName()) && item.name.contains("(conflicted copy")) { local.remove(item.path()); return true; } |