Skip to content

Commit

Permalink
Tests for placeholder file metadata update.
Browse files Browse the repository at this point in the history
Signed-off-by: alex-z <[email protected]>
  • Loading branch information
allexzander committed Sep 14, 2023
1 parent 0c30e3a commit 8d68f37
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions test/testsynccfapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 8d68f37

Please sign in to comment.