efl/src/tests/eo/mixin/mixin_mixin3.c

67 lines
1.5 KiB
C
Raw Normal View History

#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "Eo.h"
2012-09-25 23:56:52 -07:00
#include "mixin_mixin.h"
#include "mixin_mixin3.h"
#include "mixin_simple.h"
#include "../eunit_tests.h"
#define MY_CLASS MIXIN3_CLASS
2013-11-08 02:48:55 -08:00
static int
_ab_sum_get(Eo *obj, void *class_data EINA_UNUSED)
{
/* This cast is just a hack for the test. */
Mixin3_Public_Data *pd = (Mixin3_Public_Data *) class_data;
int sum = 0;
printf("%s %s\n", eo_class_name_get(MY_CLASS), __func__);
sum = mixin_ab_sum_get(eo_super(obj, MY_CLASS));
2013-11-08 02:48:55 -08:00
++sum;
pd->count += 3;
{
int _a = 0, _b = 0;
_a = simple_a_get(obj);
_b = simple_b_get(obj);
2013-11-08 02:48:55 -08:00
fail_if(sum != _a + _b + 2);
}
2013-11-08 02:48:55 -08:00
return sum;
}
static Eo *
_constructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
{
return efl_constructor(eo_super(obj, MY_CLASS));
}
static void
_destructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
{
efl_destructor(eo_super(obj, MY_CLASS));
}
static Efl_Op_Description op_descs[] = {
EO_OP_FUNC_OVERRIDE(efl_constructor, _constructor),
EO_OP_FUNC_OVERRIDE(efl_destructor, _destructor),
2014-04-02 01:46:34 -07:00
EO_OP_FUNC_OVERRIDE(mixin_ab_sum_get, _ab_sum_get),
2013-11-08 02:48:55 -08:00
};
static const Efl_Class_Description class_desc = {
2014-04-02 01:46:34 -07:00
EO_VERSION,
"Mixin3",
EO_CLASS_TYPE_MIXIN,
2014-04-02 01:46:34 -07:00
EO_CLASS_DESCRIPTION_OPS(op_descs),
NULL,
sizeof(Mixin3_Public_Data),
2013-11-08 02:48:55 -08:00
NULL,
NULL
};
EO_DEFINE_CLASS(mixin3_class_get, &class_desc, MIXIN_CLASS, NULL);