[glom] test_document_load: Move changes into test_document_load_and_change.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] test_document_load: Move changes into test_document_load_and_change.
- Date: Fri, 2 Dec 2011 13:19:24 +0000 (UTC)
commit ba5c0874a371a185d36f48c504abf1f286f14da5
Author: Murray Cumming <murrayc murrayc com>
Date: Fri Dec 2 14:16:56 2011 +0100
test_document_load: Move changes into test_document_load_and_change.
* tests/test_document_load.cc:
* tests/test_document_load_and_change.cc:
ChangeLog | 7 +++++++
tests/test_document_load.cc | 7 +------
tests/test_document_load_and_change.cc | 19 ++++++++++++++++++-
3 files changed, 26 insertions(+), 7 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 3523e2b..df9dac1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2011-12-02 Murray Cumming <murrayc murrayc com>
+ test_document_load: Move changes into test_document_load_and_change.
+
+ * tests/test_document_load.cc:
+ * tests/test_document_load_and_change.cc:
+
+2011-12-02 Murray Cumming <murrayc murrayc com>
+
test_document_load: Test Document's user groups functions too.
* tests/test_document_load.cc: Check for expected group names and check
diff --git a/tests/test_document_load.cc b/tests/test_document_load.cc
index 4d6894d..fd01d39 100644
--- a/tests/test_document_load.cc
+++ b/tests/test_document_load.cc
@@ -296,12 +296,7 @@ int main()
//Test user groups:
Glom::Document::type_list_groups groups = document.get_groups();
g_assert(groups_contain_named(groups, "glom_developer"));
-
- const Glib::ustring group_name = "accounts";
- g_assert(groups_contain_named(groups, group_name));
- document.remove_group(group_name);
- groups = document.get_groups();
- g_assert(!groups_contain_named(groups, group_name));
+ g_assert(groups_contain_named(groups, "accounts"));
//Test navigation:
if(!needs_navigation(document, "scenes", "location_id"))
diff --git a/tests/test_document_load_and_change.cc b/tests/test_document_load_and_change.cc
index 064b3d4..2f21fdd 100644
--- a/tests/test_document_load_and_change.cc
+++ b/tests/test_document_load_and_change.cc
@@ -50,6 +50,14 @@ static bool field_is_on_a_layout(Glom::Document& document, const Glib::ustring&
return false;
}
+static bool groups_contain_named(const Glom::Document::type_list_groups& container, const Glib::ustring& name)
+{
+ const Glom::Document::type_list_groups::const_iterator iter =
+ std::find_if(container.begin(), container.end(),
+ Glom::predicate_FieldHasName<Glom::GroupInfo>(name));
+ return iter != container.end();
+}
+
int main()
{
Glom::libglom_init();
@@ -196,7 +204,16 @@ int main()
return false;
}
-
+ //Test user groups:
+ Glom::Document::type_list_groups groups = document.get_groups();
+ g_assert(groups_contain_named(groups, "glom_developer"));
+
+ const Glib::ustring group_name = "accounts";
+ g_assert(groups_contain_named(groups, group_name));
+ document.remove_group(group_name);
+ groups = document.get_groups();
+ g_assert(!groups_contain_named(groups, group_name));
+
Glom::libglom_deinit();
return EXIT_SUCCESS;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]