r22943 - gnucash/trunk - Tests: harmonize test initialization
    Geert Janssens 
    gjanssens at code.gnucash.org
       
    Fri May  3 08:03:53 EDT 2013
    
    
  
Author: gjanssens
Date: 2013-05-03 08:03:53 -0400 (Fri, 03 May 2013)
New Revision: 22943
Trac: http://svn.gnucash.org/trac/changeset/22943
Modified:
   gnucash/trunk/src/app-utils/test/test-sx.c
   gnucash/trunk/src/backend/dbi/test/test-backend-dbi.c
   gnucash/trunk/src/backend/sql/test/test-sqlbe.c
   gnucash/trunk/src/backend/xml/test/test-load-xml2.c
   gnucash/trunk/src/engine/test/test-engine.c
   gnucash/trunk/src/libqof/qof/test/test-qof.c
   gnucash/trunk/src/optional/gtkmm/test/test-gtkmm.cpp
   gnucash/trunk/test-templates/test-module.c
Log:
Tests: harmonize test initialization
In particular, use qof_init instead of g_type_init. The former
calls the latter by default. Also our current engine code is
heavily dependent on gobject, so it makes sense to initialize it
as early on as possible. Having once central place to do so
will make it easier to fix this if ever we move away from gobject.
Modified: gnucash/trunk/src/app-utils/test/test-sx.c
===================================================================
--- gnucash/trunk/src/app-utils/test/test-sx.c	2013-05-03 12:03:38 UTC (rev 22942)
+++ gnucash/trunk/src/app-utils/test/test-sx.c	2013-05-03 12:03:53 UTC (rev 22943)
@@ -194,7 +194,6 @@
 main(int argc, char **argv)
 {
     g_setenv ("GNC_UNINSTALLED", "1", TRUE);
-    g_type_init();
     qof_init();
     gnc_engine_init(0, NULL);
 
Modified: gnucash/trunk/src/backend/dbi/test/test-backend-dbi.c
===================================================================
--- gnucash/trunk/src/backend/dbi/test/test-backend-dbi.c	2013-05-03 12:03:38 UTC (rev 22942)
+++ gnucash/trunk/src/backend/dbi/test/test-backend-dbi.c	2013-05-03 12:03:53 UTC (rev 22943)
@@ -35,11 +35,10 @@
 main (int   argc,
       char *argv[])
 {
-    g_type_init(); 			/* Initialize the GObject system */
-    g_test_init ( &argc, &argv, NULL ); 	/* initialize test program */
+    qof_init(); /* equally initializes gobject system */
     qof_log_init_filename_special("stderr"); /* Init the log system */
+    g_test_init ( &argc, &argv, NULL );     /* initialize test program */
     g_test_bug_base("https://bugzilla.gnome.org/show_bug.cgi?id="); /* init the bugzilla URL */
-    qof_init();
     cashobjects_register();
     g_assert (qof_load_backend_library ("../.libs/", GNC_LIB_NAME));
     g_assert (qof_load_backend_library ("../../xml/.libs",
Modified: gnucash/trunk/src/backend/sql/test/test-sqlbe.c
===================================================================
--- gnucash/trunk/src/backend/sql/test/test-sqlbe.c	2013-05-03 12:03:38 UTC (rev 22942)
+++ gnucash/trunk/src/backend/sql/test/test-sqlbe.c	2013-05-03 12:03:53 UTC (rev 22943)
@@ -31,9 +31,9 @@
 main (int   argc,
       char *argv[])
 {
-    g_type_init(); 			/* Initialize the GObject system */
+    qof_init(); 			/* Initialize the GObject system */
+    qof_log_init_filename_special("stderr"); /* Init the log system */
     g_test_init ( &argc, &argv, NULL ); 	/* initialize test program */
-    qof_log_init_filename_special("stderr"); /* Init the log system */
     g_test_bug_base("https://bugzilla.gnome.org/show_bug.cgi?id="); /* init the bugzilla URL */
 
     test_suite_gnc_backend_sql ();
Modified: gnucash/trunk/src/backend/xml/test/test-load-xml2.c
===================================================================
--- gnucash/trunk/src/backend/xml/test/test-load-xml2.c	2013-05-03 12:03:38 UTC (rev 22942)
+++ gnucash/trunk/src/backend/xml/test/test-load-xml2.c	2013-05-03 12:03:53 UTC (rev 22943)
@@ -115,7 +115,6 @@
     const char *location = g_getenv("GNC_TEST_FILES");
     GDir *xml2_dir;
 
-    g_type_init();
     qof_init();
     cashobjects_register();
     do_test(qof_load_backend_library ("../.libs/", GNC_LIB_NAME),
Modified: gnucash/trunk/src/engine/test/test-engine.c
===================================================================
--- gnucash/trunk/src/engine/test/test-engine.c	2013-05-03 12:03:38 UTC (rev 22942)
+++ gnucash/trunk/src/engine/test/test-engine.c	2013-05-03 12:03:53 UTC (rev 22943)
@@ -35,9 +35,9 @@
 main (int   argc,
       char *argv[])
 {
-    g_type_init(); 			/* Initialize the GObject system */
+    qof_init(); 			/* Initialize the GObject system */
+    qof_log_init_filename_special("stderr"); /* Init the log system */
     g_test_init ( &argc, &argv, NULL ); 	/* initialize test program */
-    qof_log_init_filename_special("stderr"); /* Init the log system */
     //qof_log_set_level("gnc", G_LOG_LEVEL_DEBUG);
     g_test_bug_base("https://bugzilla.gnome.org/show_bug.cgi?id="); /* init the bugzilla URL */
 
Modified: gnucash/trunk/src/libqof/qof/test/test-qof.c
===================================================================
--- gnucash/trunk/src/libqof/qof/test/test-qof.c	2013-05-03 12:03:38 UTC (rev 22942)
+++ gnucash/trunk/src/libqof/qof/test/test-qof.c	2013-05-03 12:03:53 UTC (rev 22943)
@@ -37,9 +37,9 @@
 main (int   argc,
       char *argv[])
 {
-    g_type_init(); 			/* Initialize the GObject system */
+    qof_init(); 			/* Initialize the GObject system */
+    qof_log_init_filename_special("stderr"); /* Init the log system */
     g_test_init ( &argc, &argv, NULL ); 	/* initialize test program */
-    qof_log_init_filename_special("stderr"); /* Init the log system */
 //    g_log_set_always_fatal (0);
     g_test_bug_base("https://bugzilla.gnome.org/show_bug.cgi?id="); /* init the bugzilla URL */
 
Modified: gnucash/trunk/src/optional/gtkmm/test/test-gtkmm.cpp
===================================================================
--- gnucash/trunk/src/optional/gtkmm/test/test-gtkmm.cpp	2013-05-03 12:03:38 UTC (rev 22942)
+++ gnucash/trunk/src/optional/gtkmm/test/test-gtkmm.cpp	2013-05-03 12:03:53 UTC (rev 22943)
@@ -42,9 +42,9 @@
 main (int   argc,
       char *argv[])
 {
-    g_type_init(); 			/* Initialize the GObject system */
+    qof_init(); 			/* Initialize the GObject system */
+    qof_log_init_filename_special("stderr"); /* Init the log system */
     g_test_init ( &argc, &argv, NULL ); 	/* initialize test program */
-    qof_log_init_filename_special("stderr"); /* Init the log system */
     g_test_bug_base("https://bugzilla.gnome.org/show_bug.cgi?id="); /* init the bugzilla URL */
 
     // Initialize glibmm
Modified: gnucash/trunk/test-templates/test-module.c
===================================================================
--- gnucash/trunk/test-templates/test-module.c	2013-05-03 12:03:38 UTC (rev 22942)
+++ gnucash/trunk/test-templates/test-module.c	2013-05-03 12:03:53 UTC (rev 22943)
@@ -34,13 +34,13 @@
 main (int   argc,
       char *argv[])
 {
-    g_type_init();     /* You may or may not need this, depending on
+    qof_init();     /* You may or may not need this, depending on
 			* whether the module you're testing or any
 			* dependencies use GObject. */
-    g_test_init ( &argc, &argv, NULL ); /* initialize test program */
     qof_log_init_filename_special("/dev/null");    /* Initialize the
 			* gnucash logging system. Your tests will
 			* crash on the first logging call otherwise */
+    g_test_init ( &argc, &argv, NULL ); /* initialize test program */
     test_suite_module1();           /* Call each suite assembly function */
     test_suite_module2();
     test_suite_module3();
    
    
More information about the gnucash-changes
mailing list