From 010abe4c823af3dae7078854d1096f25b8b7225c Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Wed, 23 Jan 2019 15:12:02 +0100 Subject: Pin state updates - unspecified and inherited are different - move enum to header in common/ - access through Vfs instead of directly in Journal --- test/syncenginetestutils.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'test/syncenginetestutils.h') diff --git a/test/syncenginetestutils.h b/test/syncenginetestutils.h index b4f9e89d5..549d0092f 100644 --- a/test/syncenginetestutils.h +++ b/test/syncenginetestutils.h @@ -12,6 +12,7 @@ #include "filesystem.h" #include "syncengine.h" #include "common/syncjournaldb.h" +#include "common/vfs.h" #include "csync_exclude.h" #include @@ -1139,12 +1140,41 @@ public: // Ignore temporary files from the download. (This is in the default exclude list, but we don't load it) _syncEngine->excludedFiles().addManualExclude("]*.~*"); + // Ensure we have a valid VfsOff instance "running" + switchToVfs(_syncEngine->syncOptions()._vfs); + // A new folder will update the local file state database on first sync. // To have a state matching what users will encounter, we have to a sync // using an identical local/remote file tree first. syncOnce(); } + void switchToVfs(QSharedPointer vfs) + { + auto opts = _syncEngine->syncOptions(); + + opts._vfs->stop(); + QObject::disconnect(_syncEngine.get(), 0, opts._vfs.data(), 0); + + opts._vfs = vfs; + _syncEngine->setSyncOptions(opts); + + OCC::VfsSetupParams vfsParams; + vfsParams.filesystemPath = localPath(); + vfsParams.remotePath = ""; + vfsParams.account = _account; + vfsParams.journal = _journalDb.get(); + vfsParams.providerName = "OC-TEST"; + vfsParams.providerVersion = "0.1"; + vfsParams.enableShellIntegration = false; + QObject::connect(_syncEngine.get(), &QObject::destroyed, vfs.data(), [vfs]() { + vfs->stop(); + vfs->unregisterFolder(); + }); + + vfs->start(vfsParams); + } + OCC::AccountPtr account() const { return _account; } OCC::SyncEngine &syncEngine() const { return *_syncEngine; } OCC::SyncJournalDb &syncJournal() const { return *_journalDb; } -- cgit v1.2.3