diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2017-06-06 17:00:41 +0300 |
---|---|---|
committer | Olivier Goffart <olivier@woboq.com> | 2017-06-08 15:53:54 +0300 |
commit | 3314a472c3e108d80069d6b6920d883c36e0eaba (patch) | |
tree | 7f305cf6a8d588697c6bf8c3306d8dd24940e19c /test/testsyncengine.cpp | |
parent | aeeb408c744704d6653a75d75214336aedb3d47b (diff) |
SyncEngine: SelectiveSync: Remove local files of undelected folder despite other modified files
Issue #5783
When the directry that should be removed by selective sync contains changes,
we ignore the whole sub tree instead of only ignoreing new files.
We cannot ignore the whole directory, we need to ignore only the directory
that do not have files to remove
Diffstat (limited to 'test/testsyncengine.cpp')
-rw-r--r-- | test/testsyncengine.cpp | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/test/testsyncengine.cpp b/test/testsyncengine.cpp index 242d5e438..4200d5e1b 100644 --- a/test/testsyncengine.cpp +++ b/test/testsyncengine.cpp @@ -220,7 +220,18 @@ private slots: FileInfo { QStringLiteral("parentFolder"), { FileInfo{ QStringLiteral("subFolder"), { { QStringLiteral("fileA.txt"), 400 }, - { QStringLiteral("fileB.txt"), 400, 'o' } + { QStringLiteral("fileB.txt"), 400, 'o' }, + FileInfo { QStringLiteral("subsubFolder"), { + { QStringLiteral("fileC.txt"), 400 }, + { QStringLiteral("fileD.txt"), 400, 'o' } + }}, + FileInfo{ QStringLiteral("anotherFolder"), { + FileInfo { QStringLiteral("emptyFolder"), { } }, + FileInfo { QStringLiteral("subsubFolder"), { + { QStringLiteral("fileE.txt"), 400 }, + { QStringLiteral("fileF.txt"), 400, 'o' } + }} + }} }} }} }}}; @@ -233,9 +244,11 @@ private slots: {"parentFolder/subFolder/"}); fakeFolder.syncEngine().journal()->avoidReadFromDbOnNextSync("parentFolder/subFolder/"); - // But touch a local file before the next sync, such that the local folder + // But touch local file before the next sync, such that the local folder // can't be removed fakeFolder.localModifier().setContents("parentFolder/subFolder/fileB.txt", 'n'); + fakeFolder.localModifier().setContents("parentFolder/subFolder/subsubFolder/fileD.txt", 'n'); + fakeFolder.localModifier().setContents("parentFolder/subFolder/anotherFolder/subsubFolder/fileF.txt", 'n'); // Several follow-up syncs don't change the state at all, // in particular the remote state doesn't change and fileB.txt @@ -250,8 +263,13 @@ private slots: // The local state should still have subFolderA auto local = fakeFolder.currentLocalState(); QVERIFY(local.find("parentFolder/subFolder")); - QVERIFY(local.find("parentFolder/subFolder/fileA.txt")); + QVERIFY(!local.find("parentFolder/subFolder/fileA.txt")); QVERIFY(local.find("parentFolder/subFolder/fileB.txt")); + QVERIFY(!local.find("parentFolder/subFolder/subsubFolder/fileC.txt")); + QVERIFY(local.find("parentFolder/subFolder/subsubFolder/fileD.txt")); + QVERIFY(!local.find("parentFolder/subFolder/anotherFolder/subsubFolder/fileE.txt")); + QVERIFY(local.find("parentFolder/subFolder/anotherFolder/subsubFolder/fileF.txt")); + QVERIFY(!local.find("parentFolder/subFolder/anotherFolder/emptyFolder")); } } } |