diff options
author | Christian Kamm <mail@ckamm.de> | 2019-01-23 17:12:02 +0300 |
---|---|---|
committer | ckamm <mail@ckamm.de> | 2019-02-11 15:35:14 +0300 |
commit | 010abe4c823af3dae7078854d1096f25b8b7225c (patch) | |
tree | 48852485d65dd29243f6e2a5fec69706b4294b76 /test/syncenginetestutils.h | |
parent | 8ea639e58f2d2599f3f966f9f65a4f29c025ca43 (diff) |
Pin state updates
- unspecified and inherited are different
- move enum to header in common/
- access through Vfs instead of directly in Journal
Diffstat (limited to 'test/syncenginetestutils.h')
-rw-r--r-- | test/syncenginetestutils.h | 30 |
1 files changed, 30 insertions, 0 deletions
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 <cstring> @@ -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<OCC::Vfs> 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; } |