[gnote: 11/21] Pass path to sync addin, fix test crash when performing sync
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote: 11/21] Pass path to sync addin, fix test crash when performing sync
- Date: Tue, 20 Jun 2017 20:15:50 +0000 (UTC)
commit 1e0a99064dc57b742982f9c87500ec48c3e847c9
Author: Aurimas Černius <aurisc4 gmail com>
Date: Sun Apr 9 17:03:41 2017 +0300
Pass path to sync addin, fix test crash when performing sync
src/test/testsyncaddin.cpp | 8 +++++++-
src/test/testsyncaddin.hpp | 3 +++
src/test/testsyncmanager.cpp | 5 +++--
src/test/testsyncmanager.hpp | 4 +++-
src/test/unit/syncmanagerutests.cpp | 7 ++++---
5 files changed, 20 insertions(+), 7 deletions(-)
---
diff --git a/src/test/testsyncaddin.cpp b/src/test/testsyncaddin.cpp
index 37f1e95..fb2740f 100644
--- a/src/test/testsyncaddin.cpp
+++ b/src/test/testsyncaddin.cpp
@@ -19,13 +19,19 @@
#include "testsyncaddin.hpp"
+#include "synchronization/filesystemsyncserver.hpp"
namespace test {
+SyncAddin::SyncAddin(const Glib::ustring & sync_path)
+ : m_sync_path(sync_path)
+{
+}
+
gnote::sync::SyncServer::Ptr SyncAddin::create_sync_server()
{
- return gnote::sync::SyncServer::Ptr();
+ return gnote::sync::FileSystemSyncServer::create(m_sync_path, "test");
}
void SyncAddin::post_sync_cleanup()
diff --git a/src/test/testsyncaddin.hpp b/src/test/testsyncaddin.hpp
index c438794..fa189e6 100644
--- a/src/test/testsyncaddin.hpp
+++ b/src/test/testsyncaddin.hpp
@@ -32,6 +32,7 @@ class SyncAddin
: public gnote::sync::SyncServiceAddin
{
public:
+ SyncAddin(const Glib::ustring & sync_path);
virtual gnote::sync::SyncServer::Ptr create_sync_server() override;
virtual void post_sync_cleanup() override;
virtual Gtk::Widget *create_preferences_control(EventHandler requiredPrefChanged) override;
@@ -44,6 +45,8 @@ public:
virtual void initialize() override;
virtual void shutdown() override;
virtual bool initialized() override;
+private:
+ Glib::ustring m_sync_path;
};
}
diff --git a/src/test/testsyncmanager.cpp b/src/test/testsyncmanager.cpp
index eaedb5e..26fbedc 100644
--- a/src/test/testsyncmanager.cpp
+++ b/src/test/testsyncmanager.cpp
@@ -23,8 +23,9 @@
namespace test {
-SyncManager::SyncManager(gnote::NoteManagerBase & manager)
+SyncManager::SyncManager(gnote::NoteManagerBase & manager, const Glib::ustring & sync_path)
: gnote::sync::SyncManager(manager)
+ , m_sync_path(sync_path)
{
m_client = gnote::sync::SyncClient::Ptr(new test::SyncClient(manager));
}
@@ -58,7 +59,7 @@ bool SyncManager::synchronized_note_xml_matches(const Glib::ustring & noteXml1,
gnote::sync::SyncServiceAddin *SyncManager::get_sync_service_addin(const Glib::ustring & sync_service_id)
{
- return new SyncAddin();
+ return new SyncAddin(m_sync_path);
}
gnote::sync::SyncServiceAddin *SyncManager::get_configured_sync_service()
diff --git a/src/test/testsyncmanager.hpp b/src/test/testsyncmanager.hpp
index ec5a1f3..0eb581d 100644
--- a/src/test/testsyncmanager.hpp
+++ b/src/test/testsyncmanager.hpp
@@ -32,7 +32,7 @@ class SyncManager
: public gnote::sync::SyncManager
{
public:
- SyncManager(gnote::NoteManagerBase&);
+ SyncManager(gnote::NoteManagerBase & note_manager, const Glib::ustring & sync_path);
virtual void reset_client() override;
virtual void perform_synchronization(const gnote::sync::SyncUI::Ptr & sync_ui) override;
virtual void resolve_conflict(gnote::sync::SyncTitleConflictResolution resolution) override;
@@ -40,6 +40,8 @@ public:
virtual gnote::sync::SyncServiceAddin *get_sync_service_addin(const Glib::ustring & sync_service_id)
override;
virtual gnote::sync::SyncServiceAddin *get_configured_sync_service() override;
test::SyncClient::Ptr get_client(const Glib::ustring & manifest);
+private:
+ Glib::ustring m_sync_path;
};
}
diff --git a/src/test/unit/syncmanagerutests.cpp b/src/test/unit/syncmanagerutests.cpp
index 5ed6230..a39f27a 100644
--- a/src/test/unit/syncmanagerutests.cpp
+++ b/src/test/unit/syncmanagerutests.cpp
@@ -62,10 +62,11 @@ TEST(clean_sync)
test::NoteManager manager2(notesdir2);
- test::SyncManager sync_manager1(manager1);
- test::SyncManager sync_manager2(manager2);
+ test::SyncManager sync_manager1(manager1, syncdir);
+ test::SyncManager sync_manager2(manager2, syncdir);
test::SyncClient::Ptr sync_client1 =
dynamic_pointer_cast<test::SyncClient>(sync_manager1.get_client(manifest));
gnote::sync::SilentUI::Ptr sync_ui = gnote::sync::SilentUI::create(manager1);
- //sync_manager1.perform_synchronization(sync_ui); //TODO: fails, return proper server from test SyncAddin
+ sync_manager1.perform_synchronization(sync_ui);
+ // TODO: results in various errors and sync actually fails
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]