Changeset View
Changeset View
Standalone View
Standalone View
src/tests/eo/suite/eo_test_general.c
Show First 20 Lines • Show All 60 Lines • ▼ Show 20 Line(s) | |||||
61 | } | 61 | } | ||
62 | 62 | | |||
63 | static void | 63 | static void | ||
64 | _simple_obj_override_a_double_set(Eo *obj, void *class_data EINA_UNUSED, int a) | 64 | _simple_obj_override_a_double_set(Eo *obj, void *class_data EINA_UNUSED, int a) | ||
65 | { | 65 | { | ||
66 | simple_a_set(efl_super(obj, EFL_OBJECT_OVERRIDE_CLASS), 2 * a); | 66 | simple_a_set(efl_super(obj, EFL_OBJECT_OVERRIDE_CLASS), 2 * a); | ||
67 | } | 67 | } | ||
68 | 68 | | |||
69 | EAPI int test_class_beef_get(const Efl_Object *obj); | ||||
70 | | ||||
71 | EFL_FUNC_BODY_CONST(test_class_beef_get, int, 0) | ||||
72 | | ||||
73 | static int | ||||
74 | _simple_obj_override_beef_get(Eo *obj, void *class_data EINA_UNUSED) | ||||
75 | { | ||||
76 | test_class_beef_get(efl_super(obj, EFL_OBJECT_OVERRIDE_CLASS)); | ||||
77 | | ||||
78 | return 1337; | ||||
79 | } | ||||
80 | | ||||
69 | EFL_START_TEST(efl_object_override_tests) | 81 | EFL_START_TEST(efl_object_override_tests) | ||
70 | { | 82 | { | ||
71 | 83 | | |||
72 | Eo *obj = efl_add_ref(SIMPLE_CLASS, NULL); | 84 | Eo *obj = efl_add_ref(SIMPLE_CLASS, NULL); | ||
73 | fail_if(!obj); | 85 | fail_if(!obj); | ||
74 | 86 | | |||
75 | /* First get the value before the override to make sure it works and to | 87 | /* First get the value before the override to make sure it works and to | ||
76 | * make sure we don't cache. */ | 88 | * make sure we don't cache. */ | ||
Show All 23 Lines | |||||
100 | 112 | | |||
101 | /* Try overriding again, allowed since 1.21. */ | 113 | /* Try overriding again, allowed since 1.21. */ | ||
102 | fail_if(!efl_object_override(obj, &overrides)); | 114 | fail_if(!efl_object_override(obj, &overrides)); | ||
103 | ck_assert_int_eq(simple_a_get(obj), OVERRIDE_A + OVERRIDE_A_SIMPLE * 2); | 115 | ck_assert_int_eq(simple_a_get(obj), OVERRIDE_A + OVERRIDE_A_SIMPLE * 2); | ||
104 | 116 | | |||
105 | /* Try introducing a new function */ | 117 | /* Try introducing a new function */ | ||
106 | EFL_OPS_DEFINE( | 118 | EFL_OPS_DEFINE( | ||
107 | overrides3, | 119 | overrides3, | ||
108 | EFL_OBJECT_OP_FUNC(simple2_class_beef_get, _simple_obj_override_a_double_set)); | 120 | EFL_OBJECT_OP_FUNC(test_class_beef_get, _simple_obj_override_beef_get)); | ||
109 | fail_if(efl_object_override(obj, &overrides3)); | 121 | fail_if(efl_object_override(obj, &overrides3)); | ||
110 | fail_if(!efl_object_override(obj, NULL)); | 122 | fail_if(!efl_object_override(obj, NULL)); | ||
111 | fail_if(efl_object_override(obj, &overrides3)); | 123 | fail_if(efl_object_override(obj, &overrides3)); | ||
112 | 124 | | |||
113 | /* Test override reset of all functions */ | 125 | /* Test override reset of all functions */ | ||
114 | fail_if(!efl_object_override(obj, NULL)); | 126 | fail_if(!efl_object_override(obj, NULL)); | ||
115 | simple_a_set(obj, 42 * OVERRIDE_A_SIMPLE); | 127 | simple_a_set(obj, 42 * OVERRIDE_A_SIMPLE); | ||
116 | ck_assert_int_eq(simple_a_get(obj), 42 * OVERRIDE_A_SIMPLE); | 128 | ck_assert_int_eq(simple_a_get(obj), 42 * OVERRIDE_A_SIMPLE); | ||
▲ Show 20 Lines • Show All 350 Lines • ▼ Show 20 Line(s) | |||||
467 | static Eina_Bool | 479 | static Eina_Bool | ||
468 | _class_initializer(Efl_Class *klass) | 480 | _class_initializer(Efl_Class *klass) | ||
469 | { | 481 | { | ||
470 | EFL_OPS_DEFINE(ops, | 482 | EFL_OPS_DEFINE(ops, | ||
471 | EFL_OBJECT_OP_FUNC(efl_constructor, _man_con), | 483 | EFL_OBJECT_OP_FUNC(efl_constructor, _man_con), | ||
472 | EFL_OBJECT_OP_FUNC(efl_destructor, _man_des), | 484 | EFL_OBJECT_OP_FUNC(efl_destructor, _man_des), | ||
473 | ); | 485 | ); | ||
474 | 486 | | |||
475 | return efl_class_functions_set(klass, &ops, NULL, NULL); | 487 | return efl_class_functions_set(klass, &ops, NULL); | ||
476 | } | 488 | } | ||
477 | 489 | | |||
478 | EFL_START_TEST(eo_man_free) | 490 | EFL_START_TEST(eo_man_free) | ||
479 | { | 491 | { | ||
480 | 492 | | |||
481 | /* Usually should be const, not const only for the test... */ | 493 | /* Usually should be const, not const only for the test... */ | ||
482 | static Efl_Class_Description class_desc = { | 494 | static Efl_Class_Description class_desc = { | ||
483 | EO_VERSION, | 495 | EO_VERSION, | ||
▲ Show 20 Lines • Show All 560 Lines • ▼ Show 20 Line(s) | |||||
1044 | 1056 | | |||
1045 | static Eina_Bool | 1057 | static Eina_Bool | ||
1046 | _multi_class_initializer(Efl_Class *klass) | 1058 | _multi_class_initializer(Efl_Class *klass) | ||
1047 | { | 1059 | { | ||
1048 | EFL_OPS_DEFINE(ops, | 1060 | EFL_OPS_DEFINE(ops, | ||
1049 | EFL_OBJECT_OP_FUNC(resolve_a_print, _a_print), | 1061 | EFL_OBJECT_OP_FUNC(resolve_a_print, _a_print), | ||
1050 | ); | 1062 | ); | ||
1051 | 1063 | | |||
1052 | return efl_class_functions_set(klass, &ops, NULL, NULL); | 1064 | return efl_class_functions_set(klass, &ops, NULL); | ||
1053 | } | 1065 | } | ||
1054 | 1066 | | |||
1055 | EFL_START_TEST(efl_func_resolve) | 1067 | EFL_START_TEST(efl_func_resolve) | ||
1056 | { | 1068 | { | ||
1057 | 1069 | | |||
1058 | /* Usually should be const, not const only for the test... */ | 1070 | /* Usually should be const, not const only for the test... */ | ||
1059 | static Efl_Class_Description class_desc = { | 1071 | static Efl_Class_Description class_desc = { | ||
1060 | EO_VERSION, | 1072 | EO_VERSION, | ||
▲ Show 20 Lines • Show All 149 Lines • ▼ Show 20 Line(s) | |||||
1210 | 1222 | | |||
1211 | static Eina_Bool | 1223 | static Eina_Bool | ||
1212 | _add_failures_class_initializer(Efl_Class *klass) | 1224 | _add_failures_class_initializer(Efl_Class *klass) | ||
1213 | { | 1225 | { | ||
1214 | EFL_OPS_DEFINE(ops, | 1226 | EFL_OPS_DEFINE(ops, | ||
1215 | EFL_OBJECT_OP_FUNC(efl_finalize, _efl_add_failures_finalize), | 1227 | EFL_OBJECT_OP_FUNC(efl_finalize, _efl_add_failures_finalize), | ||
1216 | ); | 1228 | ); | ||
1217 | 1229 | | |||
1218 | return efl_class_functions_set(klass, &ops, NULL, NULL); | 1230 | return efl_class_functions_set(klass, &ops, NULL); | ||
1219 | } | 1231 | } | ||
1220 | 1232 | | |||
1221 | EFL_START_TEST(efl_add_failures) | 1233 | EFL_START_TEST(efl_add_failures) | ||
1222 | { | 1234 | { | ||
1223 | 1235 | | |||
1224 | static const Efl_Class_Description class_desc = { | 1236 | static const Efl_Class_Description class_desc = { | ||
1225 | EO_VERSION, | 1237 | EO_VERSION, | ||
1226 | "Simple2", | 1238 | "Simple2", | ||
▲ Show 20 Lines • Show All 396 Lines • ▼ Show 20 Line(s) | |||||
1623 | } | 1635 | } | ||
1624 | 1636 | | |||
1625 | EFL_FUNC_BODY(inherit_value, int, 0); | 1637 | EFL_FUNC_BODY(inherit_value, int, 0); | ||
1626 | 1638 | | |||
1627 | static Eina_Bool | 1639 | static Eina_Bool | ||
1628 | _cast_inherit_class_initializer_1(Efl_Class *klass) | 1640 | _cast_inherit_class_initializer_1(Efl_Class *klass) | ||
1629 | { | 1641 | { | ||
1630 | EFL_OPS_DEFINE(ops, EFL_OBJECT_OP_FUNC(inherit_value, _inherit_value_1), ); | 1642 | EFL_OPS_DEFINE(ops, EFL_OBJECT_OP_FUNC(inherit_value, _inherit_value_1), ); | ||
1631 | return efl_class_functions_set(klass, &ops, NULL, NULL); | 1643 | return efl_class_functions_set(klass, &ops, NULL); | ||
1632 | } | 1644 | } | ||
1633 | 1645 | | |||
1634 | static Eina_Bool | 1646 | static Eina_Bool | ||
1635 | _cast_inherit_class_initializer_2(Efl_Class *klass) | 1647 | _cast_inherit_class_initializer_2(Efl_Class *klass) | ||
1636 | { | 1648 | { | ||
1637 | EFL_OPS_DEFINE(ops, EFL_OBJECT_OP_FUNC(inherit_value, _inherit_value_2), ); | 1649 | EFL_OPS_DEFINE(ops, EFL_OBJECT_OP_FUNC(inherit_value, _inherit_value_2), ); | ||
1638 | return efl_class_functions_set(klass, &ops, NULL, NULL); | 1650 | return efl_class_functions_set(klass, &ops, NULL); | ||
1639 | } | 1651 | } | ||
1640 | 1652 | | |||
1641 | EFL_START_TEST(efl_cast_test) | 1653 | EFL_START_TEST(efl_cast_test) | ||
1642 | { | 1654 | { | ||
1643 | 1655 | | |||
1644 | static const Efl_Class_Description class_desc_1 = { | 1656 | static const Efl_Class_Description class_desc_1 = { | ||
1645 | EO_VERSION, | 1657 | EO_VERSION, | ||
1646 | "FirstInherit", | 1658 | "FirstInherit", | ||
▲ Show 20 Lines • Show All 215 Lines • Show Last 20 Lines |