summaryrefslogtreecommitdiff
path: root/src/tests/eo/suite
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2016-09-08 13:08:08 +0100
committerTom Hacohen <tom@stosb.com>2016-09-08 13:59:04 +0100
commitbd3801247e50ff1cda48af33345a918240d7d315 (patch)
tree66dcde47e0b8d00e226a431fe899fda4cc2440e7 /src/tests/eo/suite
parent0f8fb7ef88d1bbb53e70c5ea0a4e8ef6a55c1a47 (diff)
Eo: Make function overrides implicit.
Before this commit, function overrides were explicit. That is, you'd have to explicitly state you were overriding a function instead of creating a new one. This made the code a tad more complex, and was also a bit more annoying to use. This commit removes this extra piece of information. This means we now store much less information per function, that will let us further optimise out structures in the future.
Diffstat (limited to 'src/tests/eo/suite')
-rw-r--r--src/tests/eo/suite/eo_test_class_behaviour_errors.c2
-rw-r--r--src/tests/eo/suite/eo_test_class_errors.c40
-rw-r--r--src/tests/eo/suite/eo_test_class_simple.c4
-rw-r--r--src/tests/eo/suite/eo_test_class_singleton.c2
-rw-r--r--src/tests/eo/suite/eo_test_general.c12
5 files changed, 13 insertions, 47 deletions
diff --git a/src/tests/eo/suite/eo_test_class_behaviour_errors.c b/src/tests/eo/suite/eo_test_class_behaviour_errors.c
index fc443fbe8b..49fef3bcd4 100644
--- a/src/tests/eo/suite/eo_test_class_behaviour_errors.c
+++ b/src/tests/eo/suite/eo_test_class_behaviour_errors.c
@@ -26,7 +26,7 @@ static Eina_Bool
26_destructor_unref_class_initializer(Efl_Class *klass2) 26_destructor_unref_class_initializer(Efl_Class *klass2)
27{ 27{
28 EFL_OPS_DEFINE(ops, 28 EFL_OPS_DEFINE(ops,
29 EFL_OBJECT_OP_FUNC_OVERRIDE(efl_destructor, _destructor_unref), 29 EFL_OBJECT_OP_FUNC(efl_destructor, _destructor_unref),
30 ); 30 );
31 31
32 return efl_class_functions_set(klass2, &ops); 32 return efl_class_functions_set(klass2, &ops);
diff --git a/src/tests/eo/suite/eo_test_class_errors.c b/src/tests/eo/suite/eo_test_class_errors.c
index 89ad49be23..0e475b52d4 100644
--- a/src/tests/eo/suite/eo_test_class_errors.c
+++ b/src/tests/eo/suite/eo_test_class_errors.c
@@ -241,39 +241,6 @@ START_TEST(eo_null_api)
241END_TEST 241END_TEST
242 242
243static Eina_Bool 243static Eina_Bool
244_wrong_override_class_initializer(Efl_Class *klass)
245{
246 EFL_OPS_DEFINE(ops,
247 EFL_OBJECT_OP_FUNC_OVERRIDE(null_fct, _null_fct),
248 );
249
250 return efl_class_functions_set(klass, &ops);
251}
252
253START_TEST(eo_wrong_override)
254{
255 efl_object_init();
256
257 const Efl_Class *klass;
258
259 static Efl_Class_Description class_desc = {
260 EO_VERSION,
261 "Simple",
262 EFL_CLASS_TYPE_REGULAR,
263 0,
264 _wrong_override_class_initializer,
265 NULL,
266 NULL
267 };
268
269 klass = efl_class_new(&class_desc, NULL, NULL);
270 fail_if(klass);
271
272 efl_object_shutdown();
273}
274END_TEST
275
276static Eina_Bool
277_redefined_class_initializer(Efl_Class *klass) 244_redefined_class_initializer(Efl_Class *klass)
278{ 245{
279 EFL_OPS_DEFINE(ops, 246 EFL_OPS_DEFINE(ops,
@@ -316,8 +283,8 @@ static Eina_Bool
316_dich_func_class_initializer(Efl_Class *klass) 283_dich_func_class_initializer(Efl_Class *klass)
317{ 284{
318 EFL_OPS_DEFINE(ops, 285 EFL_OPS_DEFINE(ops,
319 EFL_OBJECT_OP_FUNC_OVERRIDE(simple_a_set, _null_fct), 286 EFL_OBJECT_OP_FUNC(simple_a_set, _null_fct),
320 EFL_OBJECT_OP_FUNC_OVERRIDE(simple_a_set, NULL), 287 EFL_OBJECT_OP_FUNC(simple_a_set, NULL),
321 ); 288 );
322 289
323 return efl_class_functions_set(klass, &ops); 290 return efl_class_functions_set(klass, &ops);
@@ -340,7 +307,7 @@ START_TEST(eo_dich_func_override)
340 NULL 307 NULL
341 }; 308 };
342 309
343 TEST_EO_ERROR("_vtable_func_set", "Class '%s': Overriding already set func %p for op %d (%s) with %p."); 310 TEST_EO_ERROR("_eo_class_funcs_set", "Class '%s': API previously defined (%p->%p '%s').");
344 klass = efl_class_new(&class_desc, SIMPLE_CLASS, NULL); 311 klass = efl_class_new(&class_desc, SIMPLE_CLASS, NULL);
345 fail_if(klass); 312 fail_if(klass);
346 fail_unless(ctx.did); 313 fail_unless(ctx.did);
@@ -360,7 +327,6 @@ void eo_test_class_errors(TCase *tc)
360 /* This test is not relevant for WIN32. */ 327 /* This test is not relevant for WIN32. */
361 tcase_add_test(tc, eo_null_api); 328 tcase_add_test(tc, eo_null_api);
362#endif 329#endif
363 tcase_add_test(tc, eo_wrong_override);
364 tcase_add_test(tc, eo_api_redefined); 330 tcase_add_test(tc, eo_api_redefined);
365 tcase_add_test(tc, eo_dich_func_override); 331 tcase_add_test(tc, eo_dich_func_override);
366} 332}
diff --git a/src/tests/eo/suite/eo_test_class_simple.c b/src/tests/eo/suite/eo_test_class_simple.c
index 56d424c183..a740e433f2 100644
--- a/src/tests/eo/suite/eo_test_class_simple.c
+++ b/src/tests/eo/suite/eo_test_class_simple.c
@@ -99,7 +99,7 @@ _class_initializer(Efl_Class *klass)
99 EFL_OBJECT_OP_FUNC(simple_recursive, _recursive), 99 EFL_OBJECT_OP_FUNC(simple_recursive, _recursive),
100 EFL_OBJECT_OP_FUNC(simple_part_get, _part_get), 100 EFL_OBJECT_OP_FUNC(simple_part_get, _part_get),
101 EFL_OBJECT_OP_FUNC(simple_pure_virtual, NULL), 101 EFL_OBJECT_OP_FUNC(simple_pure_virtual, NULL),
102 EFL_OBJECT_OP_FUNC_OVERRIDE(efl_dbg_info_get, _dbg_info_get), 102 EFL_OBJECT_OP_FUNC(efl_dbg_info_get, _dbg_info_get),
103 ); 103 );
104 104
105 return efl_class_functions_set(klass, &ops); 105 return efl_class_functions_set(klass, &ops);
@@ -160,7 +160,7 @@ static Eina_Bool
160_searchable_class_initializer(Efl_Class *klass) 160_searchable_class_initializer(Efl_Class *klass)
161{ 161{
162 EFL_OPS_DEFINE(ops, 162 EFL_OPS_DEFINE(ops,
163 EFL_OBJECT_OP_FUNC_OVERRIDE(efl_provider_find, _interface_get) 163 EFL_OBJECT_OP_FUNC(efl_provider_find, _interface_get)
164 ); 164 );
165 165
166 return efl_class_functions_set(klass, &ops); 166 return efl_class_functions_set(klass, &ops);
diff --git a/src/tests/eo/suite/eo_test_class_singleton.c b/src/tests/eo/suite/eo_test_class_singleton.c
index 2702d68a0a..4bed42e2cc 100644
--- a/src/tests/eo/suite/eo_test_class_singleton.c
+++ b/src/tests/eo/suite/eo_test_class_singleton.c
@@ -29,7 +29,7 @@ static Eina_Bool
29_class_initializer(Efl_Class *klass) 29_class_initializer(Efl_Class *klass)
30{ 30{
31 EFL_OPS_DEFINE(ops, 31 EFL_OPS_DEFINE(ops,
32 EFL_OBJECT_OP_FUNC_OVERRIDE(efl_constructor, _singleton_efl_constructor), 32 EFL_OBJECT_OP_FUNC(efl_constructor, _singleton_efl_constructor),
33 ); 33 );
34 34
35 return efl_class_functions_set(klass, &ops); 35 return efl_class_functions_set(klass, &ops);
diff --git a/src/tests/eo/suite/eo_test_general.c b/src/tests/eo/suite/eo_test_general.c
index 9be6de54d2..ccc07efd4b 100644
--- a/src/tests/eo/suite/eo_test_general.c
+++ b/src/tests/eo/suite/eo_test_general.c
@@ -76,7 +76,7 @@ START_TEST(efl_object_override_tests)
76 76
77 EFL_OPS_DEFINE( 77 EFL_OPS_DEFINE(
78 overrides, 78 overrides,
79 EFL_OBJECT_OP_FUNC_OVERRIDE(simple_a_get, _simple_obj_override_a_get)); 79 EFL_OBJECT_OP_FUNC(simple_a_get, _simple_obj_override_a_get));
80 fail_if(!efl_object_override(obj, &overrides)); 80 fail_if(!efl_object_override(obj, &overrides));
81 81
82 ck_assert_int_eq(simple_a_get(obj), OVERRIDE_A); 82 ck_assert_int_eq(simple_a_get(obj), OVERRIDE_A);
@@ -88,7 +88,7 @@ START_TEST(efl_object_override_tests)
88 /* Override again. */ 88 /* Override again. */
89 EFL_OPS_DEFINE( 89 EFL_OPS_DEFINE(
90 overrides2, 90 overrides2,
91 EFL_OBJECT_OP_FUNC_OVERRIDE(simple_a_set, _simple_obj_override_a_double_set)); 91 EFL_OBJECT_OP_FUNC(simple_a_set, _simple_obj_override_a_double_set));
92 fail_if(!efl_object_override(obj, NULL)); 92 fail_if(!efl_object_override(obj, NULL));
93 fail_if(!efl_object_override(obj, &overrides2)); 93 fail_if(!efl_object_override(obj, &overrides2));
94 94
@@ -104,7 +104,7 @@ START_TEST(efl_object_override_tests)
104 overrides3, 104 overrides3,
105 EFL_OBJECT_OP_FUNC(simple2_class_beef_get, _simple_obj_override_a_double_set)); 105 EFL_OBJECT_OP_FUNC(simple2_class_beef_get, _simple_obj_override_a_double_set));
106 fail_if(!efl_object_override(obj, NULL)); 106 fail_if(!efl_object_override(obj, NULL));
107 fail_if(efl_object_override(obj, &overrides3)); 107 fail_if(!efl_object_override(obj, &overrides3));
108 108
109 /* Test override reset */ 109 /* Test override reset */
110 fail_if(!efl_object_override(obj, NULL)); 110 fail_if(!efl_object_override(obj, NULL));
@@ -432,8 +432,8 @@ static Eina_Bool
432_class_initializer(Efl_Class *klass) 432_class_initializer(Efl_Class *klass)
433{ 433{
434 EFL_OPS_DEFINE(ops, 434 EFL_OPS_DEFINE(ops,
435 EFL_OBJECT_OP_FUNC_OVERRIDE(efl_constructor, _man_con), 435 EFL_OBJECT_OP_FUNC(efl_constructor, _man_con),
436 EFL_OBJECT_OP_FUNC_OVERRIDE(efl_destructor, _man_des), 436 EFL_OBJECT_OP_FUNC(efl_destructor, _man_des),
437 ); 437 );
438 438
439 return efl_class_functions_set(klass, &ops); 439 return efl_class_functions_set(klass, &ops);
@@ -1166,7 +1166,7 @@ static Eina_Bool
1166_add_failures_class_initializer(Efl_Class *klass) 1166_add_failures_class_initializer(Efl_Class *klass)
1167{ 1167{
1168 EFL_OPS_DEFINE(ops, 1168 EFL_OPS_DEFINE(ops,
1169 EFL_OBJECT_OP_FUNC_OVERRIDE(efl_finalize, _efl_add_failures_finalize), 1169 EFL_OBJECT_OP_FUNC(efl_finalize, _efl_add_failures_finalize),
1170 ); 1170 );
1171 1171
1172 return efl_class_functions_set(klass, &ops); 1172 return efl_class_functions_set(klass, &ops);