[gnote] Fix create with title and body
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Fix create with title and body
- Date: Mon, 13 Apr 2020 14:32:19 +0000 (UTC)
commit 67801d51ff45c1f40688b65419ac147a3e2d3067
Author: Aurimas Černius <aurisc4 gmail com>
Date: Mon Apr 13 16:08:52 2020 +0300
Fix create with title and body
src/notemanagerbase.cpp | 3 +++
src/test/unit/notemanagerutests.cpp | 8 ++++++++
2 files changed, 11 insertions(+)
---
diff --git a/src/notemanagerbase.cpp b/src/notemanagerbase.cpp
index 25ae5e66..eed30b46 100644
--- a/src/notemanagerbase.cpp
+++ b/src/notemanagerbase.cpp
@@ -309,6 +309,9 @@ NoteBase::Ptr NoteManagerBase::create_note(Glib::ustring title, Glib::ustring bo
// it so it can be easily overwritten
content = get_note_template_content(title);
}
+ else {
+ content = get_note_content(title, body);
+ }
return create_new_note(title, content, "");
}
diff --git a/src/test/unit/notemanagerutests.cpp b/src/test/unit/notemanagerutests.cpp
index cb391217..76839bd1 100644
--- a/src/test/unit/notemanagerutests.cpp
+++ b/src/test/unit/notemanagerutests.cpp
@@ -85,6 +85,14 @@ SUITE(NoteManager)
CHECK_EQUAL(1, manager.get_notes().size());
}
+ TEST_FIXTURE(Fixture, create_with_text_content)
+ {
+ auto note = manager.create("test\ntest content");
+ CHECK_EQUAL("test", note->get_title());
+ CHECK(note->data().text().find("test content") != Glib::ustring::npos);
+ CHECK_EQUAL(1, manager.get_notes().size());
+ }
+
TEST_FIXTURE(Fixture, create_and_find)
{
manager.create();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]