[gnote] Fix test suite build
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Fix test suite build
- Date: Tue, 8 Oct 2019 20:04:56 +0000 (UTC)
commit fab3522d84c33200cde4a7b4a8abdc57a3c812f3
Author: Aurimas Černius <aurisc4 gmail com>
Date: Sun Oct 6 22:09:56 2019 +0300
Fix test suite build
src/test/testnotemanager.cpp | 3 ++-
src/test/testnotemanager.hpp | 17 +++++++++++++++++
src/test/testtagmanager.cpp | 11 -----------
src/test/testtagmanager.hpp | 9 +++++----
src/test/unit/gnotesyncclientutests.cpp | 2 --
src/test/unit/notemanagerutests.cpp | 4 +---
src/test/unit/syncmanagerutests.cpp | 3 ---
7 files changed, 25 insertions(+), 24 deletions(-)
---
diff --git a/src/test/testnotemanager.cpp b/src/test/testnotemanager.cpp
index 7833059e..501367b9 100644
--- a/src/test/testnotemanager.cpp
+++ b/src/test/testnotemanager.cpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2014,2017 Aurimas Cernius
+ * Copyright (C) 2014,2017,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
@@ -32,6 +32,7 @@ Glib::ustring NoteManager::test_notes_dir()
NoteManager::NoteManager(const Glib::ustring & notesdir)
: gnote::NoteManagerBase(notesdir)
+ , m_note_archiver(*this)
{
Glib::ustring backup = notesdir + "/Backup";
_common_init(notesdir, backup);
diff --git a/src/test/testnotemanager.hpp b/src/test/testnotemanager.hpp
index 6ef08651..9e1e4f12 100644
--- a/src/test/testnotemanager.hpp
+++ b/src/test/testnotemanager.hpp
@@ -18,6 +18,7 @@
*/
#include "notemanagerbase.hpp"
+#include "test/testtagmanager.hpp"
namespace test {
@@ -29,9 +30,25 @@ public:
static Glib::ustring test_notes_dir();
explicit NoteManager(const Glib::ustring & notes_dir);
+
+ virtual gnote::NoteArchiver & note_archiver() override
+ {
+ return m_note_archiver;
+ }
+ virtual const gnote::ITagManager & tag_manager() const override
+ {
+ return m_tag_manager;
+ }
+ virtual gnote::ITagManager & tag_manager() override
+ {
+ return m_tag_manager;
+ }
protected:
virtual gnote::NoteBase::Ptr note_create_new(const Glib::ustring & title, const Glib::ustring & file_name)
override;
virtual gnote::NoteBase::Ptr note_load(const Glib::ustring & file_name) override;
+private:
+ gnote::NoteArchiver m_note_archiver;
+ TagManager m_tag_manager;
};
}
diff --git a/src/test/testtagmanager.cpp b/src/test/testtagmanager.cpp
index d1715cb9..04886cca 100644
--- a/src/test/testtagmanager.cpp
+++ b/src/test/testtagmanager.cpp
@@ -22,17 +22,6 @@
namespace test {
-TagManager *TagManager::s_manager = NULL;
-
-void TagManager::ensure_exists()
-{
- // existing tag manager can be invalid, recreate it for new test
- if(s_manager != NULL) {
- delete s_manager;
- }
- s_manager = new TagManager;
-}
-
gnote::Tag::Ptr TagManager::get_tag(const Glib::ustring & tag_name) const
{
auto iter = m_tags.find(tag_name);
diff --git a/src/test/testtagmanager.hpp b/src/test/testtagmanager.hpp
index 259d8f88..0fb9409b 100644
--- a/src/test/testtagmanager.hpp
+++ b/src/test/testtagmanager.hpp
@@ -18,6 +18,9 @@
*/
+#ifndef _TESTTAGMANAGER_HPP_
+#define _TESTTAGMANAGER_HPP_
+
#include "itagmanager.hpp"
namespace test {
@@ -26,8 +29,6 @@ class TagManager
: public gnote::ITagManager
{
public:
- static void ensure_exists();
-
virtual gnote::Tag::Ptr get_tag(const Glib::ustring & tag_name) const override;
virtual gnote::Tag::Ptr get_or_create_tag(const Glib::ustring &) override;
virtual gnote::Tag::Ptr get_system_tag(const Glib::ustring & tag_name) const override;
@@ -35,10 +36,10 @@ public:
virtual void remove_tag(const gnote::Tag::Ptr & tag) override;
virtual std::vector<gnote::Tag::Ptr> all_tags() const override;
private:
- static TagManager* s_manager;
-
std::map<Glib::ustring, gnote::Tag::Ptr> m_tags;
};
}
+#endif
+
diff --git a/src/test/unit/gnotesyncclientutests.cpp b/src/test/unit/gnotesyncclientutests.cpp
index f24beded..cd48eb74 100644
--- a/src/test/unit/gnotesyncclientutests.cpp
+++ b/src/test/unit/gnotesyncclientutests.cpp
@@ -24,7 +24,6 @@
#include "test/testnotemanager.hpp"
#include "test/testsyncclient.hpp"
-#include "test/testtagmanager.hpp"
SUITE(GnoteSyncClient)
@@ -69,7 +68,6 @@ TEST(manifest_parsing)
{
Glib::ustring test_manifest = create_manifest();
- new test::TagManager;
test::NoteManager manager(test::NoteManager::test_notes_dir());
test::SyncClient client(manager);
client.set_manifest_path(test_manifest);
diff --git a/src/test/unit/notemanagerutests.cpp b/src/test/unit/notemanagerutests.cpp
index 41fc40f4..d8ba4f79 100644
--- a/src/test/unit/notemanagerutests.cpp
+++ b/src/test/unit/notemanagerutests.cpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2017 Aurimas Cernius
+ * Copyright (C) 2017,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
@@ -21,7 +21,6 @@
#include <UnitTest++/UnitTest++.h>
#include "test/testnotemanager.hpp"
-#include "test/testtagmanager.hpp"
SUITE(NoteManager)
@@ -32,7 +31,6 @@ SUITE(NoteManager)
char *notes_dir = g_mkdtemp(notes_dir_tmpl);
CHECK(notes_dir != NULL);
- new test::TagManager;
test::NoteManager manager(notes_dir);
manager.create();
manager.create();
diff --git a/src/test/unit/syncmanagerutests.cpp b/src/test/unit/syncmanagerutests.cpp
index 733994e0..f6acc6ad 100644
--- a/src/test/unit/syncmanagerutests.cpp
+++ b/src/test/unit/syncmanagerutests.cpp
@@ -31,7 +31,6 @@
#include "test/testnote.hpp"
#include "test/testnotemanager.hpp"
#include "test/testsyncmanager.hpp"
-#include "test/testtagmanager.hpp"
using namespace gnote;
@@ -62,8 +61,6 @@ SUITE(SyncManagerTests)
manifest1 = notes_dir1 + "/manifest.xml";
manifest2 = notes_dir2 + "/manifest.xml";
- test::TagManager::ensure_exists();
-
manager1 = new test::NoteManager(notesdir1);
create_note(*manager1, "note1", "content1");
create_note(*manager1, "note2", "content2");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]