[glom/glom-1-20] test_document_load: Check a table title and its singular title.



commit 344d159aad2d394cc940ef5dff6451c8c70a1b8e
Author: Murray Cumming <murrayc murrayc com>
Date:   Sat Dec 3 15:02:48 2011 +0100

    test_document_load: Check a table title and its singular title.
    
    	* tests/test_document_load.cc: Also test
    	get_data_layout_groups_have_any_fields().
    
    Conflicts:
    
    	tests/test_document_load.cc

 ChangeLog                   |    7 +++++++
 tests/test_document_load.cc |   13 ++++++++++++-
 2 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 059fdca..8d0673f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2011-12-03  Murray Cumming  <murrayc murrayc com>
 
+	test_document_load: Check a table title and its singular title.
+
+	* tests/test_document_load.cc: Also test 
+	get_data_layout_groups_have_any_fields().
+
+2011-12-03  Murray Cumming  <murrayc murrayc com>
+
 	tests/test_document_load_and_change: Change a relationship name.
 
 	* Makefile_tests.am: Use the test_utils.
diff --git a/tests/test_document_load.cc b/tests/test_document_load.cc
index a68dd70..da62ac6 100644
--- a/tests/test_document_load.cc
+++ b/tests/test_document_load.cc
@@ -155,7 +155,12 @@ int main()
   g_assert(contains(table_names, "scenes"));
   g_assert(!contains(table_names, "Scenes")); //The title, not the name.
 
-  //Test known details of one table:
+  Glom::sharedptr<Glom::TableInfo> table = document.get_table("scenes");
+  g_assert(table);
+  g_assert( table->get_title() == "Scenes" );
+  g_assert( table->get_title_singular() == "Scene" );
+
+  //Test known fields of one table:
   const Glom::Document::type_vec_fields fields = document.get_table_fields("scenes");
   g_assert(contains_named(fields, "scene_id"));
   g_assert(contains_named(fields, "comments"));
@@ -171,10 +176,12 @@ int main()
   //Check some fields:
   Glom::sharedptr<const Glom::Field> field = document.get_field("contacts", "contact_id");
   g_assert(field);
+  g_assert( field->get_title() == "Contact ID" );
   g_assert(field->get_glom_type() == Glom::Field::TYPE_NUMERIC);
   g_assert(field->get_auto_increment());
   field = document.get_field("locations", "rent");
   g_assert(field);
+  g_assert( field->get_title() == "Rent" );
   g_assert(field->get_glom_type() == Glom::Field::TYPE_NUMERIC);
   g_assert(!field->get_auto_increment());
   g_assert(!field->get_unique_key());
@@ -219,6 +226,10 @@ int main()
   g_assert(field_on_layout->get_formatting_use_default());
   g_assert(field_on_layout->get_formatting_used() == formatting);
 
+  //Test this utility method:
+  g_assert( document.get_data_layout_groups_have_any_fields("list", "cars") );
+
+
   //Test library modules:
   const std::vector<Glib::ustring> module_names = document.get_library_module_names();
   if(!module_names.empty()) //TODO: Test a document that actually has some?



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