[glom] test_document_load: Test Document's user groups functions too.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] test_document_load: Test Document's user groups functions too.
- Date: Fri, 2 Dec 2011 13:07:41 +0000 (UTC)
commit 2d0f3557b9e856c6feca3ca37dd986a8d54918d5
Author: Murray Cumming <murrayc murrayc com>
Date: Fri Dec 2 14:07:27 2011 +0100
test_document_load: Test Document's user groups functions too.
* tests/test_document_load.cc: Check for expected group names and check
that we can remove one.
ChangeLog | 7 +++++++
tests/test_document_load.cc | 18 ++++++++++++++++++
2 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f5f845b..3523e2b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
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
+ that we can remove one.
+
+2011-12-02 Murray Cumming <murrayc murrayc com>
+
test_document_load: Test some navigation utility functions.
* glom/libglom/data_structure/layout/layoutgroup.cc: get_items_recursive():
diff --git a/tests/test_document_load.cc b/tests/test_document_load.cc
index 3f8d23a..4d6894d 100644
--- a/tests/test_document_load.cc
+++ b/tests/test_document_load.cc
@@ -45,6 +45,14 @@ bool contains_named(const T_Container& container, const Glib::ustring& name)
return iter != container.end();
}
+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();
+}
+
static Glom::sharedptr<const Glom::LayoutItem_Field> get_field_on_layout(const Glom::Document& document, const Glib::ustring& layout_table_name, const Glib::ustring& table_name, const Glib::ustring& field_name)
{
const Glom::Document::type_list_layout_groups groups =
@@ -284,6 +292,16 @@ int main()
std::cerr << "Failure: The print layout has no layout group." << std::endl;
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));
//Test navigation:
if(!needs_navigation(document, "scenes", "location_id"))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]