[gnote] Add test Gnote



commit 8802457a0cc7e02367955b144266db7c329cee3b
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sun Dec 22 22:24:43 2019 +0200

    Add test Gnote

 src/Makefile.am        |   1 +
 src/test/testgnote.cpp | 100 +++++++++++++++++++++++++++++++++++++++++++++++++
 src/test/testgnote.hpp |  57 ++++++++++++++++++++++++++++
 3 files changed, 158 insertions(+)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 0adc8549..53189385 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -33,6 +33,7 @@ gnoteunittests_SOURCES = \
        synchronization/silentui.cpp synchronization/silentui.hpp \
        synchronization/syncmanager.cpp synchronization/syncmanager.hpp \
        test/runner.cpp \
+       test/testgnote.cpp test/testgnote.hpp \
        test/testnote.cpp test/testnote.hpp \
        test/testnotemanager.cpp test/testnotemanager.hpp \
        test/testsyncaddin.cpp test/testsyncaddin.hpp \
diff --git a/src/test/testgnote.cpp b/src/test/testgnote.cpp
new file mode 100644
index 00000000..b87cd035
--- /dev/null
+++ b/src/test/testgnote.cpp
@@ -0,0 +1,100 @@
+/*
+ * gnote
+ *
+ * Copyright (C) 2019 Aurimas Cernius
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include "testgnote.hpp"
+
+namespace test {
+
+Gnote::Gnote()
+  : m_notebook_manager(nullptr)
+  , m_sync_manager(nullptr)
+{
+}
+
+gnote::IActionManager & Gnote::action_manager()
+{
+  throw std::logic_error(std::string("Not implemented ") + __FUNCTION__);
+}
+
+gnote::IconManager & Gnote::icon_manager()
+{
+  throw std::logic_error(std::string("Not implemented ") + __FUNCTION__);
+}
+
+gnote::notebooks::NotebookManager & Gnote::notebook_manager()
+{
+  if(m_notebook_manager == nullptr) {
+    throw std::logic_error("NotebookManager not set");
+  }
+
+  return *m_notebook_manager;
+}
+
+void Gnote::notebook_manager(gnote::notebooks::NotebookManager *manager)
+{
+  m_notebook_manager = manager;
+}
+
+gnote::sync::ISyncManager & Gnote::sync_manager()
+{
+  if(m_sync_manager == nullptr) {
+    throw std::logic_error("SyncManager not set");
+  }
+
+  return *m_sync_manager;
+}
+
+void Gnote::sync_manager(gnote::sync::ISyncManager* manager)
+{
+  m_sync_manager = manager;
+}
+
+gnote::Preferences & Gnote::preferences()
+{
+  throw std::logic_error(std::string("Not implemented ") + __FUNCTION__);
+}
+
+gnote::MainWindow & Gnote::get_main_window()
+{
+  throw std::logic_error(std::string("Not implemented ") + __FUNCTION__);
+}
+
+gnote::MainWindow & Gnote::get_window_for_note()
+{
+  throw std::logic_error(std::string("Not implemented ") + __FUNCTION__);
+}
+
+gnote::MainWindow & Gnote::new_main_window()
+{
+  throw std::logic_error(std::string("Not implemented ") + __FUNCTION__);
+}
+
+void Gnote::open_note(const gnote::Note::Ptr & /*note*/)
+{
+  throw std::logic_error(std::string("Not implemented ") + __FUNCTION__);
+}
+
+gnote::MainWindow & Gnote::open_search_all()
+{
+  throw std::logic_error(std::string("Not implemented ") + __FUNCTION__);
+}
+
+}
+
diff --git a/src/test/testgnote.hpp b/src/test/testgnote.hpp
new file mode 100644
index 00000000..d8468fd3
--- /dev/null
+++ b/src/test/testgnote.hpp
@@ -0,0 +1,57 @@
+/*
+ * gnote
+ *
+ * Copyright (C) 2019 Aurimas Cernius
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _TEST_TESTGNOTE_HPP_
+#define _TEST_TESTGNOTE_HPP_
+
+#include "ignote.hpp"
+
+namespace test {
+
+class Gnote
+  : public gnote::IGnote
+{
+public:
+  Gnote();
+  virtual ~Gnote()
+  {}
+
+  virtual gnote::IActionManager & action_manager() override;
+  virtual gnote::IconManager & icon_manager() override;
+  virtual gnote::notebooks::NotebookManager & notebook_manager() override;
+  void notebook_manager(gnote::notebooks::NotebookManager *manager);
+  virtual gnote::sync::ISyncManager & sync_manager() override;
+  void sync_manager(gnote::sync::ISyncManager* manager);
+  virtual gnote::Preferences & preferences() override;
+
+  virtual gnote::MainWindow & get_main_window() override;
+  virtual gnote::MainWindow & get_window_for_note() override;
+  virtual gnote::MainWindow & new_main_window() override;
+  virtual void open_note(const gnote::Note::Ptr & note) override;
+  virtual gnote::MainWindow & open_search_all() override;
+private:
+  gnote::notebooks::NotebookManager *m_notebook_manager;
+  gnote::sync::ISyncManager *m_sync_manager;
+};
+
+}
+
+#endif
+


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]