[gnote] Add test_notes_dir() to TestNoteManager



commit bbbf269d4727130133b3843a8b264bf6f12858af
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Tue Aug 5 23:17:17 2014 +0300

    Add test_notes_dir() to TestNoteManager
    
    Common code for reuse in multiple tests.

 src/test/testnotemanager.cpp |    8 ++++++++
 src/test/testnotemanager.hpp |    2 ++
 2 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/src/test/testnotemanager.cpp b/src/test/testnotemanager.cpp
index dd96014..ef24540 100644
--- a/src/test/testnotemanager.cpp
+++ b/src/test/testnotemanager.cpp
@@ -22,6 +22,14 @@
 
 namespace test {
 
+Glib::ustring NoteManager::test_notes_dir()
+{
+  char notes_dir_tmpl[] = "/tmp/gnotetestnotesXXXXXX";
+  char *notes_dir = g_mkdtemp(notes_dir_tmpl);
+  return Glib::ustring(notes_dir) + "/notes";
+}
+
+
 NoteManager::NoteManager(const Glib::ustring & notesdir)
   : gnote::NoteManagerBase(notesdir)
 {
diff --git a/src/test/testnotemanager.hpp b/src/test/testnotemanager.hpp
index 3875862..1be3332 100644
--- a/src/test/testnotemanager.hpp
+++ b/src/test/testnotemanager.hpp
@@ -27,6 +27,8 @@ class NoteManager
   : public gnote::NoteManagerBase
 {
 public:
+  static Glib::ustring test_notes_dir();
+
   explicit NoteManager(const Glib::ustring & notes_dir);
 protected:
   virtual gnote::NoteBase::Ptr note_create_new(const Glib::ustring & title, const Glib::ustring & file_name) 
override;


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