[glom] test_load_and_change(): Test removal of a relationship.



commit e2b4d040dc23da8cf23ab5ef0a918a11bc4bec5c
Author: Murray Cumming <murrayc murrayc com>
Date:   Wed Nov 30 10:18:14 2011 +0100

    test_load_and_change(): Test removal of a relationship.
    
    	* tests/test_document_load_and_change.cc: Test Document::remove_relationship().

 ChangeLog                              |    6 ++++++
 tests/test_document_load_and_change.cc |   11 ++++++++++-
 2 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7cc773b..ec27ad3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2011-11-30  Murray Cumming  <murrayc murrayc com>
 
+	test_load_and_change(): Test removal of a relationship.
+
+	* tests/test_document_load_and_change.cc: Test Document::remove_relationship().
+
+2011-11-30  Murray Cumming  <murrayc murrayc com>
+
 	test_document_load: Test field formatting.
 
 	* tests/test_document_load.cc: Also use a different example, to
diff --git a/tests/test_document_load_and_change.cc b/tests/test_document_load_and_change.cc
index bc357ab..a9c46e0 100644
--- a/tests/test_document_load_and_change.cc
+++ b/tests/test_document_load_and_change.cc
@@ -110,7 +110,7 @@ int main()
   }
 
   //Check that the original field name is no longer used in the relationship:
-  const Glom::sharedptr<const Glom::Relationship> relationship = document.get_relationship("invoice_lines", "products");
+  Glom::sharedptr<const Glom::Relationship> relationship = document.get_relationship("invoice_lines", "products");
   if(!relationship)
   {
     std::cerr << "Failure: The relationship could not be found in the document." << std::endl;
@@ -138,6 +138,15 @@ int main()
     std::cerr << "Failure: The removed field name is still used on a layout." << std::endl;
     return false;
   }
+  
+  //Remove a relationship:
+  document.remove_relationship(relationship);
+  relationship = document.get_relationship("invoice_lines", "products");
+  if(relationship)
+  {
+    std::cerr << "Failure: The removed relationship still exists." << std::endl;
+    return false;
+  }  
 
   Glom::libglom_deinit();
 



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