return;
} else if (item->_instruction == CSYNC_INSTRUCTION_REMOVE) {
_hasRemoveFile = true;
+ } else if (item->_instruction == CSYNC_INSTRUCTION_RENAME) {
+ _hasNoneFiles = true; // If a file (or every file) has been renamed, it means not al files where deleted
} else if (item->_instruction == CSYNC_INSTRUCTION_TYPE_CHANGE
|| item->_instruction == CSYNC_INSTRUCTION_SYNC) {
if (item->_direction == SyncFileItem::Up) {
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
}
+
+ void testSingleFileRenamed() {
+ FakeFolder fakeFolder{FileInfo{}};
+
+ int aboutToRemoveAllFilesCalled = 0;
+ QObject::connect(&fakeFolder.syncEngine(), &SyncEngine::aboutToRemoveAllFiles,
+ [&](SyncFileItem::Direction , bool *) {
+ aboutToRemoveAllFilesCalled++;
+ QFAIL("should not be called");
+ });
+
+ // add a single file
+ fakeFolder.localModifier().insert("hello.txt");
+ QVERIFY(fakeFolder.syncOnce());
+ QCOMPARE(aboutToRemoveAllFilesCalled, 0);
+ QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
+
+ // rename it
+ fakeFolder.localModifier().rename("hello.txt", "goodbye.txt");
+
+ QVERIFY(fakeFolder.syncOnce());
+ QCOMPARE(aboutToRemoveAllFilesCalled, 0);
+ QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
+ }
};
QTEST_GUILESS_MAIN(TestAllFilesDeleted)