[glom/glom-1-20] test_document_load_and_change: Test renaming and removing of tables.



commit 65cf64689a1cec2209fc0debc094faf419d7b74c
Author: Murray Cumming <murrayc murrayc com>
Date:   Wed Nov 30 11:05:18 2011 +0100

    test_document_load_and_change: Test renaming and removing of tables.
    
    * tests/test_document_load_and_change.cc: This also checks that relationships
    are update when a table is renamed.

 ChangeLog                              |    7 +++++++
 tests/test_document_load_and_change.cc |   30 ++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c1670c1..067e30f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2011-11-30  Murray Cumming  <murrayc murrayc com>
 
+  test_document_load_and_change: Test renaming and removing of tables.
+
+	* tests/test_document_load_and_change.cc: This also checks that relationships
+	are update when a table is renamed.
+
+2011-11-30  Murray Cumming  <murrayc murrayc com>
+
 	test_document_load_and_change: Test print layout removal.
 
 	* tests/test_document_load_and_change.cc:
diff --git a/tests/test_document_load_and_change.cc b/tests/test_document_load_and_change.cc
index 093de41..064b3d4 100644
--- a/tests/test_document_load_and_change.cc
+++ b/tests/test_document_load_and_change.cc
@@ -148,6 +148,36 @@ int main()
     return false;
   }
   
+  //Change a table name:
+  const Glib::ustring table_renamed = "invoiceslinesrenamed";
+  document.change_table_name("invoice_lines", table_renamed);
+  if(document.get_table("invoice_lines"))
+  {
+    std::cerr << "Failure: The renamed table still exists." << std::endl;
+    return false;
+  }
+  
+  relationship = document.get_relationship("invoices", "invoice_lines");
+  if(!relationship)
+  {
+    std::cerr << "Failure: The expected relationship does not exist." << std::endl;
+    return false;
+  }
+
+  if(relationship->get_to_table() != table_renamed)
+  {
+    std::cerr << "Failure: The relationship's to_table does have been renamed." << std::endl;
+    return false;
+  }
+  
+  document.remove_table("products");
+  if(document.get_table("products"))
+  {
+    std::cerr << "Failure: The removed table still exists." << std::endl;
+    return false;
+  }
+
+ 
   //Remove a print layout:
   Glom::sharedptr<const Glom::PrintLayout> print_layout = 
     document.get_print_layout("contacts", "contact_details");



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