[glom] test_document_change: Test a little more API.



commit d16ee22b550d4b41c00ede76d6844f4b803cf75d
Author: Murray Cumming <murrayc murrayc com>
Date:   Tue Nov 29 12:38:34 2011 +0100

    test_document_change: Test a little more API.
    
    * tests/test_document_change.cc: Add a table and test some API that uses it.
      We could do much more here.

 ChangeLog                        |    7 +++++++
 glom/libglom/document/document.h |    2 +-
 tests/test_document_change.cc    |   19 +++++++++++++++++++
 3 files changed, 27 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 0b4597e..df1faf5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2011-11-29  Murray Cumming  <murrayc murrayc com>
 
+	test_document_change: Test a little more API.
+
+	* tests/test_document_change.cc: Add a table and test some API that uses it.
+  We could do much more here.
+
+2011-11-29  Murray Cumming  <murrayc murrayc com>
+
 	test_document_load_and_change: Test Document::remove_field() too.
 
 	* tests/test_document_load_and_change.cc: Exercise a little more of the API.
diff --git a/glom/libglom/document/document.h b/glom/libglom/document/document.h
index 3a7d835..db64044 100644
--- a/glom/libglom/document/document.h
+++ b/glom/libglom/document/document.h
@@ -261,7 +261,7 @@ public:
   void set_tables(const type_listTableInfo& tables);
 
   sharedptr<TableInfo> get_table(const Glib::ustring& table_name) const;
-  void add_table(const  sharedptr<TableInfo>& table_name);
+  void add_table(const sharedptr<TableInfo>& table_name);
 
   /** Use this after DROPing the table.
    * It removes information about the table, including fields and layouts,
diff --git a/tests/test_document_change.cc b/tests/test_document_change.cc
index 706d22d..06cc3c3 100644
--- a/tests/test_document_change.cc
+++ b/tests/test_document_change.cc
@@ -79,6 +79,25 @@ int main()
   document.set_startup_script(value);
   g_assert(document.get_startup_script() == value);
 
+
+  const Glib::ustring table_name = "sometable";
+  Glom::sharedptr<Glom::TableInfo> table_info(new Glom::TableInfo());
+  table_info->set_name(table_name);
+  
+  const Glib::ustring table_title = "sometabletitle";
+  table_info->set_title(table_title);
+  g_assert(table_info->get_title() == table_title);  
+  document.add_table(table_info);
+
+  const float x = 20.0f;
+  const float y = 30.0f;
+  document.set_table_overview_position(table_name, x, y);
+  float x_out = 0;
+  float y_out = 0;
+  document.get_table_overview_position(table_name, x_out, y_out);
+  g_assert(x == x_out);
+  g_assert(y == y_out);
+
   Glom::libglom_deinit();
 
   return EXIT_SUCCESS;



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