mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-24 14:36:13 +01:00
Merge branch 'move_gobject_tests' into 'main'
Moving gobject tests from tests/gobjects to gobjects/tests See merge request GNOME/glib!2550
This commit is contained in:
commit
81fd75b4bb
@ -15,18 +15,9 @@
|
||||
* Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#undef G_LOG_DOMAIN
|
||||
#define G_LOG_DOMAIN "TestAccumulator"
|
||||
|
||||
#undef G_DISABLE_ASSERT
|
||||
#undef G_DISABLE_CHECKS
|
||||
#undef G_DISABLE_CAST_CHECKS
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "testmarshal.h"
|
||||
#include "marshalers.h"
|
||||
#include "testcommon.h"
|
||||
|
||||
/* What this test tests is the behavior of signal accumulators
|
||||
@ -37,9 +28,7 @@
|
||||
* emission on TRUE returns.
|
||||
*/
|
||||
|
||||
/*
|
||||
* TestObject, a parent class for TestObject
|
||||
*/
|
||||
/* TestObject, a parent class for TestObject */
|
||||
#define TEST_TYPE_OBJECT (test_object_get_type ())
|
||||
typedef struct _TestObject TestObject;
|
||||
typedef struct _TestObjectClass TestObjectClass;
|
||||
@ -79,7 +68,7 @@ test_signal1_accumulator (GSignalInvocationHint *ihint,
|
||||
else
|
||||
result_string = NULL;
|
||||
|
||||
g_value_set_string_take_ownership (return_accu, result_string);
|
||||
g_value_take_string (return_accu, result_string);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -164,7 +153,7 @@ test_signal3_accumulator (GSignalInvocationHint *ihint,
|
||||
GVariant *variant;
|
||||
|
||||
variant = g_value_get_variant (handler_return);
|
||||
g_assert (!g_variant_is_floating (variant));
|
||||
g_assert_false (g_variant_is_floating (variant));
|
||||
|
||||
g_value_set_variant (return_accu, variant);
|
||||
|
||||
@ -225,31 +214,30 @@ test_object_class_init (TestObjectClass *class)
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (TestObjectClass, test_signal1),
|
||||
test_signal1_accumulator, NULL,
|
||||
test_marshal_STRING__INT,
|
||||
test_STRING__INT,
|
||||
G_TYPE_STRING, 1, G_TYPE_INT);
|
||||
g_signal_new ("test-signal2",
|
||||
G_OBJECT_CLASS_TYPE (class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (TestObjectClass, test_signal2),
|
||||
g_signal_accumulator_true_handled, NULL,
|
||||
test_marshal_BOOLEAN__INT,
|
||||
test_BOOLEAN__INT,
|
||||
G_TYPE_BOOLEAN, 1, G_TYPE_INT);
|
||||
g_signal_new ("test-signal3",
|
||||
G_OBJECT_CLASS_TYPE (class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (TestObjectClass, test_signal3),
|
||||
test_signal3_accumulator, NULL,
|
||||
test_marshal_VARIANT__POINTER,
|
||||
test_VARIANT__POINTER,
|
||||
G_TYPE_VARIANT, 1, G_TYPE_POINTER);
|
||||
}
|
||||
|
||||
static DEFINE_TYPE(TestObject, test_object,
|
||||
test_object_class_init, NULL, NULL,
|
||||
G_TYPE_OBJECT)
|
||||
G_TYPE_OBJECT);
|
||||
|
||||
int
|
||||
main (int argc,
|
||||
char *argv[])
|
||||
static void
|
||||
test_accumulator (void)
|
||||
{
|
||||
TestObject *object;
|
||||
gchar *string_result;
|
||||
@ -257,10 +245,6 @@ main (int argc,
|
||||
gboolean variant_finalised;
|
||||
GVariant *variant_result;
|
||||
|
||||
g_log_set_always_fatal (g_log_set_always_fatal (G_LOG_FATAL_MASK) |
|
||||
G_LOG_LEVEL_WARNING |
|
||||
G_LOG_LEVEL_CRITICAL);
|
||||
|
||||
object = g_object_new (TEST_TYPE_OBJECT, NULL);
|
||||
|
||||
g_signal_connect (object, "test-signal1",
|
||||
@ -269,7 +253,7 @@ main (int argc,
|
||||
G_CALLBACK (test_object_signal1_callback_after), NULL);
|
||||
|
||||
g_signal_emit_by_name (object, "test-signal1", 0, &string_result);
|
||||
g_assert (strcmp (string_result, "<before><default><after>") == 0);
|
||||
g_assert_cmpstr (string_result, ==, "<before><default><after>");
|
||||
g_free (string_result);
|
||||
|
||||
g_signal_connect (object, "test-signal2",
|
||||
@ -279,29 +263,42 @@ main (int argc,
|
||||
|
||||
bool_result = FALSE;
|
||||
g_signal_emit_by_name (object, "test-signal2", 1, &bool_result);
|
||||
g_assert (bool_result == TRUE);
|
||||
g_assert_true (bool_result);
|
||||
bool_result = FALSE;
|
||||
g_signal_emit_by_name (object, "test-signal2", 2, &bool_result);
|
||||
g_assert (bool_result == TRUE);
|
||||
g_assert_true (bool_result);
|
||||
bool_result = FALSE;
|
||||
g_signal_emit_by_name (object, "test-signal2", 3, &bool_result);
|
||||
g_assert (bool_result == TRUE);
|
||||
g_assert_true (bool_result);
|
||||
bool_result = TRUE;
|
||||
g_signal_emit_by_name (object, "test-signal2", 4, &bool_result);
|
||||
g_assert (bool_result == FALSE);
|
||||
g_assert_false (bool_result);
|
||||
|
||||
variant_finalised = FALSE;
|
||||
variant_result = NULL;
|
||||
g_signal_emit_by_name (object, "test-signal3", &variant_finalised, &variant_result);
|
||||
g_assert (variant_result != NULL);
|
||||
g_assert (!g_variant_is_floating (variant_result));
|
||||
g_assert_nonnull (variant_result);
|
||||
g_assert_false (g_variant_is_floating (variant_result));
|
||||
|
||||
/* Test that variant_result had refcount 1 */
|
||||
g_assert (!variant_finalised);
|
||||
g_assert_false (variant_finalised);
|
||||
g_variant_unref (variant_result);
|
||||
g_assert (variant_finalised);
|
||||
g_assert_true (variant_finalised);
|
||||
|
||||
g_object_unref (object);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc,
|
||||
char *argv[])
|
||||
{
|
||||
g_log_set_always_fatal (g_log_set_always_fatal (G_LOG_FATAL_MASK) |
|
||||
G_LOG_LEVEL_WARNING |
|
||||
G_LOG_LEVEL_CRITICAL);
|
||||
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
|
||||
g_test_add_func ("/gobject/accumulator", test_accumulator);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
@ -16,13 +16,6 @@
|
||||
* Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#undef G_LOG_DOMAIN
|
||||
#define G_LOG_DOMAIN "TestSignals"
|
||||
|
||||
#undef G_DISABLE_ASSERT
|
||||
#undef G_DISABLE_CHECKS
|
||||
#undef G_DISABLE_CAST_CHECKS
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "testcommon.h"
|
||||
@ -37,18 +30,19 @@
|
||||
* from an earlier handler in the same emission will not be run.
|
||||
*/
|
||||
|
||||
/*
|
||||
* TestObject, a parent class for TestObject
|
||||
*/
|
||||
/* TestObject, a parent class for TestObject */
|
||||
#define TEST_TYPE_OBJECT (test_object_get_type ())
|
||||
typedef struct _TestObject TestObject;
|
||||
typedef struct _TestObjectClass TestObjectClass;
|
||||
static gboolean callback1_ran = FALSE, callback2_ran = FALSE, callback3_ran = FALSE, default_handler_ran = FALSE;
|
||||
|
||||
static gboolean callback1_ran = FALSE, callback2_ran = FALSE,
|
||||
callback3_ran = FALSE, default_handler_ran = FALSE;
|
||||
|
||||
struct _TestObject
|
||||
{
|
||||
GObject parent_instance;
|
||||
};
|
||||
|
||||
struct _TestObjectClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
@ -106,16 +100,11 @@ static DEFINE_TYPE(TestObject, test_object,
|
||||
test_object_class_init, NULL, NULL,
|
||||
G_TYPE_OBJECT)
|
||||
|
||||
int
|
||||
main (int argc,
|
||||
char *argv[])
|
||||
static void
|
||||
test_basic_signals (void)
|
||||
{
|
||||
TestObject *object;
|
||||
|
||||
g_log_set_always_fatal (g_log_set_always_fatal (G_LOG_FATAL_MASK) |
|
||||
G_LOG_LEVEL_WARNING |
|
||||
G_LOG_LEVEL_CRITICAL);
|
||||
|
||||
object = g_object_new (TEST_TYPE_OBJECT, NULL);
|
||||
|
||||
g_signal_connect (object, "test-signal",
|
||||
@ -124,11 +113,25 @@ main (int argc,
|
||||
G_CALLBACK (test_object_signal_callback2), NULL);
|
||||
g_signal_emit_by_name (object, "test-signal");
|
||||
|
||||
g_assert (callback1_ran);
|
||||
g_assert (!callback2_ran);
|
||||
g_assert (!callback3_ran);
|
||||
g_assert (default_handler_ran);
|
||||
g_assert_true (callback1_ran);
|
||||
g_assert_false (callback2_ran);
|
||||
g_assert_false (callback3_ran);
|
||||
g_assert_true (default_handler_ran);
|
||||
|
||||
g_object_unref (object);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc,
|
||||
char *argv[])
|
||||
{
|
||||
g_log_set_always_fatal (g_log_set_always_fatal (G_LOG_FATAL_MASK) |
|
||||
G_LOG_LEVEL_WARNING |
|
||||
G_LOG_LEVEL_CRITICAL);
|
||||
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
|
||||
g_test_add_func ("/gobject/basic-signals", test_basic_signals);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
@ -15,13 +15,6 @@
|
||||
* Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#undef G_LOG_DOMAIN
|
||||
#define G_LOG_DOMAIN "TestDefaultIface"
|
||||
|
||||
#undef G_DISABLE_ASSERT
|
||||
#undef G_DISABLE_CHECKS
|
||||
#undef G_DISABLE_CAST_CHECKS
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "testcommon.h"
|
||||
@ -65,22 +58,25 @@ test_static_iface (void)
|
||||
|
||||
/* Not loaded until we call ref for the first time */
|
||||
static_iface = g_type_default_interface_peek (TEST_TYPE_STATIC_IFACE);
|
||||
g_assert (static_iface == NULL);
|
||||
g_assert_null (static_iface);
|
||||
|
||||
/* Ref loads */
|
||||
static_iface = g_type_default_interface_ref (TEST_TYPE_STATIC_IFACE);
|
||||
g_assert (static_iface && static_iface->val == 42);
|
||||
g_assert_nonnull (static_iface);
|
||||
g_assert_cmpint (static_iface->val, ==, 42);
|
||||
|
||||
/* Peek then works */
|
||||
static_iface = g_type_default_interface_peek (TEST_TYPE_STATIC_IFACE);
|
||||
g_assert (static_iface && static_iface->val == 42);
|
||||
g_assert_nonnull (static_iface);
|
||||
g_assert_cmpint (static_iface->val, ==, 42);
|
||||
|
||||
/* Unref does nothing */
|
||||
g_type_default_interface_unref (static_iface);
|
||||
|
||||
/* And peek still works */
|
||||
static_iface = g_type_default_interface_peek (TEST_TYPE_STATIC_IFACE);
|
||||
g_assert (static_iface && static_iface->val == 42);
|
||||
g_assert_nonnull (static_iface);
|
||||
g_assert_cmpint (static_iface->val, ==, 42);
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
@ -130,7 +126,8 @@ test_dynamic_iface_register (GTypeModule *module)
|
||||
NULL
|
||||
};
|
||||
|
||||
test_dynamic_iface_type = g_type_module_register_type (module, G_TYPE_INTERFACE,
|
||||
test_dynamic_iface_type =
|
||||
g_type_module_register_type (module, G_TYPE_INTERFACE,
|
||||
"TestDynamicIface", &iface_info, 0);
|
||||
}
|
||||
|
||||
@ -149,38 +146,47 @@ test_dynamic_iface (void)
|
||||
|
||||
/* Not loaded until we call ref for the first time */
|
||||
dynamic_iface = g_type_default_interface_peek (TEST_TYPE_DYNAMIC_IFACE);
|
||||
g_assert (dynamic_iface == NULL);
|
||||
g_assert_null (dynamic_iface);
|
||||
|
||||
/* Ref loads */
|
||||
dynamic_iface = g_type_default_interface_ref (TEST_TYPE_DYNAMIC_IFACE);
|
||||
g_assert (dynamic_iface_init);
|
||||
g_assert (dynamic_iface && dynamic_iface->val == 42);
|
||||
g_assert_true (dynamic_iface_init);
|
||||
g_assert_nonnull (dynamic_iface);
|
||||
g_assert_cmpint (dynamic_iface->val, ==, 42);
|
||||
|
||||
/* Peek then works */
|
||||
dynamic_iface = g_type_default_interface_peek (TEST_TYPE_DYNAMIC_IFACE);
|
||||
g_assert (dynamic_iface && dynamic_iface->val == 42);
|
||||
g_assert_nonnull (dynamic_iface);
|
||||
g_assert_cmpint (dynamic_iface->val, ==, 42);
|
||||
|
||||
/* Unref causes finalize */
|
||||
g_type_default_interface_unref (dynamic_iface);
|
||||
#if 0
|
||||
g_assert (!dynamic_iface_init);
|
||||
/* Disabled as unloading dynamic types is disabled.
|
||||
* See https://gitlab.gnome.org/GNOME/glib/-/issues/667 */
|
||||
g_assert_false (dynamic_iface_init);
|
||||
#endif
|
||||
|
||||
/* Peek returns NULL */
|
||||
dynamic_iface = g_type_default_interface_peek (TEST_TYPE_DYNAMIC_IFACE);
|
||||
#if 0
|
||||
g_assert (dynamic_iface == NULL);
|
||||
/* Disabled as unloading dynamic types is disabled.
|
||||
* See https://gitlab.gnome.org/GNOME/glib/-/issues/667 */
|
||||
g_assert_null (dynamic_iface);
|
||||
#endif
|
||||
|
||||
/* Ref reloads */
|
||||
dynamic_iface = g_type_default_interface_ref (TEST_TYPE_DYNAMIC_IFACE);
|
||||
g_assert (dynamic_iface_init);
|
||||
g_assert (dynamic_iface && dynamic_iface->val == 42);
|
||||
g_assert_true (dynamic_iface_init);
|
||||
g_assert_nonnull (dynamic_iface);
|
||||
g_assert_cmpint (dynamic_iface->val, ==, 42);
|
||||
|
||||
/* And Unref causes finalize once more*/
|
||||
g_type_default_interface_unref (dynamic_iface);
|
||||
#if 0
|
||||
g_assert (!dynamic_iface_init);
|
||||
/* Disabled as unloading dynamic types is disabled.
|
||||
* See https://gitlab.gnome.org/GNOME/glib/-/issues/667 */
|
||||
g_assert_false (dynamic_iface_init);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -192,8 +198,10 @@ main (int argc,
|
||||
G_LOG_LEVEL_WARNING |
|
||||
G_LOG_LEVEL_CRITICAL);
|
||||
|
||||
test_static_iface ();
|
||||
test_dynamic_iface ();
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
|
||||
return 0;
|
||||
g_test_add_func ("/gobject/static-iface", test_static_iface);
|
||||
g_test_add_func ("/gobject/dynamic-iface", test_dynamic_iface);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
@ -15,20 +15,12 @@
|
||||
* Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#undef G_LOG_DOMAIN
|
||||
#define G_LOG_DOMAIN "TestDynamicType"
|
||||
|
||||
#undef G_DISABLE_ASSERT
|
||||
#undef G_DISABLE_CHECKS
|
||||
#undef G_DISABLE_CAST_CHECKS
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "testcommon.h"
|
||||
#include "testmodule.h"
|
||||
|
||||
/* This test tests the macros for defining dynamic types.
|
||||
*/
|
||||
/* This test tests the macros for defining dynamic types */
|
||||
|
||||
static gboolean loaded = FALSE;
|
||||
|
||||
@ -39,8 +31,11 @@ struct _TestIfaceClass
|
||||
};
|
||||
|
||||
static GType test_iface_get_type (void);
|
||||
|
||||
#define TEST_TYPE_IFACE (test_iface_get_type ())
|
||||
#define TEST_IFACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TEST_TYPE_IFACE, TestIfaceClass))
|
||||
#define TEST_IFACE_GET_CLASS(obj) \
|
||||
(G_TYPE_INSTANCE_GET_INTERFACE ((obj), TEST_TYPE_IFACE, TestIfaceClass))
|
||||
|
||||
typedef struct _TestIface TestIface;
|
||||
typedef struct _TestIfaceClass TestIfaceClass;
|
||||
|
||||
@ -116,25 +111,27 @@ test_dynamic_type (void)
|
||||
|
||||
/* Not loaded until we call ref for the first time */
|
||||
class = g_type_class_peek (DYNAMIC_OBJECT_TYPE);
|
||||
g_assert (class == NULL);
|
||||
g_assert (!loaded);
|
||||
g_assert_null (class);
|
||||
g_assert_false (loaded);
|
||||
|
||||
/* Make sure interfaces work */
|
||||
g_assert (g_type_is_a (DYNAMIC_OBJECT_TYPE,
|
||||
g_assert_true (g_type_is_a (DYNAMIC_OBJECT_TYPE,
|
||||
TEST_TYPE_IFACE));
|
||||
|
||||
/* Ref loads */
|
||||
class = g_type_class_ref (DYNAMIC_OBJECT_TYPE);
|
||||
g_assert (class && class->val == 42);
|
||||
g_assert (loaded);
|
||||
g_assert_nonnull (class);
|
||||
g_assert_cmpint (class->val, ==, 42);
|
||||
g_assert_true (loaded);
|
||||
|
||||
/* Peek then works */
|
||||
class = g_type_class_peek (DYNAMIC_OBJECT_TYPE);
|
||||
g_assert (class && class->val == 42);
|
||||
g_assert (loaded);
|
||||
g_assert_nonnull (class);
|
||||
g_assert_cmpint (class->val, ==, 42);
|
||||
g_assert_true (loaded);
|
||||
|
||||
/* Make sure interfaces still work */
|
||||
g_assert (g_type_is_a (DYNAMIC_OBJECT_TYPE,
|
||||
g_assert_true (g_type_is_a (DYNAMIC_OBJECT_TYPE,
|
||||
TEST_TYPE_IFACE));
|
||||
|
||||
/* Unref causes finalize */
|
||||
@ -143,21 +140,26 @@ test_dynamic_type (void)
|
||||
/* Peek returns NULL */
|
||||
class = g_type_class_peek (DYNAMIC_OBJECT_TYPE);
|
||||
#if 0
|
||||
g_assert (!class);
|
||||
g_assert (!loaded);
|
||||
/* Disabled as unloading dynamic types is disabled.
|
||||
* See https://gitlab.gnome.org/GNOME/glib/-/issues/667 */
|
||||
g_assert_false (class);
|
||||
g_assert_false (loaded);
|
||||
#endif
|
||||
|
||||
/* Ref reloads */
|
||||
class = g_type_class_ref (DYNAMIC_OBJECT_TYPE);
|
||||
g_assert (class && class->val == 42);
|
||||
g_assert (loaded);
|
||||
g_assert_nonnull (class);
|
||||
g_assert_cmpint (class->val, ==, 42);
|
||||
g_assert_true (loaded);
|
||||
|
||||
/* And Unref causes finalize once more*/
|
||||
g_type_class_unref (class);
|
||||
class = g_type_class_peek (DYNAMIC_OBJECT_TYPE);
|
||||
#if 0
|
||||
g_assert (!class);
|
||||
g_assert (!loaded);
|
||||
/* Disabled as unloading dynamic types is disabled.
|
||||
* See https://gitlab.gnome.org/GNOME/glib/-/issues/667 */
|
||||
g_assert_null (class);
|
||||
g_assert_false (loaded);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -169,7 +171,9 @@ main (int argc,
|
||||
G_LOG_LEVEL_WARNING |
|
||||
G_LOG_LEVEL_CRITICAL);
|
||||
|
||||
test_dynamic_type ();
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
|
||||
return 0;
|
||||
g_test_add_func ("/gobject/dynamic-type", test_dynamic_type);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
@ -1,3 +1,6 @@
|
||||
VOID:INT,BOOLEAN,CHAR,UCHAR,UINT,LONG,ULONG,ENUM,FLAGS,FLOAT,DOUBLE,STRING,PARAM,BOXED,POINTER,OBJECT,VARIANT,INT64,UINT64
|
||||
BOOLEAN:INT
|
||||
INT:VOID
|
||||
STRING:INT
|
||||
UINT:VOID
|
||||
VARIANT:POINTER
|
||||
|
@ -28,12 +28,26 @@ marshalers_c = custom_target('marshalers_c',
|
||||
|
||||
gobject_tests = {
|
||||
'qdata' : {},
|
||||
'accumulator' : {
|
||||
'source' : ['accumulator.c', marshalers_h, marshalers_c],
|
||||
},
|
||||
'boxed' : {},
|
||||
'cxx' : {
|
||||
'source' : ['cxx.cpp'],
|
||||
},
|
||||
'defaultiface' : {
|
||||
'source' : ['defaultiface.c', 'testmodule.c'],
|
||||
},
|
||||
'deftype' : {},
|
||||
'dynamictype' : {
|
||||
'source' : ['dynamictype.c', 'testmodule.c'],
|
||||
},
|
||||
'enums' : {},
|
||||
'override' : {},
|
||||
'param' : {},
|
||||
'references' : {},
|
||||
'basic-signals' : {},
|
||||
'singleton' : {},
|
||||
'threadtests' : {},
|
||||
'dynamictests' : {},
|
||||
'binding' : {},
|
||||
|
@ -17,17 +17,6 @@
|
||||
* Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#undef G_LOG_DOMAIN
|
||||
#define G_LOG_DOMAIN "TestOverride"
|
||||
|
||||
#undef G_DISABLE_ASSERT
|
||||
#undef G_DISABLE_CHECKS
|
||||
#undef G_DISABLE_CAST_CHECKS
|
||||
|
||||
#undef VERBOSE
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
@ -99,7 +88,9 @@ test_a_foo (TestI *self)
|
||||
g_value_init (&args[0], TEST_TYPE_A);
|
||||
g_value_set_object (&args[0], self);
|
||||
|
||||
g_assert (g_signal_get_invocation_hint (self)->signal_id == foo_signal_id);
|
||||
g_assert_cmpint (g_signal_get_invocation_hint (self)->signal_id,
|
||||
==,
|
||||
foo_signal_id);
|
||||
g_signal_chain_from_overridden (args, NULL);
|
||||
|
||||
g_value_unset (&args[0]);
|
||||
@ -118,8 +109,8 @@ test_a_baz (TestA *self,
|
||||
{
|
||||
record ("TestA::baz");
|
||||
|
||||
g_assert (object == G_OBJECT (self));
|
||||
g_assert (GPOINTER_TO_INT (pointer) == 23);
|
||||
g_assert_true (object == G_OBJECT (self));
|
||||
g_assert_cmpint (GPOINTER_TO_INT (pointer), ==, 23);
|
||||
|
||||
return g_strdup ("TestA::baz");
|
||||
}
|
||||
@ -137,7 +128,8 @@ test_a_class_init (TestAClass *class)
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0, NULL);
|
||||
|
||||
baz_signal_id = g_signal_new_class_handler ("baz",
|
||||
baz_signal_id =
|
||||
g_signal_new_class_handler ("baz",
|
||||
TEST_TYPE_A,
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_CALLBACK (test_a_baz),
|
||||
@ -184,7 +176,9 @@ test_b_foo (TestI *self)
|
||||
g_value_init (&args[0], TEST_TYPE_A);
|
||||
g_value_set_object (&args[0], self);
|
||||
|
||||
g_assert (g_signal_get_invocation_hint (self)->signal_id == foo_signal_id);
|
||||
g_assert_cmpint (g_signal_get_invocation_hint (self)->signal_id,
|
||||
==,
|
||||
foo_signal_id);
|
||||
g_signal_chain_from_overridden (args, NULL);
|
||||
|
||||
g_value_unset (&args[0]);
|
||||
@ -200,7 +194,9 @@ test_b_bar (TestA *self)
|
||||
g_value_init (&args[0], TEST_TYPE_A);
|
||||
g_value_set_object (&args[0], self);
|
||||
|
||||
g_assert (g_signal_get_invocation_hint (self)->signal_id == bar_signal_id);
|
||||
g_assert_cmpint (g_signal_get_invocation_hint (self)->signal_id,
|
||||
==,
|
||||
bar_signal_id);
|
||||
g_signal_chain_from_overridden (args, NULL);
|
||||
|
||||
g_value_unset (&args[0]);
|
||||
@ -215,8 +211,8 @@ test_b_baz (TestA *self,
|
||||
|
||||
record ("TestB::baz");
|
||||
|
||||
g_assert (object == G_OBJECT (self));
|
||||
g_assert (GPOINTER_TO_INT (pointer) == 23);
|
||||
g_assert_true (object == G_OBJECT (self));
|
||||
g_assert_cmpint (GPOINTER_TO_INT (pointer), ==, 23);
|
||||
|
||||
g_signal_chain_from_overridden_handler (self, object, pointer, &retval);
|
||||
|
||||
@ -272,7 +268,9 @@ test_c_foo (TestI *self)
|
||||
g_value_init (&args[0], TEST_TYPE_A);
|
||||
g_value_set_object (&args[0], self);
|
||||
|
||||
g_assert (g_signal_get_invocation_hint (self)->signal_id == foo_signal_id);
|
||||
g_assert_cmpint (g_signal_get_invocation_hint (self)->signal_id,
|
||||
==,
|
||||
foo_signal_id);
|
||||
g_signal_chain_from_overridden (args, NULL);
|
||||
|
||||
g_value_unset (&args[0]);
|
||||
@ -288,7 +286,9 @@ test_c_bar (TestA *self)
|
||||
g_value_init (&args[0], TEST_TYPE_A);
|
||||
g_value_set_object (&args[0], self);
|
||||
|
||||
g_assert (g_signal_get_invocation_hint (self)->signal_id == bar_signal_id);
|
||||
g_assert_cmpint (g_signal_get_invocation_hint (self)->signal_id,
|
||||
==,
|
||||
bar_signal_id);
|
||||
g_signal_chain_from_overridden (args, NULL);
|
||||
|
||||
g_value_unset (&args[0]);
|
||||
@ -303,8 +303,8 @@ test_c_baz (TestA *self,
|
||||
|
||||
record ("TestC::baz");
|
||||
|
||||
g_assert (object == G_OBJECT (self));
|
||||
g_assert (GPOINTER_TO_INT (pointer) == 23);
|
||||
g_assert_true (object == G_OBJECT (self));
|
||||
g_assert_cmpint (GPOINTER_TO_INT (pointer), ==, 23);
|
||||
|
||||
g_signal_chain_from_overridden_handler (self, object, pointer, &retval);
|
||||
|
||||
@ -340,7 +340,6 @@ static DEFINE_TYPE (TestC, test_c,
|
||||
TEST_TYPE_B)
|
||||
|
||||
static GString *test_string = NULL;
|
||||
gboolean failed = FALSE;
|
||||
|
||||
static void
|
||||
record (const gchar *str)
|
||||
@ -369,39 +368,27 @@ test (GType type,
|
||||
gchar *ret;
|
||||
|
||||
g_signal_emit_by_name (self, signal, self, GINT_TO_POINTER (23), &ret);
|
||||
|
||||
if (strcmp (ret, expected_retval) != 0)
|
||||
failed = TRUE;
|
||||
g_assert_cmpstr (ret, ==, expected_retval);
|
||||
|
||||
g_free (ret);
|
||||
}
|
||||
|
||||
#ifndef VERBOSE
|
||||
if (strcmp (test_string->str, expected) != 0)
|
||||
#endif
|
||||
{
|
||||
g_printerr ("*** emitting %s on a %s instance\n"
|
||||
g_test_message ("*** emitting %s on a %s instance\n"
|
||||
" Expecting: %s\n"
|
||||
" Got: %s\n",
|
||||
" Got: %s",
|
||||
signal, g_type_name (type),
|
||||
expected,
|
||||
test_string->str);
|
||||
|
||||
if (strcmp (test_string->str, expected) != 0)
|
||||
failed = TRUE;
|
||||
}
|
||||
g_assert_cmpstr (test_string->str, ==, expected);
|
||||
|
||||
g_string_free (test_string, TRUE);
|
||||
g_object_unref (self);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
static void
|
||||
test_override (void)
|
||||
{
|
||||
g_log_set_always_fatal (g_log_set_always_fatal (G_LOG_FATAL_MASK) |
|
||||
G_LOG_LEVEL_WARNING |
|
||||
G_LOG_LEVEL_CRITICAL);
|
||||
|
||||
test (TEST_TYPE_A, "foo", "TestA::foo,TestI::foo", NULL);
|
||||
test (TEST_TYPE_A, "bar", "TestA::bar", NULL);
|
||||
test (TEST_TYPE_A, "baz", "TestA::baz", "TestA::baz");
|
||||
@ -413,6 +400,19 @@ main (int argc, char **argv)
|
||||
test (TEST_TYPE_C, "foo", "TestC::foo,TestB::foo,TestA::foo,TestI::foo", NULL);
|
||||
test (TEST_TYPE_C, "bar", "TestC::bar,TestB::bar,TestA::bar", NULL);
|
||||
test (TEST_TYPE_C, "baz", "TestC::baz,TestB::baz,TestA::baz", "TestA::baz,TestB::baz,TestC::baz");
|
||||
|
||||
return failed ? 1 : 0;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc,
|
||||
char **argv)
|
||||
{
|
||||
g_log_set_always_fatal (g_log_set_always_fatal (G_LOG_FATAL_MASK) |
|
||||
G_LOG_LEVEL_WARNING |
|
||||
G_LOG_LEVEL_CRITICAL);
|
||||
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
|
||||
g_test_add_func ("/gobject/override", test_override);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
@ -15,17 +15,9 @@
|
||||
* Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#undef G_LOG_DOMAIN
|
||||
#define G_LOG_DOMAIN "TestReferences"
|
||||
|
||||
#undef G_DISABLE_ASSERT
|
||||
#undef G_DISABLE_CHECKS
|
||||
#undef G_DISABLE_CAST_CHECKS
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
/* This test tests weak and toggle references
|
||||
*/
|
||||
/* This test tests weak and toggle references */
|
||||
|
||||
static GObject *global_object;
|
||||
|
||||
@ -39,9 +31,7 @@ static gboolean toggle_ref2_strengthened;
|
||||
static gboolean toggle_ref3_weakened;
|
||||
static gboolean toggle_ref3_strengthened;
|
||||
|
||||
/*
|
||||
* TestObject, a parent class for TestObject
|
||||
*/
|
||||
/* TestObject, a parent class for TestObject */
|
||||
static GType test_object_get_type (void);
|
||||
#define TEST_TYPE_OBJECT (test_object_get_type ())
|
||||
typedef struct _TestObject TestObject;
|
||||
@ -97,8 +87,8 @@ static void
|
||||
weak_ref1 (gpointer data,
|
||||
GObject *object)
|
||||
{
|
||||
g_assert (object == global_object);
|
||||
g_assert (data == GUINT_TO_POINTER (42));
|
||||
g_assert_true (object == global_object);
|
||||
g_assert_cmpint (GPOINTER_TO_INT (data), ==, 42);
|
||||
|
||||
weak_ref1_notified = TRUE;
|
||||
}
|
||||
@ -107,8 +97,8 @@ static void
|
||||
weak_ref2 (gpointer data,
|
||||
GObject *object)
|
||||
{
|
||||
g_assert (object == global_object);
|
||||
g_assert (data == GUINT_TO_POINTER (24));
|
||||
g_assert_true (object == global_object);
|
||||
g_assert_cmpint (GPOINTER_TO_INT (data), ==, 24);
|
||||
|
||||
weak_ref2_notified = TRUE;
|
||||
}
|
||||
@ -118,8 +108,8 @@ toggle_ref1 (gpointer data,
|
||||
GObject *object,
|
||||
gboolean is_last_ref)
|
||||
{
|
||||
g_assert (object == global_object);
|
||||
g_assert (data == GUINT_TO_POINTER (42));
|
||||
g_assert_true (object == global_object);
|
||||
g_assert_cmpint (GPOINTER_TO_INT (data), ==, 42);
|
||||
|
||||
if (is_last_ref)
|
||||
toggle_ref1_weakened = TRUE;
|
||||
@ -132,8 +122,8 @@ toggle_ref2 (gpointer data,
|
||||
GObject *object,
|
||||
gboolean is_last_ref)
|
||||
{
|
||||
g_assert (object == global_object);
|
||||
g_assert (data == GUINT_TO_POINTER (24));
|
||||
g_assert_true (object == global_object);
|
||||
g_assert_cmpint (GPOINTER_TO_INT (data), ==, 24);
|
||||
|
||||
if (is_last_ref)
|
||||
toggle_ref2_weakened = TRUE;
|
||||
@ -146,8 +136,8 @@ toggle_ref3 (gpointer data,
|
||||
GObject *object,
|
||||
gboolean is_last_ref)
|
||||
{
|
||||
g_assert (object == global_object);
|
||||
g_assert (data == GUINT_TO_POINTER (34));
|
||||
g_assert_true (object == global_object);
|
||||
g_assert_cmpint (GPOINTER_TO_INT (data), ==, 34);
|
||||
|
||||
if (is_last_ref)
|
||||
{
|
||||
@ -158,26 +148,20 @@ toggle_ref3 (gpointer data,
|
||||
toggle_ref3_strengthened = TRUE;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc,
|
||||
char *argv[])
|
||||
static void
|
||||
test_references (void)
|
||||
{
|
||||
GObject *object;
|
||||
|
||||
g_log_set_always_fatal (g_log_set_always_fatal (G_LOG_FATAL_MASK) |
|
||||
G_LOG_LEVEL_WARNING |
|
||||
G_LOG_LEVEL_CRITICAL);
|
||||
|
||||
/* Test basic weak reference operation
|
||||
*/
|
||||
/* Test basic weak reference operation */
|
||||
global_object = object = g_object_new (TEST_TYPE_OBJECT, NULL);
|
||||
|
||||
g_object_weak_ref (object, weak_ref1, GUINT_TO_POINTER (42));
|
||||
|
||||
clear_flags ();
|
||||
g_object_unref (object);
|
||||
g_assert (weak_ref1_notified == TRUE);
|
||||
g_assert (object_destroyed == TRUE);
|
||||
g_assert_true (weak_ref1_notified);
|
||||
g_assert_true (object_destroyed);
|
||||
|
||||
/* Test two weak references at once
|
||||
*/
|
||||
@ -188,12 +172,11 @@ main (int argc,
|
||||
|
||||
clear_flags ();
|
||||
g_object_unref (object);
|
||||
g_assert (weak_ref1_notified == TRUE);
|
||||
g_assert (weak_ref2_notified == TRUE);
|
||||
g_assert (object_destroyed == TRUE);
|
||||
g_assert_true (weak_ref1_notified);
|
||||
g_assert_true (weak_ref2_notified);
|
||||
g_assert_true (object_destroyed);
|
||||
|
||||
/* Test remove weak references
|
||||
*/
|
||||
/* Test remove weak references */
|
||||
global_object = object = g_object_new (TEST_TYPE_OBJECT, NULL);
|
||||
|
||||
g_object_weak_ref (object, weak_ref1, GUINT_TO_POINTER (42));
|
||||
@ -202,79 +185,89 @@ main (int argc,
|
||||
|
||||
clear_flags ();
|
||||
g_object_unref (object);
|
||||
g_assert (weak_ref1_notified == FALSE);
|
||||
g_assert (weak_ref2_notified == TRUE);
|
||||
g_assert (object_destroyed == TRUE);
|
||||
g_assert_false (weak_ref1_notified);
|
||||
g_assert_true (weak_ref2_notified);
|
||||
g_assert_true (object_destroyed);
|
||||
|
||||
/* Test basic toggle reference operation
|
||||
*/
|
||||
/* Test basic toggle reference operation */
|
||||
global_object = object = g_object_new (TEST_TYPE_OBJECT, NULL);
|
||||
|
||||
g_object_add_toggle_ref (object, toggle_ref1, GUINT_TO_POINTER (42));
|
||||
|
||||
clear_flags ();
|
||||
g_object_unref (object);
|
||||
g_assert (toggle_ref1_weakened == TRUE);
|
||||
g_assert (toggle_ref1_strengthened == FALSE);
|
||||
g_assert (object_destroyed == FALSE);
|
||||
g_assert_true (toggle_ref1_weakened);
|
||||
g_assert_false (toggle_ref1_strengthened);
|
||||
g_assert_false (object_destroyed);
|
||||
|
||||
clear_flags ();
|
||||
g_object_ref (object);
|
||||
g_assert (toggle_ref1_weakened == FALSE);
|
||||
g_assert (toggle_ref1_strengthened == TRUE);
|
||||
g_assert (object_destroyed == FALSE);
|
||||
g_assert_false (toggle_ref1_weakened);
|
||||
g_assert_true (toggle_ref1_strengthened);
|
||||
g_assert_false (object_destroyed);
|
||||
|
||||
g_object_unref (object);
|
||||
|
||||
clear_flags ();
|
||||
g_object_remove_toggle_ref (object, toggle_ref1, GUINT_TO_POINTER (42));
|
||||
g_assert (toggle_ref1_weakened == FALSE);
|
||||
g_assert (toggle_ref1_strengthened == FALSE);
|
||||
g_assert (object_destroyed == TRUE);
|
||||
g_assert_false (toggle_ref1_weakened);
|
||||
g_assert_false (toggle_ref1_strengthened);
|
||||
g_assert_true (object_destroyed);
|
||||
|
||||
global_object = object = g_object_new (TEST_TYPE_OBJECT, NULL);
|
||||
|
||||
/* Test two toggle references at once
|
||||
*/
|
||||
/* Test two toggle references at once */
|
||||
g_object_add_toggle_ref (object, toggle_ref1, GUINT_TO_POINTER (42));
|
||||
g_object_add_toggle_ref (object, toggle_ref2, GUINT_TO_POINTER (24));
|
||||
|
||||
clear_flags ();
|
||||
g_object_unref (object);
|
||||
g_assert (toggle_ref1_weakened == FALSE);
|
||||
g_assert (toggle_ref1_strengthened == FALSE);
|
||||
g_assert (toggle_ref2_weakened == FALSE);
|
||||
g_assert (toggle_ref2_strengthened == FALSE);
|
||||
g_assert (object_destroyed == FALSE);
|
||||
g_assert_false (toggle_ref1_weakened);
|
||||
g_assert_false (toggle_ref1_strengthened);
|
||||
g_assert_false (toggle_ref2_weakened);
|
||||
g_assert_false (toggle_ref2_strengthened);
|
||||
g_assert_false (object_destroyed);
|
||||
|
||||
clear_flags ();
|
||||
g_object_remove_toggle_ref (object, toggle_ref1, GUINT_TO_POINTER (42));
|
||||
g_assert (toggle_ref1_weakened == FALSE);
|
||||
g_assert (toggle_ref1_strengthened == FALSE);
|
||||
g_assert (toggle_ref2_weakened == TRUE);
|
||||
g_assert (toggle_ref2_strengthened == FALSE);
|
||||
g_assert (object_destroyed == FALSE);
|
||||
g_assert_false (toggle_ref1_weakened);
|
||||
g_assert_false (toggle_ref1_strengthened);
|
||||
g_assert_true (toggle_ref2_weakened);
|
||||
g_assert_false (toggle_ref2_strengthened);
|
||||
g_assert_false (object_destroyed);
|
||||
|
||||
clear_flags ();
|
||||
/* Check that removing a toggle ref with %NULL data works fine. */
|
||||
g_object_remove_toggle_ref (object, toggle_ref2, NULL);
|
||||
g_assert (toggle_ref1_weakened == FALSE);
|
||||
g_assert (toggle_ref1_strengthened == FALSE);
|
||||
g_assert (toggle_ref2_weakened == FALSE);
|
||||
g_assert (toggle_ref2_strengthened == FALSE);
|
||||
g_assert (object_destroyed == TRUE);
|
||||
g_assert_false (toggle_ref1_weakened);
|
||||
g_assert_false (toggle_ref1_strengthened);
|
||||
g_assert_false (toggle_ref2_weakened);
|
||||
g_assert_false (toggle_ref2_strengthened);
|
||||
g_assert_true (object_destroyed);
|
||||
|
||||
/* Test a toggle reference that removes itself
|
||||
*/
|
||||
/* Test a toggle reference that removes itself */
|
||||
global_object = object = g_object_new (TEST_TYPE_OBJECT, NULL);
|
||||
|
||||
g_object_add_toggle_ref (object, toggle_ref3, GUINT_TO_POINTER (34));
|
||||
|
||||
clear_flags ();
|
||||
g_object_unref (object);
|
||||
g_assert (toggle_ref3_weakened == TRUE);
|
||||
g_assert (toggle_ref3_strengthened == FALSE);
|
||||
g_assert (object_destroyed == TRUE);
|
||||
|
||||
return 0;
|
||||
g_assert_true (toggle_ref3_weakened);
|
||||
g_assert_false (toggle_ref3_strengthened);
|
||||
g_assert_true (object_destroyed);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc,
|
||||
char *argv[])
|
||||
{
|
||||
g_log_set_always_fatal (g_log_set_always_fatal (G_LOG_FATAL_MASK) |
|
||||
G_LOG_LEVEL_WARNING |
|
||||
G_LOG_LEVEL_CRITICAL);
|
||||
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
|
||||
g_test_add_func ("/gobject/references", test_references);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
@ -14,10 +14,8 @@
|
||||
* You should have received a copy of the GNU Lesser General
|
||||
* Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#undef G_LOG_DOMAIN
|
||||
#define G_LOG_DOMAIN "TestSingleton"
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <string.h>
|
||||
|
||||
/* --- MySingleton class --- */
|
||||
typedef struct {
|
||||
@ -29,11 +27,16 @@ typedef struct {
|
||||
|
||||
static GType my_singleton_get_type (void);
|
||||
#define MY_TYPE_SINGLETON (my_singleton_get_type ())
|
||||
#define MY_SINGLETON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), MY_TYPE_SINGLETON, MySingleton))
|
||||
#define MY_IS_SINGLETON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), MY_TYPE_SINGLETON))
|
||||
#define MY_SINGLETON_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), MY_TYPE_SINGLETON, MySingletonClass))
|
||||
#define MY_IS_SINGLETON_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), MY_TYPE_SINGLETON))
|
||||
#define MY_SINGLETON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), MY_TYPE_SINGLETON, MySingletonClass))
|
||||
#define MY_SINGLETON(o) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST ((o), MY_TYPE_SINGLETON, MySingleton))
|
||||
#define MY_IS_SINGLETON(o) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE ((o), MY_TYPE_SINGLETON))
|
||||
#define MY_SINGLETON_CLASS(c) \
|
||||
(G_TYPE_CHECK_CLASS_CAST ((c), MY_TYPE_SINGLETON, MySingletonClass))
|
||||
#define MY_IS_SINGLETON_CLASS(c) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE ((c), MY_TYPE_SINGLETON))
|
||||
#define MY_SINGLETON_GET_CLASS(o) \
|
||||
(G_TYPE_INSTANCE_GET_CLASS ((o), MY_TYPE_SINGLETON, MySingletonClass))
|
||||
|
||||
G_DEFINE_TYPE (MySingleton, my_singleton, G_TYPE_OBJECT)
|
||||
|
||||
@ -54,7 +57,7 @@ my_singleton_constructor (GType type,
|
||||
static void
|
||||
my_singleton_init (MySingleton *self)
|
||||
{
|
||||
g_assert (the_one_and_only == NULL);
|
||||
g_assert_null (the_one_and_only);
|
||||
the_one_and_only = self;
|
||||
}
|
||||
|
||||
@ -73,11 +76,13 @@ main (int argc,
|
||||
|
||||
/* create the singleton */
|
||||
singleton = g_object_new (MY_TYPE_SINGLETON, NULL);
|
||||
g_assert (singleton != NULL);
|
||||
g_assert_nonnull (singleton);
|
||||
|
||||
/* assert _singleton_ creation */
|
||||
obj = g_object_new (MY_TYPE_SINGLETON, NULL);
|
||||
g_assert (singleton == obj);
|
||||
g_assert_true (singleton == obj);
|
||||
g_object_unref (obj);
|
||||
|
||||
/* shutdown */
|
||||
g_object_unref (singleton);
|
||||
return 0;
|
@ -1,47 +1,5 @@
|
||||
# We cannot use gnome.genmarshal() here
|
||||
testmarshal_h = custom_target('testmarshal_h',
|
||||
output : 'testmarshal.h',
|
||||
input : 'testmarshal.list',
|
||||
command : [
|
||||
python, glib_genmarshal,
|
||||
'--prefix=test_marshal',
|
||||
'--output=@OUTPUT@',
|
||||
'--quiet',
|
||||
'--header',
|
||||
'@INPUT@',
|
||||
],
|
||||
)
|
||||
|
||||
testmarshal_c = custom_target('testmarshal_c',
|
||||
output : 'testmarshal.c',
|
||||
input : 'testmarshal.list',
|
||||
command : [
|
||||
python, glib_genmarshal,
|
||||
'--prefix=test_marshal',
|
||||
'--include-header=testmarshal.h',
|
||||
'--output=@OUTPUT@',
|
||||
'--quiet',
|
||||
'--body',
|
||||
'@INPUT@',
|
||||
],
|
||||
)
|
||||
|
||||
gobject_tests = {
|
||||
'deftype' : {},
|
||||
'defaultiface' : {
|
||||
'extra_sources' : ['testmodule.c'],
|
||||
},
|
||||
'dynamictype' : {
|
||||
'extra_sources' : ['testmodule.c'],
|
||||
},
|
||||
'override' : {},
|
||||
'signals' : {},
|
||||
'singleton' : {},
|
||||
'references' : {},
|
||||
'testgobject' : {},
|
||||
'accumulator' : {
|
||||
'extra_sources' : [testmarshal_c, testmarshal_h],
|
||||
},
|
||||
}
|
||||
|
||||
if host_system != 'windows'
|
||||
|
@ -1,4 +0,0 @@
|
||||
# Marshallers used in tests
|
||||
BOOLEAN:INT
|
||||
STRING:INT
|
||||
VARIANT:POINTER
|
Loading…
Reference in New Issue
Block a user