forked from enlightenment/efl
eo2: cleaned up the function overrides test.
This commit is contained in:
parent
3a524e4201
commit
13b30abe56
|
@ -18,47 +18,46 @@ _a_set(Eo *obj, void *class_data EINA_UNUSED, int a)
|
||||||
eo2_do(obj, simple_a_print());
|
eo2_do(obj, simple_a_print());
|
||||||
eo2_do_super(obj, MY_CLASS, simple_a_set(a + 1));
|
eo2_do_super(obj, MY_CLASS, simple_a_set(a + 1));
|
||||||
|
|
||||||
Simple_Public_Data *pd = eo_data_scope_get(obj, SIMPLE_CLASS);
|
Eina_Bool called;
|
||||||
pd->a_print_called = EINA_FALSE;
|
eo2_do_super(obj, MY_CLASS, called = simple_a_print());
|
||||||
eo2_do_super(obj, MY_CLASS, simple_a_print());
|
fail_if(!called);
|
||||||
fail_if(!pd->a_print_called);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Eina_Bool inherit2_print_called = EINA_FALSE;
|
static Eina_Bool
|
||||||
Eina_Bool inherit2_print2_called = EINA_FALSE;
|
|
||||||
|
|
||||||
static void
|
|
||||||
_print(Eo *obj, void *class_data EINA_UNUSED)
|
_print(Eo *obj, void *class_data EINA_UNUSED)
|
||||||
{
|
{
|
||||||
|
Eina_Bool called;
|
||||||
printf("Hey\n");
|
printf("Hey\n");
|
||||||
inherit2_print_called = EINA_FALSE;
|
eo2_do_super(obj, MY_CLASS, called = inherit2_print());
|
||||||
eo2_do_super(obj, MY_CLASS, inherit2_print());
|
fail_if(called);
|
||||||
// FIXME fail_if(inherit2_print_called);
|
|
||||||
inherit2_print_called = EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static Eina_Bool
|
||||||
_print2(Eo *obj EINA_UNUSED, void *class_data EINA_UNUSED)
|
_print2(Eo *obj EINA_UNUSED, void *class_data EINA_UNUSED)
|
||||||
{
|
{
|
||||||
printf("Hey2\n");
|
printf("Hey2\n");
|
||||||
inherit2_print2_called = EINA_TRUE;
|
|
||||||
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static Eina_Bool
|
||||||
_class_print(Eo_Class *klass, void *data EINA_UNUSED)
|
_class_print(Eo_Class *klass, void *data EINA_UNUSED)
|
||||||
{
|
{
|
||||||
|
Eina_Bool called;
|
||||||
printf("Print %s-%s\n", eo_class_name_get(klass), eo_class_name_get(MY_CLASS));
|
printf("Print %s-%s\n", eo_class_name_get(klass), eo_class_name_get(MY_CLASS));
|
||||||
class_print_called = EINA_FALSE;
|
eo2_do_super(klass, MY_CLASS, called = simple_class_print());
|
||||||
eo2_do_super(klass, MY_CLASS, simple_class_print());
|
fail_if(!called);
|
||||||
fail_if(!class_print_called);
|
|
||||||
|
|
||||||
class_print2_called = EINA_FALSE;
|
eo2_do_super(klass, MY_CLASS, called = simple_class_print2());
|
||||||
eo2_do_super(klass, MY_CLASS, simple_class_print2());
|
fail_if(!called);
|
||||||
fail_if(!class_print2_called);
|
|
||||||
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI EO2_VOID_FUNC_BODY(inherit2_print);
|
EAPI EO2_FUNC_BODY(inherit2_print, Eina_Bool, EINA_FALSE);
|
||||||
EAPI EO2_VOID_FUNC_BODY(inherit2_print2);
|
EAPI EO2_FUNC_BODY(inherit2_print2, Eina_Bool, EINA_FALSE);
|
||||||
|
|
||||||
static Eo2_Op_Description op_descs[] = {
|
static Eo2_Op_Description op_descs[] = {
|
||||||
EO2_OP_FUNC(_print, inherit2_print, "Print hey"),
|
EO2_OP_FUNC(_print, inherit2_print, "Print hey"),
|
||||||
|
|
|
@ -1,13 +1,10 @@
|
||||||
#ifndef INHERIT2_H
|
#ifndef INHERIT2_H
|
||||||
#define INHERIT2_H
|
#define INHERIT2_H
|
||||||
|
|
||||||
EAPI void inherit2_print(void);
|
EAPI Eina_Bool inherit2_print(void);
|
||||||
EAPI void inherit2_print2(void);
|
EAPI Eina_Bool inherit2_print2(void);
|
||||||
|
|
||||||
#define INHERIT2_CLASS inherit2_class_get()
|
#define INHERIT2_CLASS inherit2_class_get()
|
||||||
const Eo_Class *inherit2_class_get(void);
|
const Eo_Class *inherit2_class_get(void);
|
||||||
|
|
||||||
extern Eina_Bool inherit2_print_called;
|
|
||||||
extern Eina_Bool inherit2_print2_called;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -17,6 +17,7 @@ main(int argc, char *argv[])
|
||||||
(void) argv;
|
(void) argv;
|
||||||
eo_init();
|
eo_init();
|
||||||
|
|
||||||
|
Eina_Bool called;
|
||||||
Eo *obj = eo2_add(INHERIT2_CLASS, NULL);
|
Eo *obj = eo2_add(INHERIT2_CLASS, NULL);
|
||||||
|
|
||||||
eo2_do(obj, simple_a_set(1));
|
eo2_do(obj, simple_a_set(1));
|
||||||
|
@ -34,40 +35,36 @@ main(int argc, char *argv[])
|
||||||
eo_unref(obj);
|
eo_unref(obj);
|
||||||
|
|
||||||
obj = eo2_add(INHERIT2_CLASS, NULL);
|
obj = eo2_add(INHERIT2_CLASS, NULL);
|
||||||
inherit2_print_called = EINA_FALSE;
|
eo2_do(obj, called = inherit2_print());
|
||||||
eo2_do(obj, inherit2_print());
|
fail_if(!called);
|
||||||
eo2_do(obj, inherit2_print(), inherit2_print());
|
eo2_do(obj, called = inherit2_print(), called = inherit2_print());
|
||||||
fail_if(!inherit2_print_called);
|
fail_if(!called);
|
||||||
eo_unref(obj);
|
eo_unref(obj);
|
||||||
|
|
||||||
obj = eo2_add(SIMPLE_CLASS, NULL);
|
obj = eo2_add(SIMPLE_CLASS, NULL);
|
||||||
inherit2_print_called = EINA_FALSE;
|
eo2_do(obj, called = inherit2_print());
|
||||||
eo2_do(obj, inherit2_print());
|
fail_if(called);
|
||||||
fail_if(inherit2_print_called);
|
|
||||||
|
|
||||||
#ifdef EO_DEBUG
|
#ifdef EO_DEBUG
|
||||||
class_print_called = EINA_FALSE;
|
eo2_do(obj, called = simple_class_print());
|
||||||
eo2_do(obj, simple_class_print());
|
fail_if(called);
|
||||||
fail_if(class_print_called);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class_print_called = EINA_FALSE;
|
eo2_do(SIMPLE_CLASS, called = simple_class_print());
|
||||||
eo2_do(SIMPLE_CLASS, simple_class_print());
|
fail_if(!called);
|
||||||
fail_if(!class_print_called);
|
|
||||||
class_print_called = EINA_FALSE;
|
eo2_do(INHERIT_CLASS, called = simple_class_print());
|
||||||
eo2_do(INHERIT_CLASS, simple_class_print());
|
fail_if(!called);
|
||||||
fail_if(!class_print_called);
|
|
||||||
class_print_called = EINA_FALSE;
|
eo2_do(INHERIT2_CLASS, called = simple_class_print());
|
||||||
eo2_do(INHERIT2_CLASS, simple_class_print());
|
fail_if(!called);
|
||||||
fail_if(!class_print_called);
|
|
||||||
class_print_called = EINA_FALSE;
|
eo2_do(INHERIT3_CLASS, called = simple_class_print());
|
||||||
eo2_do(INHERIT3_CLASS, simple_class_print());
|
fail_if(!called);
|
||||||
fail_if(!class_print_called);
|
|
||||||
|
|
||||||
#ifdef EO_DEBUG
|
#ifdef EO_DEBUG
|
||||||
pd->a_print_called = EINA_FALSE;
|
eo2_do(SIMPLE_CLASS, called = simple_a_print());
|
||||||
eo2_do(SIMPLE_CLASS, simple_a_print());
|
fail_if(called);
|
||||||
fail_if(pd->a_print_called);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
eo2_do_super(obj, SIMPLE_CLASS, eo2_constructor());
|
eo2_do_super(obj, SIMPLE_CLASS, eo2_constructor());
|
||||||
|
|
|
@ -20,40 +20,41 @@ _a_set(Eo *obj EINA_UNUSED, void *class_data, int a)
|
||||||
pd->a = a;
|
pd->a = a;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static Eina_Bool
|
||||||
_a_print(Eo *obj EINA_UNUSED, void *class_data)
|
_a_print(Eo *obj EINA_UNUSED, void *class_data)
|
||||||
{
|
{
|
||||||
Simple_Public_Data *pd = class_data;
|
Simple_Public_Data *pd = class_data;
|
||||||
printf("Print %s %d\n", eo_class_name_get(MY_CLASS), pd->a);
|
printf("Print %s %d\n", eo_class_name_get(MY_CLASS), pd->a);
|
||||||
pd->a_print_called = EINA_TRUE;
|
|
||||||
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static Eina_Bool
|
||||||
_class_print(Eo_Class *klass, void *class_data EINA_UNUSED)
|
_class_print(Eo_Class *klass, void *class_data EINA_UNUSED)
|
||||||
{
|
{
|
||||||
printf("Print %s-%s\n", eo_class_name_get(klass), eo_class_name_get(MY_CLASS));
|
printf("Print %s-%s\n", eo_class_name_get(klass), eo_class_name_get(MY_CLASS));
|
||||||
class_print_called = EINA_FALSE;
|
Eina_Bool called = EINA_FALSE;
|
||||||
eo2_do_super(klass, MY_CLASS, simple_class_print());
|
eo2_do_super(klass, MY_CLASS, called = simple_class_print());
|
||||||
fail_if(class_print_called);
|
fail_if(called);
|
||||||
|
|
||||||
class_print2_called = EINA_FALSE;
|
eo2_do_super(klass, MY_CLASS, called = simple_class_print2());
|
||||||
eo2_do_super(klass, MY_CLASS, simple_class_print2());
|
fail_if(called);
|
||||||
fail_if(class_print2_called);
|
|
||||||
|
|
||||||
class_print_called = EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static Eina_Bool
|
||||||
_class_print2(Eo_Class *klass, void *class_data EINA_UNUSED)
|
_class_print2(Eo_Class *klass, void *class_data EINA_UNUSED)
|
||||||
{
|
{
|
||||||
printf("Print %s-%s\n", eo_class_name_get(klass), eo_class_name_get(MY_CLASS));
|
printf("Print %s-%s\n", eo_class_name_get(klass), eo_class_name_get(MY_CLASS));
|
||||||
class_print2_called = EINA_TRUE;
|
|
||||||
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI EO2_VOID_FUNC_BODYV(simple_a_set, EO2_FUNC_CALL(a), int a);
|
EAPI EO2_VOID_FUNC_BODYV(simple_a_set, EO2_FUNC_CALL(a), int a);
|
||||||
EAPI EO2_VOID_FUNC_BODY(simple_a_print);
|
EAPI EO2_FUNC_BODY(simple_a_print, Eina_Bool, EINA_FALSE);
|
||||||
EAPI EO2_VOID_FUNC_BODY(simple_class_print);
|
EAPI EO2_FUNC_BODY(simple_class_print, Eina_Bool, EINA_FALSE);
|
||||||
EAPI EO2_VOID_FUNC_BODY(simple_class_print2);
|
EAPI EO2_FUNC_BODY(simple_class_print2, Eina_Bool, EINA_FALSE);
|
||||||
|
|
||||||
static Eo2_Op_Description op_descs[] = {
|
static Eo2_Op_Description op_descs[] = {
|
||||||
EO2_OP_FUNC(_a_set, simple_a_set, "Set property A"),
|
EO2_OP_FUNC(_a_set, simple_a_set, "Set property A"),
|
||||||
|
|
|
@ -4,13 +4,12 @@
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int a;
|
int a;
|
||||||
Eina_Bool a_print_called;
|
|
||||||
} Simple_Public_Data;
|
} Simple_Public_Data;
|
||||||
|
|
||||||
EAPI void simple_a_set(int a);
|
EAPI void simple_a_set(int a);
|
||||||
EAPI void simple_a_print(void);
|
EAPI Eina_Bool simple_a_print(void);
|
||||||
EAPI void simple_class_print(void);
|
EAPI Eina_Bool simple_class_print(void);
|
||||||
EAPI void simple_class_print2(void);
|
EAPI Eina_Bool simple_class_print2(void);
|
||||||
|
|
||||||
extern const Eo_Event_Description _SIG_A_CHANGED;
|
extern const Eo_Event_Description _SIG_A_CHANGED;
|
||||||
#define SIG_A_CHANGED (&(_SIG_A_CHANGED))
|
#define SIG_A_CHANGED (&(_SIG_A_CHANGED))
|
||||||
|
@ -18,7 +17,4 @@ extern const Eo_Event_Description _SIG_A_CHANGED;
|
||||||
#define SIMPLE_CLASS simple_class_get()
|
#define SIMPLE_CLASS simple_class_get()
|
||||||
const Eo_Class *simple_class_get(void);
|
const Eo_Class *simple_class_get(void);
|
||||||
|
|
||||||
extern Eina_Bool class_print_called;
|
|
||||||
extern Eina_Bool class_print2_called;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue