[glom] test_document_load: Test LayoutGroup::get_items_recursive().



commit 43f3ca95452a89f03928dc241734cef103373b42
Author: Murray Cumming <murrayc murrayc com>
Date:   Mon Dec 12 10:23:30 2011 +0100

    test_document_load: Test LayoutGroup::get_items_recursive().
    
    * tests/test_document_load.cc: And get_items_recursive_with_groups().

 ChangeLog                   |    6 ++++++
 tests/test_document_load.cc |   23 +++++++++++++++++++----
 2 files changed, 25 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index e5b9564..e682562 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2011-12-12  Murray Cumming  <murrayc murrayc com>
 
+	test_document_load: Test LayoutGroup::get_items_recursive().
+
+	* tests/test_document_load.cc: And get_items_recursive_with_groups().
+
+2011-12-12  Murray Cumming  <murrayc murrayc com>
+
 	Small fix to epository_analyzer_begin_scan example script.
 
 	* examples/example_scripts/repository_analyzer_begin_scan.py:
diff --git a/tests/test_document_load.cc b/tests/test_document_load.cc
index 379df59..47f17e9 100644
--- a/tests/test_document_load.cc
+++ b/tests/test_document_load.cc
@@ -194,6 +194,21 @@ int main()
   g_assert(relationship->get_to_field() == "contact_id");
 
 
+  //Check a layout:
+  const Glom::Document::type_list_layout_groups groups = 
+    document.get_data_layout_groups("details", "scenes");
+  g_assert(groups.size() == 3);
+  const Glom::sharedptr<const Glom::LayoutGroup> group =
+    groups[1];
+  const Glom::LayoutGroup::type_list_const_items items = 
+    group->get_items_recursive();
+  //std::cout << "size: " << items.size() << std::endl;
+  g_assert(items.size() == 13);
+  const Glom::LayoutGroup::type_list_const_items items_with_groups = 
+    group->get_items_recursive_with_groups();
+  //std::cout << "size: " << items_with_groups.size() << std::endl;
+  g_assert(items_with_groups.size() == 15);
+
   //Check that expected fields can be found on a layout.
   Glom::sharedptr<const Glom::LayoutItem_Field> field_on_layout = 
     get_field_on_layout(document, "scenes", "locations", "address_town");
@@ -309,9 +324,9 @@ int main()
 
   
   //Test user groups:
-  Glom::Document::type_list_groups groups = document.get_groups();
-  g_assert(groups_contain_named(groups, "glom_developer"));
-  g_assert(groups_contain_named(groups, "accounts"));
+  Glom::Document::type_list_groups user_groups = document.get_groups();
+  g_assert(groups_contain_named(user_groups, "glom_developer"));
+  g_assert(groups_contain_named(user_groups, "accounts"));
 
   //Test navigation:
   if(!needs_navigation(document, "scenes", "location_id"))
@@ -331,7 +346,7 @@ int main()
   //Note that related records portals don't have names.
   //This example portal shows the scenes_cast table, but should navigate though that to the cast table.
   const Glib::ustring portal_relationship_name = "scene_cast";
-  Glom::sharedptr<const Glom::LayoutItem_Portal> portal = 
+  Glom::sharedptr<const Glom::LayoutItem_Portal> portal =
     get_portal_from_details_layout(document, "scenes", portal_relationship_name);
   if(!portal)
   {



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