summaryrefslogtreecommitdiff
path: root/src/tests/eo/suite/eo_test_class_simple.c
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2013-11-08 12:25:39 +0000
committerTom Hacohen <tom@stosb.com>2014-04-10 04:20:19 +0100
commit08b28211b6b54b94e7b187b8cbeaf58fc337e2d1 (patch)
tree1f1ae8eb58cec1d2e57a6e68eeb1e933b6356524 /src/tests/eo/suite/eo_test_class_simple.c
parentff64050a7bb8aea9dc6fef96c2d57f20bd0fadbc (diff)
eo2: migrated the eo-suite test to eo2.
Diffstat (limited to 'src/tests/eo/suite/eo_test_class_simple.c')
-rw-r--r--src/tests/eo/suite/eo_test_class_simple.c72
1 files changed, 35 insertions, 37 deletions
diff --git a/src/tests/eo/suite/eo_test_class_simple.c b/src/tests/eo/suite/eo_test_class_simple.c
index cbeb18362a..9b55ffb3fa 100644
--- a/src/tests/eo/suite/eo_test_class_simple.c
+++ b/src/tests/eo/suite/eo_test_class_simple.c
@@ -7,78 +7,76 @@
7 7
8#define MY_CLASS SIMPLE_CLASS 8#define MY_CLASS SIMPLE_CLASS
9 9
10EAPI Eo_Op SIMPLE_BASE_ID = 0;
11
12EAPI const Eo_Event_Description _EV_A_CHANGED = 10EAPI const Eo_Event_Description _EV_A_CHANGED =
13 EO_EVENT_DESCRIPTION("a,changed", "Called when a has changed."); 11 EO_EVENT_DESCRIPTION("a,changed", "Called when a has changed.");
14 12
15static void 13static void
16_a_set(Eo *obj EINA_UNUSED, void *class_data, va_list *list) 14_a_set(Eo *obj EINA_UNUSED, void *class_data, int a)
17{ 15{
18 Simple_Public_Data *pd = class_data; 16 Simple_Public_Data *pd = class_data;
19 int a;
20 a = va_arg(*list, int);
21 printf("%s %d\n", eo_class_name_get(MY_CLASS), a); 17 printf("%s %d\n", eo_class_name_get(MY_CLASS), a);
22 pd->a = a; 18 pd->a = a;
23 19
24 eo_do(obj, eo_event_callback_call(EV_A_CHANGED, &pd->a, NULL)); 20 eo2_do(obj, eo2_event_callback_call(EV_A_CHANGED, &pd->a));
25} 21}
26 22
27static void 23static int
28_a_print(Eo *obj EINA_UNUSED, void *class_data, va_list *list) 24_a_get(Eo *obj EINA_UNUSED, void *class_data)
25{
26 Simple_Public_Data *pd = class_data;
27
28 return pd->a;
29}
30
31static Eina_Bool
32_a_print(Eo *obj EINA_UNUSED, void *class_data)
29{ 33{
30 const Simple_Public_Data *pd = class_data; 34 const Simple_Public_Data *pd = class_data;
31 (void) list;
32 printf("Print %s %d\n", eo_class_name_get(MY_CLASS), pd->a); 35 printf("Print %s %d\n", eo_class_name_get(MY_CLASS), pd->a);
36
37 return EINA_TRUE;
33} 38}
34 39
35static void 40static Eina_Bool
36_class_hi_print(Eo_Class *klass, void *data EINA_UNUSED, va_list *list) 41_class_hi_print(Eo_Class *klass, void *data EINA_UNUSED)
37{ 42{
38 (void) list;
39 printf("Hi Print %s\n", eo_class_name_get(klass)); 43 printf("Hi Print %s\n", eo_class_name_get(klass));
44
45 return EINA_TRUE;
40} 46}
41 47
42static void 48static void
43_dbg_info_get(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list) 49_dbg_info_get(Eo *eo_obj, void *_pd EINA_UNUSED, Eo_Dbg_Info *root)
44{ 50{
45 Eo_Dbg_Info *root = (Eo_Dbg_Info *) va_arg(*list, Eo_Dbg_Info *); 51 eo2_do_super(eo_obj, MY_CLASS, eo2_dbg_info_get(root));
46 eo_do_super(eo_obj, MY_CLASS, eo_dbg_info_get(root));
47 Eo_Dbg_Info *group = EO_DBG_INFO_LIST_APPEND(root, "Test list"); 52 Eo_Dbg_Info *group = EO_DBG_INFO_LIST_APPEND(root, "Test list");
48 EO_DBG_INFO_APPEND(group, "Test", EINA_VALUE_TYPE_INT, 8); 53 EO_DBG_INFO_APPEND(group, "Test", EINA_VALUE_TYPE_INT, 8);
49} 54}
50 55
51static void 56EO2_VOID_FUNC_BODYV(simple_a_set, EO2_FUNC_CALL(a), int a);
52_class_constructor(Eo_Class *klass) 57EO2_FUNC_BODY(simple_a_get, int, 0);
53{ 58EO2_FUNC_BODY(simple_a_print, Eina_Bool, EINA_FALSE);
54 const Eo_Op_Func_Description func_desc[] = { 59EO2_FUNC_BODY(simple_class_hi_print, Eina_Bool, EINA_FALSE);
55 EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DBG_INFO_GET), _dbg_info_get),
56 EO_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_SET), _a_set),
57 EO_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_PRINT), _a_print),
58 EO_OP_FUNC_CLASS(SIMPLE_ID(SIMPLE_SUB_ID_CLASS_HI_PRINT), _class_hi_print),
59 EO_OP_FUNC_SENTINEL
60 };
61
62 eo_class_funcs_set(klass, func_desc);
63}
64 60
65static const Eo_Op_Description op_desc[] = { 61static Eo2_Op_Description op_descs[] = {
66 EO_OP_DESCRIPTION(SIMPLE_SUB_ID_A_SET, "Set property A"), 62 EO2_OP_FUNC_OVERRIDE(_dbg_info_get, eo2_dbg_info_get),
67 EO_OP_DESCRIPTION(SIMPLE_SUB_ID_A_PRINT, "Print property A"), 63 EO2_OP_FUNC(_a_set, simple_a_set, "Set property a"),
68 EO_OP_DESCRIPTION_CLASS(SIMPLE_SUB_ID_CLASS_HI_PRINT, "Print Hi"), 64 EO2_OP_FUNC(_a_get, simple_a_get, "Get property a"),
69 EO_OP_DESCRIPTION_SENTINEL 65 EO2_OP_FUNC(_a_print, simple_a_print, "Print property a"),
66 EO2_OP_CLASS_FUNC(_class_hi_print, simple_class_hi_print, "Print property a"),
67 EO2_OP_SENTINEL
70}; 68};
71 69
72static const Eo_Class_Description class_desc = { 70static const Eo_Class_Description class_desc = {
73 EO_VERSION, 71 EO2_VERSION,
74 "Simple", 72 "Simple",
75 EO_CLASS_TYPE_REGULAR, 73 EO_CLASS_TYPE_REGULAR,
76 EO_CLASS_DESCRIPTION_OPS(&SIMPLE_BASE_ID, op_desc, SIMPLE_SUB_ID_LAST), 74 EO2_CLASS_DESCRIPTION_OPS(op_descs),
77 NULL, 75 NULL,
78 sizeof(Simple_Public_Data), 76 sizeof(Simple_Public_Data),
79 _class_constructor, 77 NULL,
80 NULL 78 NULL
81}; 79};
82 80
83EO_DEFINE_CLASS(simple_class_get, &class_desc, EO_BASE_CLASS, NULL) 81EO_DEFINE_CLASS(simple_class_get, &class_desc, EO2_BASE_CLASS, NULL)
84 82