[libgda] Meson: adding missing worker connect test



commit 744d6d76d354255356f7933b0a21d9f19236ae0a
Author: Daniel Espinosa <esodan gmail com>
Date:   Thu Sep 27 15:19:09 2018 -0500

    Meson: adding missing worker connect test

 libgda/meson.build                   | 17 ++++++++++++++-
 libgda/thread-wrapper/meson.build    | 14 ++++++++++++-
 tests/multi-threading/dummy-object.c | 40 ++++++++----------------------------
 tests/multi-threading/dummy-object.h | 15 +-------------
 4 files changed, 38 insertions(+), 48 deletions(-)
---
diff --git a/libgda/meson.build b/libgda/meson.build
index 8ba5b5044..aeaf14312 100644
--- a/libgda/meson.build
+++ b/libgda/meson.build
@@ -465,7 +465,7 @@ ttwbs = executable('test-blocking-itsignaler',
        )
 test('BlockingItSignaler', ttwbs)
 
-ttww = executable('test-worker test-connect',
+ttww = executable('test-worker',
        test_worker_sources,
        c_args: [
                '-include',
@@ -479,3 +479,18 @@ ttww = executable('test-worker test-connect',
        install: false
        )
 test('Worker', ttww)
+
+ttwd = executable('test-connect',
+       test_worker_sources,
+       c_args: [
+               '-include',
+               meson.build_root() + '/config.h',
+               ],
+       dependencies: [
+               libgda_dep,
+               inc_rooth_dep,
+               inc_sqliteh_dep
+               ],
+       install: false
+       )
+test('WorkerConnect', ttwd)
diff --git a/libgda/thread-wrapper/meson.build b/libgda/thread-wrapper/meson.build
index feb75bcc1..d5dedb1a6 100644
--- a/libgda/thread-wrapper/meson.build
+++ b/libgda/thread-wrapper/meson.build
@@ -51,4 +51,16 @@ test_block_itsignaler_sources += libgda_threadwrapper_sources
 test_worker_sources = files([
        'test-worker.c'
        ])
-test_worker_sources += libgda_threadwrapper_sources
\ No newline at end of file
+test_worker_sources += libgda_threadwrapper_sources
+
+test_connect_sources = files([
+       'dummy-object.h',
+       'dummy-object.c',
+       'test-connect.c'
+])
+
+test_connect_sources += threadwrapper_sources_priv
+test_connect_sources += threadwrapper_headers_priv
+test_connect_sources += threadwrapper_sources
+test_connect_sources += threadwrapper_headers
+
diff --git a/tests/multi-threading/dummy-object.c b/tests/multi-threading/dummy-object.c
index 491f1cc93..90903128e 100644
--- a/tests/multi-threading/dummy-object.c
+++ b/tests/multi-threading/dummy-object.c
@@ -20,12 +20,14 @@
 #include "dummy-object.h"
 #include <glib-object.h>
 
-/* 
- * Main static functions 
+/*
+ * Main static functions
  */
-static void dummy_object_class_init (DummyObjectClass * class);
-static void dummy_object_init (DummyObject *object);
+typedef struct {
+  gint dummy;
+} DummyObjectPrivate;
 
+G_DEFINE_TYPE_WITH_PRIVATE (DummyObject, dummy_object, G_TYPE_OBJECT)
 /* get a pointer to the parents to be able to call their destructor */
 static GObjectClass  *parent_class = NULL;
 
@@ -41,34 +43,6 @@ enum
 
 static gint dummy_object_signals[LAST_SIGNAL] = { 0, 0, 0, 0 };
 
-GType
-dummy_object_get_type (void)
-{
-       static GType type = 0;
-
-       if (G_UNLIKELY (type == 0)) {
-               static GMutex registering;
-               static const GTypeInfo info = {
-                       sizeof (DummyObjectClass),
-                       (GBaseInitFunc) NULL,
-                       (GBaseFinalizeFunc) NULL,
-                       (GClassInitFunc) dummy_object_class_init,
-                       NULL,
-                       NULL,
-                       sizeof (DummyObject),
-                       0,
-                       (GInstanceInitFunc) dummy_object_init,
-                       NULL
-               };
-               
-               g_mutex_lock (&registering);
-               if (type == 0)
-                       type = g_type_register_static (G_TYPE_OBJECT, "DummyObject", &info, 0);
-               g_mutex_unlock (&registering);
-       }
-
-       return type;
-}
 
 /* VOID:INT,STRING (gda-marshal.list:39) */
 #define g_marshal_value_peek_string(v)   (char*) g_value_get_string (v)
@@ -224,6 +198,8 @@ dummy_object_class_init (DummyObjectClass *class)
 static void
 dummy_object_init (DummyObject *object)
 {
+  DummyObjectPrivate *priv = dummy_object_get_instance_private (object);
+  priv->dummy = 0;
 }
 
 /**
diff --git a/tests/multi-threading/dummy-object.h b/tests/multi-threading/dummy-object.h
index 4ddd46faf..a93d67c97 100644
--- a/tests/multi-threading/dummy-object.h
+++ b/tests/multi-threading/dummy-object.h
@@ -25,19 +25,7 @@
 G_BEGIN_DECLS
 
 #define DUMMY_TYPE_OBJECT          (dummy_object_get_type())
-#define DUMMY_OBJECT(obj)          G_TYPE_CHECK_INSTANCE_CAST (obj, dummy_object_get_type(), DummyObject)
-#define DUMMY_OBJECT_CLASS(klass)  G_TYPE_CHECK_CLASS_CAST (klass, dummy_object_get_type (), 
DummyObjectClass)
-#define DUMMY_IS_OBJECT(obj)       G_TYPE_CHECK_INSTANCE_TYPE (obj, dummy_object_get_type ())
-
-typedef struct _DummyObject DummyObject;
-typedef struct _DummyObjectClass DummyObjectClass;
-
-/* struct for the object's data */
-struct _DummyObject
-{
-       GObject                 object;
-};
-
+G_DECLARE_DERIVABLE_TYPE (DummyObject, dummy_object, DUMMY, OBJECT, GObject)
 
 /* struct for the object's class */
 struct _DummyObjectClass
@@ -49,7 +37,6 @@ struct _DummyObjectClass
        gchar                   *(*sig3)   (DummyObject *object, gchar *str, gint i);
 };
 
-GType               dummy_object_get_type                (void) G_GNUC_CONST;
 DummyObject        *dummy_object_new                     (void);
 
 G_END_DECLS


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