2012-09-07 14:56:44 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
2012-05-01 00:40:14 -07:00
|
|
|
#include "Eo.h"
|
2012-09-25 23:56:52 -07:00
|
|
|
#include "composite_objects_simple.h"
|
|
|
|
#include "composite_objects_comp.h"
|
2012-04-12 06:52:13 -07:00
|
|
|
|
2012-04-12 05:25:26 -07:00
|
|
|
#include "../eunit_tests.h"
|
2012-04-12 03:48:08 -07:00
|
|
|
|
2012-05-01 00:40:14 -07:00
|
|
|
EAPI Eo_Op COMP_BASE_ID = 0;
|
2012-04-12 03:48:08 -07:00
|
|
|
|
2012-04-23 01:09:54 -07:00
|
|
|
#define MY_CLASS COMP_CLASS
|
2012-04-12 03:48:08 -07:00
|
|
|
|
|
|
|
static void
|
2012-06-26 20:58:45 -07:00
|
|
|
_a_get(Eo *obj, void *class_data EINA_UNUSED, va_list *list)
|
2012-04-12 03:48:08 -07:00
|
|
|
{
|
|
|
|
int *a;
|
|
|
|
a = va_arg(*list, int *);
|
2012-06-26 20:58:45 -07:00
|
|
|
eo_do_super(obj, simple_a_get(a));
|
2012-04-12 03:48:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-06-10 07:04:53 -07:00
|
|
|
_constructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
|
2012-04-12 03:48:08 -07:00
|
|
|
{
|
2012-06-10 07:04:53 -07:00
|
|
|
eo_do_super(obj, eo_constructor());
|
2012-04-12 03:48:08 -07:00
|
|
|
|
2012-05-01 00:40:14 -07:00
|
|
|
Eo *simple = eo_add(SIMPLE_CLASS, obj);
|
2012-06-10 08:02:44 -07:00
|
|
|
eo_composite_attach(simple, obj);
|
2012-05-14 00:35:19 -07:00
|
|
|
eo_do(simple, eo_event_callback_forwarder_add(EV_A_CHANGED, obj));
|
2012-04-12 03:48:08 -07:00
|
|
|
|
2012-05-01 00:40:14 -07:00
|
|
|
fail_if(eo_composite_is(obj));
|
|
|
|
fail_if(!eo_composite_is(simple));
|
2012-04-12 05:25:26 -07:00
|
|
|
|
2012-05-01 00:40:14 -07:00
|
|
|
eo_do(obj, eo_base_data_set("simple-obj", simple, NULL));
|
2012-04-12 07:37:57 -07:00
|
|
|
|
2012-05-01 00:40:14 -07:00
|
|
|
eo_unref(simple);
|
2012-04-12 03:48:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-05-01 00:40:14 -07:00
|
|
|
_class_constructor(Eo_Class *klass)
|
2012-04-12 03:48:08 -07:00
|
|
|
{
|
2012-05-01 00:40:14 -07:00
|
|
|
const Eo_Op_Func_Description func_desc[] = {
|
2012-06-10 07:04:53 -07:00
|
|
|
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
|
2012-06-26 20:58:45 -07:00
|
|
|
EO_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_GET), _a_get),
|
2012-05-01 00:40:14 -07:00
|
|
|
EO_OP_FUNC_SENTINEL
|
2012-04-12 03:48:08 -07:00
|
|
|
};
|
|
|
|
|
2012-05-01 00:40:14 -07:00
|
|
|
eo_class_funcs_set(klass, func_desc);
|
2012-04-12 03:48:08 -07:00
|
|
|
}
|
|
|
|
|
2012-05-01 00:40:14 -07:00
|
|
|
static const Eo_Class_Description class_desc = {
|
2012-07-09 02:09:46 -07:00
|
|
|
EO_VERSION,
|
2012-04-23 01:09:54 -07:00
|
|
|
"Comp",
|
2012-05-01 00:40:14 -07:00
|
|
|
EO_CLASS_TYPE_REGULAR,
|
|
|
|
EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
|
2012-04-23 01:09:54 -07:00
|
|
|
NULL,
|
|
|
|
0,
|
|
|
|
_class_constructor,
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2012-05-01 00:40:14 -07:00
|
|
|
EO_DEFINE_CLASS(comp_class_get, &class_desc, EO_BASE_CLASS,
|
2012-04-23 01:09:54 -07:00
|
|
|
SIMPLE_CLASS, NULL);
|
2012-04-12 03:48:08 -07:00
|
|
|
|