[glom] test_document_load: Check a table title and its singular title.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] test_document_load: Check a table title and its singular title.
- Date: Sat, 3 Dec 2011 14:02:58 +0000 (UTC)
commit 11cab2483c2f31b2439d91eae3b583f24a0e1740
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().
ChangeLog | 7 +++++++
tests/test_document_load.cc | 12 +++++++++++-
2 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 4f5edb4..8965404 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 4d8838a..7ed352d 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,9 @@ 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();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]