[libpeas: 5/18] Add testing_init() to libpeas-gtk's libtesting
- From: Steve Frécinaux <sfre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libpeas: 5/18] Add testing_init() to libpeas-gtk's libtesting
- Date: Fri, 4 Mar 2011 09:40:15 +0000 (UTC)
commit 2cc0d36fd2a35117d1c1f7c3cf7faacd45e967bc
Author: Garrett Regier <alias301 gmail com>
Date: Thu Mar 3 02:59:50 2011 -0800
Add testing_init() to libpeas-gtk's libtesting
This is to keep it in sync with libpeas' libtesting.
tests/libpeas-gtk/testing/testing.c | 42 +++++++++++++++++++---------------
tests/libpeas-gtk/testing/testing.h | 2 +
2 files changed, 25 insertions(+), 19 deletions(-)
---
diff --git a/tests/libpeas-gtk/testing/testing.c b/tests/libpeas-gtk/testing/testing.c
index 6f51ca2..887d012 100644
--- a/tests/libpeas-gtk/testing/testing.c
+++ b/tests/libpeas-gtk/testing/testing.c
@@ -82,36 +82,40 @@ out:
abort ();
}
-PeasEngine *
-testing_engine_new (void)
+void
+testing_init (void)
{
GError *error = NULL;
static gboolean initialized = FALSE;
- if (engine != NULL)
- return engine;
+ if (initialized)
+ return;
- if (!initialized)
- {
- /* Don't always abort on warnings */
- g_log_set_always_fatal (G_LOG_LEVEL_CRITICAL);
+ /* Don't always abort on warnings */
+ g_log_set_always_fatal (G_LOG_LEVEL_CRITICAL);
+
+ default_log_func = g_log_set_default_handler (log_handler, NULL);
- default_log_func = g_log_set_default_handler (log_handler, NULL);
+ g_irepository_prepend_search_path (BUILDDIR "/libpeas");
+ g_irepository_prepend_search_path (BUILDDIR "/libpeas-gtk");
- g_irepository_prepend_search_path (BUILDDIR "/libpeas");
- g_irepository_prepend_search_path (BUILDDIR "/libpeas-gtk");
+ g_setenv ("PEAS_PLUGIN_LOADERS_DIR", BUILDDIR "/loaders", TRUE);
- g_setenv ("PEAS_PLUGIN_LOADERS_DIR", BUILDDIR "/loaders", TRUE);
+ g_irepository_require (g_irepository_get_default (), "Peas", "1.0", 0, &error);
+ g_assert_no_error (error);
+ g_irepository_require (g_irepository_get_default (), "PeasGtk", "1.0", 0, &error);
+ g_assert_no_error (error);
- g_irepository_require (g_irepository_get_default (), "Peas", "1.0", 0, &error);
- g_assert_no_error (error);
- g_irepository_require (g_irepository_get_default (), "PeasGtk", "1.0", 0, &error);
- g_assert_no_error (error);
+ initialized = TRUE;
+}
- g_atexit (peas_engine_shutdown);
+PeasEngine *
+testing_engine_new (void)
+{
+ if (engine != NULL)
+ return engine;
- initialized = TRUE;
- }
+ testing_init ();
/* Must be after requiring typelibs */
engine = peas_engine_new ();
diff --git a/tests/libpeas-gtk/testing/testing.h b/tests/libpeas-gtk/testing/testing.h
index 4f20165..58f96a4 100644
--- a/tests/libpeas-gtk/testing/testing.h
+++ b/tests/libpeas-gtk/testing/testing.h
@@ -27,6 +27,8 @@
G_BEGIN_DECLS
+void testing_init (void);
+
PeasEngine *testing_engine_new (void);
void testing_engine_free (PeasEngine *engine);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]