FakeFolder fakeFolder{FileInfo{}};
auto vfs = setupVfs(fakeFolder);
+ qInfo("Starting .lnk test. It might hand and will get killed after timeout...");
+
// Create a Windows shortcut (.lnk) file
fakeFolder.remoteModifier().insert("linkfile.lnk");
triggerDownload(fakeFolder, "linkfile.lnk");
QVERIFY(fakeFolder.syncOnce());
QVERIFY(itemInstruction(completeSpy, "linkfile.lnk", CSYNC_INSTRUCTION_SYNC));
+
+ // a real .lnk file contents stored as base64 for tests
+ QFile fakeShortcutBase64(QStringLiteral("fakeshortcut.base64"));
+ QVERIFY(fakeShortcutBase64.open(QFile::ReadOnly));
+ const auto fakeShortcutBase64Binary = QByteArray::fromBase64(fakeShortcutBase64.readAll());
+ fakeShortcutBase64.close();
+
+ // fill the .lnk file with binary data from real shortcut and turn it into OnlineOnly file
+ const QString shortcutFilePathOnDisk = fakeFolder.localPath() + "linkfile.lnk";
+ QFile shorcutFileOnDisk(shortcutFilePathOnDisk);
+ QVERIFY(shorcutFileOnDisk.open(QFile::WriteOnly));
+ QVERIFY(shorcutFileOnDisk.write(fakeShortcutBase64Binary));
+ shorcutFileOnDisk.close();
+
+ // run tests on it
+ ::setPinState(shortcutFilePathOnDisk, PinState::OnlineOnly, cfapi::NoRecurse);
+ QVERIFY(fakeFolder.syncOnce());
+ QVERIFY(vfs->pinState("linkfile.lnk").isValid());
+ QVERIFY(itemInstruction(completeSpy, "linkfile.lnk", CSYNC_INSTRUCTION_SYNC));
+
+ // trigget download of online only .lnk file
+ triggerDownload(fakeFolder, "linkfile.lnk");
+ QVERIFY(fakeFolder.syncOnce());
+ QVERIFY(vfs->pinState("linkfile.lnk").isValid());
+ QVERIFY(itemInstruction(completeSpy, "linkfile.lnk", CSYNC_INSTRUCTION_SYNC));
+
+ qInfo("Finishing .lnk test");
}
void testFolderDoesNotUpdatePlaceholderMetadata()