[glom] Fix the tests after the libgdamm Null Value change.



commit 12e2fb525744084c83f943dd24665e2153dc6d0e
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Jun 17 17:53:34 2011 +0200

    Fix the tests after the libgdamm Null Value change.
    
    * tests/python/test_python_execute_script.cc:
      Do not try to instantiate a static Value instance because the constructor
      now needs the GType system to be initialized.

 ChangeLog                                  |    8 ++++++++
 tests/python/test_python_execute_script.cc |   14 +++++++++++---
 2 files changed, 19 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 99c189b..2027b3f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2011-06-17  Murray Cumming  <murrayc murrayc com>
 
+  Fix the tests after the libgdamm Null Value change.
+  
+	* tests/python/test_python_execute_script.cc:
+  Do not try to instantiate a static Value instance because the constructor 
+  now needs the GType system to be initialized.
+
+2011-06-17  Murray Cumming  <murrayc murrayc com>
+
 	Details: Make Primary Key ID values visible again.
 
 	* glom/mode_data/datawidget/entry.cc: Use unset_color() instead of 
diff --git a/tests/python/test_python_execute_script.cc b/tests/python/test_python_execute_script.cc
index 125c8ae..93caf65 100644
--- a/tests/python/test_python_execute_script.cc
+++ b/tests/python/test_python_execute_script.cc
@@ -5,7 +5,15 @@
 //Store results from the callbacks and check them later:
 Glib::ustring result_table_name_list;
 Glib::ustring result_table_name_details;
-Gnome::Gda::Value result_primary_key_value_details;
+
+//This can't be a normal global variable,
+//because it would be initialized before we have initialized the glib type system.
+static Gnome::Gda::Value& get_result_primary_key_value_details_instance()
+{
+  static Gnome::Gda::Value result_primary_key_value_details;
+  return result_primary_key_value_details;
+}
+
 Glib::ustring result_report_name;
 bool result_printed_layout = false;
 bool result_started_new_record = false;
@@ -21,7 +29,7 @@ static void on_script_ui_show_table_details(const Glib::ustring& table_name, con
   //std::cout << "debug: " << G_STRFUNC << ": table_name=" << table_name
   //  << ", primary_key_value=" << primary_key_value.to_string() << std::endl;
   result_table_name_details = table_name;
-  result_primary_key_value_details = primary_key_value;
+  get_result_primary_key_value_details_instance() = primary_key_value;
 }
 
 static void on_script_ui_print_report(const Glib::ustring& report_name)
@@ -104,7 +112,7 @@ int main()
   //Check that the callbacks received the expected values:
   g_assert(result_table_name_list == table_name_input);
   g_assert(result_table_name_details == table_name_details_input);
-  g_assert(result_primary_key_value_details == primary_key_value_input);
+  g_assert(get_result_primary_key_value_details_instance() == primary_key_value_input);
   g_assert(result_report_name == report_name_input);
   g_assert(result_printed_layout);
   g_assert(result_started_new_record);



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