[glom] test_document_load: Check reports too.



commit a3f99d3ed5528d8dc481d3adcd2cb4a7d2458e16
Author: Murray Cumming <murrayc murrayc com>
Date:   Sat Dec 3 16:52:21 2011 +0100

    test_document_load: Check reports too.
    
    * tests/test_document_load.cc: Check some report names.

 ChangeLog                   |    6 ++++++
 tests/test_document_load.cc |   35 +++++++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 8965404..2611f5b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2011-12-03  Murray Cumming  <murrayc murrayc com>
 
+	test_document_load: Check reports too.
+
+	* tests/test_document_load.cc: Check some report names.
+
+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 
diff --git a/tests/test_document_load.cc b/tests/test_document_load.cc
index 7ed352d..d2ba126 100644
--- a/tests/test_document_load.cc
+++ b/tests/test_document_load.cc
@@ -272,6 +272,41 @@ int main()
     std::cerr << "Failure: The print layout has no layout group." << std::endl;
     return false;
   }
+
+
+  const Glom::Document::type_listReports report_names = 
+    document.get_report_names("contacts");
+  if(report_names.size() != 2)
+  {
+    std::cerr << "Failure: Unexpected number of reports." << std::endl;
+    return false;
+  }
+
+  if(!contains(report_names, "by_country"))
+  {
+    std::cerr << "Failure: Could not find the expected report name." << std::endl;
+    return false;
+  }
+
+  const Glom::sharedptr<const Glom::Report> report = document.get_report("contacts", "by_country_by_town");
+  if(!print_layout)
+  {
+    std::cerr << "Failure: Could not get an expected report." << std::endl;
+    return false;
+  }
+  
+  if(report->get_title() != "By Country, By Town")
+  {
+    std::cerr << "Failure: Unexpected report title." << std::endl;
+    return false;
+  }
+  
+  if(!report->m_layout_group)
+  {
+    std::cerr << "Failure: The report has no layout group." << std::endl;
+    return false;
+  }
+
   
   //Test user groups:
   Glom::Document::type_list_groups groups = document.get_groups();



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