summaryrefslogtreecommitdiff
path: root/src/tests/eo/function_overrides
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2013-11-08 10:25:38 +0000
committerTom Hacohen <tom@stosb.com>2014-04-10 04:20:19 +0100
commit13b30abe56becfdd38a4cd613ae13c4eaeeac72e (patch)
tree300633c697ef873d902346bddd235002dd076e6b /src/tests/eo/function_overrides
parent3a524e42010848ad91749ff8ca2259717a16b2af (diff)
eo2: cleaned up the function overrides test.
Diffstat (limited to 'src/tests/eo/function_overrides')
-rw-r--r--src/tests/eo/function_overrides/function_overrides_inherit2.c45
-rw-r--r--src/tests/eo/function_overrides/function_overrides_inherit2.h7
-rw-r--r--src/tests/eo/function_overrides/function_overrides_main.c47
-rw-r--r--src/tests/eo/function_overrides/function_overrides_simple.c31
-rw-r--r--src/tests/eo/function_overrides/function_overrides_simple.h10
5 files changed, 65 insertions, 75 deletions
diff --git a/src/tests/eo/function_overrides/function_overrides_inherit2.c b/src/tests/eo/function_overrides/function_overrides_inherit2.c
index e0920313cd..f228528719 100644
--- a/src/tests/eo/function_overrides/function_overrides_inherit2.c
+++ b/src/tests/eo/function_overrides/function_overrides_inherit2.c
@@ -18,47 +18,46 @@ _a_set(Eo *obj, void *class_data EINA_UNUSED, int a)
18 eo2_do(obj, simple_a_print()); 18 eo2_do(obj, simple_a_print());
19 eo2_do_super(obj, MY_CLASS, simple_a_set(a + 1)); 19 eo2_do_super(obj, MY_CLASS, simple_a_set(a + 1));
20 20
21 Simple_Public_Data *pd = eo_data_scope_get(obj, SIMPLE_CLASS); 21 Eina_Bool called;
22 pd->a_print_called = EINA_FALSE; 22 eo2_do_super(obj, MY_CLASS, called = simple_a_print());
23 eo2_do_super(obj, MY_CLASS, simple_a_print()); 23 fail_if(!called);
24 fail_if(!pd->a_print_called);
25} 24}
26 25
27Eina_Bool inherit2_print_called = EINA_FALSE; 26static Eina_Bool
28Eina_Bool inherit2_print2_called = EINA_FALSE;
29
30static void
31_print(Eo *obj, void *class_data EINA_UNUSED) 27_print(Eo *obj, void *class_data EINA_UNUSED)
32{ 28{
29 Eina_Bool called;
33 printf("Hey\n"); 30 printf("Hey\n");
34 inherit2_print_called = EINA_FALSE; 31 eo2_do_super(obj, MY_CLASS, called = inherit2_print());
35 eo2_do_super(obj, MY_CLASS, inherit2_print()); 32 fail_if(called);
36 // FIXME fail_if(inherit2_print_called); 33
37 inherit2_print_called = EINA_TRUE; 34 return EINA_TRUE;
38} 35}
39 36
40static void 37static Eina_Bool
41_print2(Eo *obj EINA_UNUSED, void *class_data EINA_UNUSED) 38_print2(Eo *obj EINA_UNUSED, void *class_data EINA_UNUSED)
42{ 39{
43 printf("Hey2\n"); 40 printf("Hey2\n");
44 inherit2_print2_called = EINA_TRUE; 41
42 return EINA_TRUE;
45} 43}
46 44
47static void 45static Eina_Bool
48_class_print(Eo_Class *klass, void *data EINA_UNUSED) 46_class_print(Eo_Class *klass, void *data EINA_UNUSED)
49{ 47{
48 Eina_Bool called;
50 printf("Print %s-%s\n", eo_class_name_get(klass), eo_class_name_get(MY_CLASS)); 49 printf("Print %s-%s\n", eo_class_name_get(klass), eo_class_name_get(MY_CLASS));
51 class_print_called = EINA_FALSE; 50 eo2_do_super(klass, MY_CLASS, called = simple_class_print());
52 eo2_do_super(klass, MY_CLASS, simple_class_print()); 51 fail_if(!called);
53 fail_if(!class_print_called); 52
53 eo2_do_super(klass, MY_CLASS, called = simple_class_print2());
54 fail_if(!called);
54 55
55 class_print2_called = EINA_FALSE; 56 return EINA_TRUE;
56 eo2_do_super(klass, MY_CLASS, simple_class_print2());
57 fail_if(!class_print2_called);
58} 57}
59 58
60EAPI EO2_VOID_FUNC_BODY(inherit2_print); 59EAPI EO2_FUNC_BODY(inherit2_print, Eina_Bool, EINA_FALSE);
61EAPI EO2_VOID_FUNC_BODY(inherit2_print2); 60EAPI EO2_FUNC_BODY(inherit2_print2, Eina_Bool, EINA_FALSE);
62 61
63static Eo2_Op_Description op_descs[] = { 62static Eo2_Op_Description op_descs[] = {
64 EO2_OP_FUNC(_print, inherit2_print, "Print hey"), 63 EO2_OP_FUNC(_print, inherit2_print, "Print hey"),
diff --git a/src/tests/eo/function_overrides/function_overrides_inherit2.h b/src/tests/eo/function_overrides/function_overrides_inherit2.h
index c891bd966d..48be203664 100644
--- a/src/tests/eo/function_overrides/function_overrides_inherit2.h
+++ b/src/tests/eo/function_overrides/function_overrides_inherit2.h
@@ -1,13 +1,10 @@
1#ifndef INHERIT2_H 1#ifndef INHERIT2_H
2#define INHERIT2_H 2#define INHERIT2_H
3 3
4EAPI void inherit2_print(void); 4EAPI Eina_Bool inherit2_print(void);
5EAPI void inherit2_print2(void); 5EAPI Eina_Bool inherit2_print2(void);
6 6
7#define INHERIT2_CLASS inherit2_class_get() 7#define INHERIT2_CLASS inherit2_class_get()
8const Eo_Class *inherit2_class_get(void); 8const Eo_Class *inherit2_class_get(void);
9 9
10extern Eina_Bool inherit2_print_called;
11extern Eina_Bool inherit2_print2_called;
12
13#endif 10#endif
diff --git a/src/tests/eo/function_overrides/function_overrides_main.c b/src/tests/eo/function_overrides/function_overrides_main.c
index 1caf9025ff..11f4c8f999 100644
--- a/src/tests/eo/function_overrides/function_overrides_main.c
+++ b/src/tests/eo/function_overrides/function_overrides_main.c
@@ -17,6 +17,7 @@ main(int argc, char *argv[])
17 (void) argv; 17 (void) argv;
18 eo_init(); 18 eo_init();
19 19
20 Eina_Bool called;
20 Eo *obj = eo2_add(INHERIT2_CLASS, NULL); 21 Eo *obj = eo2_add(INHERIT2_CLASS, NULL);
21 22
22 eo2_do(obj, simple_a_set(1)); 23 eo2_do(obj, simple_a_set(1));
@@ -34,40 +35,36 @@ main(int argc, char *argv[])
34 eo_unref(obj); 35 eo_unref(obj);
35 36
36 obj = eo2_add(INHERIT2_CLASS, NULL); 37 obj = eo2_add(INHERIT2_CLASS, NULL);
37 inherit2_print_called = EINA_FALSE; 38 eo2_do(obj, called = inherit2_print());
38 eo2_do(obj, inherit2_print()); 39 fail_if(!called);
39 eo2_do(obj, inherit2_print(), inherit2_print()); 40 eo2_do(obj, called = inherit2_print(), called = inherit2_print());
40 fail_if(!inherit2_print_called); 41 fail_if(!called);
41 eo_unref(obj); 42 eo_unref(obj);
42 43
43 obj = eo2_add(SIMPLE_CLASS, NULL); 44 obj = eo2_add(SIMPLE_CLASS, NULL);
44 inherit2_print_called = EINA_FALSE; 45 eo2_do(obj, called = inherit2_print());
45 eo2_do(obj, inherit2_print()); 46 fail_if(called);
46 fail_if(inherit2_print_called);
47 47
48#ifdef EO_DEBUG 48#ifdef EO_DEBUG
49 class_print_called = EINA_FALSE; 49 eo2_do(obj, called = simple_class_print());
50 eo2_do(obj, simple_class_print()); 50 fail_if(called);
51 fail_if(class_print_called);
52#endif 51#endif
53 52
54 class_print_called = EINA_FALSE; 53 eo2_do(SIMPLE_CLASS, called = simple_class_print());
55 eo2_do(SIMPLE_CLASS, simple_class_print()); 54 fail_if(!called);
56 fail_if(!class_print_called); 55
57 class_print_called = EINA_FALSE; 56 eo2_do(INHERIT_CLASS, called = simple_class_print());
58 eo2_do(INHERIT_CLASS, simple_class_print()); 57 fail_if(!called);
59 fail_if(!class_print_called); 58
60 class_print_called = EINA_FALSE; 59 eo2_do(INHERIT2_CLASS, called = simple_class_print());
61 eo2_do(INHERIT2_CLASS, simple_class_print()); 60 fail_if(!called);
62 fail_if(!class_print_called); 61
63 class_print_called = EINA_FALSE; 62 eo2_do(INHERIT3_CLASS, called = simple_class_print());
64 eo2_do(INHERIT3_CLASS, simple_class_print()); 63 fail_if(!called);
65 fail_if(!class_print_called);
66 64
67#ifdef EO_DEBUG 65#ifdef EO_DEBUG
68 pd->a_print_called = EINA_FALSE; 66 eo2_do(SIMPLE_CLASS, called = simple_a_print());
69 eo2_do(SIMPLE_CLASS, simple_a_print()); 67 fail_if(called);
70 fail_if(pd->a_print_called);
71#endif 68#endif
72 69
73 eo2_do_super(obj, SIMPLE_CLASS, eo2_constructor()); 70 eo2_do_super(obj, SIMPLE_CLASS, eo2_constructor());
diff --git a/src/tests/eo/function_overrides/function_overrides_simple.c b/src/tests/eo/function_overrides/function_overrides_simple.c
index 0819544491..3de5938aad 100644
--- a/src/tests/eo/function_overrides/function_overrides_simple.c
+++ b/src/tests/eo/function_overrides/function_overrides_simple.c
@@ -20,40 +20,41 @@ _a_set(Eo *obj EINA_UNUSED, void *class_data, int a)
20 pd->a = a; 20 pd->a = a;
21} 21}
22 22
23static void 23static Eina_Bool
24_a_print(Eo *obj EINA_UNUSED, void *class_data) 24_a_print(Eo *obj EINA_UNUSED, void *class_data)
25{ 25{
26 Simple_Public_Data *pd = class_data; 26 Simple_Public_Data *pd = class_data;
27 printf("Print %s %d\n", eo_class_name_get(MY_CLASS), pd->a); 27 printf("Print %s %d\n", eo_class_name_get(MY_CLASS), pd->a);
28 pd->a_print_called = EINA_TRUE; 28
29 return EINA_TRUE;
29} 30}
30 31
31static void 32static Eina_Bool
32_class_print(Eo_Class *klass, void *class_data EINA_UNUSED) 33_class_print(Eo_Class *klass, void *class_data EINA_UNUSED)
33{ 34{
34 printf("Print %s-%s\n", eo_class_name_get(klass), eo_class_name_get(MY_CLASS)); 35 printf("Print %s-%s\n", eo_class_name_get(klass), eo_class_name_get(MY_CLASS));
35 class_print_called = EINA_FALSE; 36 Eina_Bool called = EINA_FALSE;
36 eo2_do_super(klass, MY_CLASS, simple_class_print()); 37 eo2_do_super(klass, MY_CLASS, called = simple_class_print());
37 fail_if(class_print_called); 38 fail_if(called);
38 39
39 class_print2_called = EINA_FALSE; 40 eo2_do_super(klass, MY_CLASS, called = simple_class_print2());
40 eo2_do_super(klass, MY_CLASS, simple_class_print2()); 41 fail_if(called);
41 fail_if(class_print2_called);
42 42
43 class_print_called = EINA_TRUE; 43 return EINA_TRUE;
44} 44}
45 45
46static void 46static Eina_Bool
47_class_print2(Eo_Class *klass, void *class_data EINA_UNUSED) 47_class_print2(Eo_Class *klass, void *class_data EINA_UNUSED)
48{ 48{
49 printf("Print %s-%s\n", eo_class_name_get(klass), eo_class_name_get(MY_CLASS)); 49 printf("Print %s-%s\n", eo_class_name_get(klass), eo_class_name_get(MY_CLASS));
50 class_print2_called = EINA_TRUE; 50
51 return EINA_TRUE;
51} 52}
52 53
53EAPI EO2_VOID_FUNC_BODYV(simple_a_set, EO2_FUNC_CALL(a), int a); 54EAPI EO2_VOID_FUNC_BODYV(simple_a_set, EO2_FUNC_CALL(a), int a);
54EAPI EO2_VOID_FUNC_BODY(simple_a_print); 55EAPI EO2_FUNC_BODY(simple_a_print, Eina_Bool, EINA_FALSE);
55EAPI EO2_VOID_FUNC_BODY(simple_class_print); 56EAPI EO2_FUNC_BODY(simple_class_print, Eina_Bool, EINA_FALSE);
56EAPI EO2_VOID_FUNC_BODY(simple_class_print2); 57EAPI EO2_FUNC_BODY(simple_class_print2, Eina_Bool, EINA_FALSE);
57 58
58static Eo2_Op_Description op_descs[] = { 59static Eo2_Op_Description op_descs[] = {
59 EO2_OP_FUNC(_a_set, simple_a_set, "Set property A"), 60 EO2_OP_FUNC(_a_set, simple_a_set, "Set property A"),
diff --git a/src/tests/eo/function_overrides/function_overrides_simple.h b/src/tests/eo/function_overrides/function_overrides_simple.h
index 29ab6512b4..e4739685b2 100644
--- a/src/tests/eo/function_overrides/function_overrides_simple.h
+++ b/src/tests/eo/function_overrides/function_overrides_simple.h
@@ -4,13 +4,12 @@
4typedef struct 4typedef struct
5{ 5{
6 int a; 6 int a;
7 Eina_Bool a_print_called;
8} Simple_Public_Data; 7} Simple_Public_Data;
9 8
10EAPI void simple_a_set(int a); 9EAPI void simple_a_set(int a);
11EAPI void simple_a_print(void); 10EAPI Eina_Bool simple_a_print(void);
12EAPI void simple_class_print(void); 11EAPI Eina_Bool simple_class_print(void);
13EAPI void simple_class_print2(void); 12EAPI Eina_Bool simple_class_print2(void);
14 13
15extern const Eo_Event_Description _SIG_A_CHANGED; 14extern const Eo_Event_Description _SIG_A_CHANGED;
16#define SIG_A_CHANGED (&(_SIG_A_CHANGED)) 15#define SIG_A_CHANGED (&(_SIG_A_CHANGED))
@@ -18,7 +17,4 @@ extern const Eo_Event_Description _SIG_A_CHANGED;
18#define SIMPLE_CLASS simple_class_get() 17#define SIMPLE_CLASS simple_class_get()
19const Eo_Class *simple_class_get(void); 18const Eo_Class *simple_class_get(void);
20 19
21extern Eina_Bool class_print_called;
22extern Eina_Bool class_print2_called;
23
24#endif 20#endif