From 3f0a3ae12a39d5ef5a56871e0d43d8a3f0e300bd Mon Sep 17 00:00:00 2001 From: alex-z Date: Thu, 14 Sep 2023 15:04:46 +0200 Subject: [PATCH] Tests for placeholder file metadata update. Signed-off-by: alex-z --- test/testsynccfapi.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/test/testsynccfapi.cpp b/test/testsynccfapi.cpp index fc6602dcd77d5..0397bc0fc99ba 100644 --- a/test/testsynccfapi.cpp +++ b/test/testsynccfapi.cpp @@ -1354,6 +1354,36 @@ private slots: const auto localFileLocked = QFileInfo{fakeFolder.localPath() + u"A/a1"}; QVERIFY(!localFileLocked.isWritable()); } + + void testLinkFileDoesNotConvertToPlaceholder() + { + // inspired by GH issue #6041 + FakeFolder fakeFolder{FileInfo{}}; + auto vfs = setupVfs(fakeFolder); + + // Create a Windows shotcut (.lnk) file + fakeFolder.remoteModifier().insert("linkfile.lnk"); + + QVERIFY(fakeFolder.syncOnce()); + ItemCompletedSpy completeSpy(fakeFolder); + QVERIFY(fakeFolder.syncOnce()); + QVERIFY(!vfs->pinState("linkfile.lnk").isValid() || vfs->pinState("linkfile.lnk").get() == PinState::Excluded); + QVERIFY(itemInstruction(completeSpy, "linkfile.lnk", CSYNC_INSTRUCTION_NONE)); + } + + void testFolderDoesNotUpdatePlaceholderMetadata() + { + FakeFolder fakeFolder{FileInfo{}}; + auto vfs = setupVfs(fakeFolder); + + fakeFolder.remoteModifier().mkdir("A"); + fakeFolder.remoteModifier().insert("A/file"); + + QVERIFY(fakeFolder.syncOnce()); + ItemCompletedSpy completeSpy(fakeFolder); + QVERIFY(fakeFolder.syncOnce()); + QVERIFY(itemInstruction(completeSpy, "A", CSYNC_INSTRUCTION_NONE)); + } }; QTEST_GUILESS_MAIN(TestSyncCfApi)