From 22e225a7af5fb2f5f5b6598f6c42be2b960eb5f7 Mon Sep 17 00:00:00 2001 From: Tomeu Vizoso Date: Sat, 29 Oct 2011 15:00:26 +0200 Subject: [PATCH] Add tests for chaining up from vfuncs to ancestors --- tests/gimarshallingtests.c | 22 ++++++++++++++++++++++ tests/gimarshallingtests.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c index 073d153a..41f86206 100644 --- a/tests/gimarshallingtests.c +++ b/tests/gimarshallingtests.c @@ -3733,10 +3733,20 @@ gi_marshalling_tests_sub_object_finalize (GObject *object) G_OBJECT_CLASS(gi_marshalling_tests_sub_object_parent_class)->finalize(object); } +static void +method_deep_hierarchy (GIMarshallingTestsObject *self, gint8 in) +{ + GValue val = {0, }; + g_value_init (&val, G_TYPE_INT); + g_value_set_int (&val, in); + g_object_set_property (G_OBJECT (self), "int", &val); +} + static void gi_marshalling_tests_sub_object_class_init (GIMarshallingTestsSubObjectClass *klass) { G_OBJECT_CLASS(klass)->finalize = gi_marshalling_tests_sub_object_finalize; + GI_MARSHALLING_TESTS_OBJECT_CLASS(klass)->method_deep_hierarchy = method_deep_hierarchy; } void @@ -3751,6 +3761,18 @@ gi_marshalling_tests_sub_object_overwritten_method (GIMarshallingTestsSubObject g_assert(GI_MARSHALLING_TESTS_OBJECT(object)->int_ == 0); } +G_DEFINE_TYPE (GIMarshallingTestsSubSubObject, gi_marshalling_tests_sub_sub_object, GI_MARSHALLING_TESTS_TYPE_SUB_OBJECT); + +static void +gi_marshalling_tests_sub_sub_object_init (GIMarshallingTestsSubSubObject *object) +{ +} + +static void +gi_marshalling_tests_sub_sub_object_class_init (GIMarshallingTestsSubSubObjectClass *klass) +{ +} + /* Interfaces */ static void diff --git a/tests/gimarshallingtests.h b/tests/gimarshallingtests.h index 388ee051..b9d5093d 100644 --- a/tests/gimarshallingtests.h +++ b/tests/gimarshallingtests.h @@ -635,6 +635,12 @@ struct _GIMarshallingTestsObjectClass * @in: (in): */ void (* method_with_default_implementation) (GIMarshallingTestsObject *self, gint8 in); + + /** + * GIMarshallingTestsObjectClass::method_deep_hierarchy: + * @in: (in): + */ + void (* method_deep_hierarchy) (GIMarshallingTestsObject *self, gint8 in); }; struct _GIMarshallingTestsObject @@ -701,6 +707,28 @@ GType gi_marshalling_tests_sub_object_get_type (void) G_GNUC_CONST; void gi_marshalling_tests_sub_object_sub_method (GIMarshallingTestsSubObject *object); void gi_marshalling_tests_sub_object_overwritten_method (GIMarshallingTestsSubObject *object); +#define GI_MARSHALLING_TESTS_TYPE_SUB_SUB_OBJECT (gi_marshalling_tests_sub_sub_object_get_type ()) +#define GI_MARSHALLING_TESTS_SUB_SUB_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GI_MARSHALLING_TESTS_TYPE_SUB_SUB_OBJECT, GIMarshallingTestsSubSubObject)) +#define GI_MARSHALLING_TESTS_SUB_SUB_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GI_MARSHALLING_TESTS_TYPE_SUB_SUB_OBJECT, GIMarshallingTestsSubSubObjectClass)) +#define GI_MARSHALLING_TESTS_IS_SUB_SUB_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GI_MARSHALLING_TESTS_TYPE_SUB_SUB_OBJECT)) +#define GI_MARSHALLING_TESTS_IS_SUB_SUB_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GI_MARSHALLING_TESTS_TYPE_SUB_SUB_OBJECT)) +#define GI_MARSHALLING_TESTS_SUB_SUB_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GI_MARSHALLING_TESTS_TYPE_SUB_SUB_OBJECT, GIMarshallingTestsSubSubObjectClass)) + +typedef struct _GIMarshallingTestsSubSubObjectClass GIMarshallingTestsSubSubObjectClass; +typedef struct _GIMarshallingTestsSubSubObject GIMarshallingTestsSubSubObject; + +struct _GIMarshallingTestsSubSubObjectClass +{ + GIMarshallingTestsSubObjectClass parent_class; +}; + +struct _GIMarshallingTestsSubSubObject +{ + GIMarshallingTestsSubObject parent_instance; +}; + +GType gi_marshalling_tests_sub_sub_object_get_type (void) G_GNUC_CONST; + /* Interfaces */ #define GI_MARSHALLING_TESTS_TYPE_INTERFACE (gi_marshalling_tests_interface_get_type ()) -- 2.34.1