summaryrefslogtreecommitdiff
path: root/src/tests/eo
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-02-04 10:42:25 -0500
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-02-04 19:31:17 +0100
commitc946b1477dcaf35830ed66c409615f926ef0931b (patch)
treeebd998660ace6cbd4b77592947616daee555a4b1 /src/tests/eo
parent305f77607cdd5e089424fc68ffa888df70f269ce (diff)
downloadefl-c946b1477dcaf35830ed66c409615f926ef0931b.tar.gz
eo: implement class overriding (+unit tests)
this enables an app or a platform to add an override for a given class, then return a different object when that class is created. the benefit is that a class can be internally customized by the app without needing to modify upstream versions of that class @feature fix T7516 Reviewed-by: Marcel Hollerbach <marcel-hollerbach@t-online.de> Differential Revision: https://phab.enlightenment.org/D7702
Diffstat (limited to 'src/tests/eo')
-rw-r--r--src/tests/eo/suite/eo_test_general.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/tests/eo/suite/eo_test_general.c b/src/tests/eo/suite/eo_test_general.c
index a8e6391b2e..fac8c70bb5 100644
--- a/src/tests/eo/suite/eo_test_general.c
+++ b/src/tests/eo/suite/eo_test_general.c
@@ -1798,11 +1798,38 @@ EFL_START_TEST(efl_object_size)
}
EFL_END_TEST
+EFL_START_TEST(eo_test_class_replacement)
+{
+ Eo *obj;
+
+ /* test basic override */
+ ck_assert(efl_class_override_register(SIMPLE_CLASS, SIMPLE3_CLASS));
+ obj = efl_add_ref(SIMPLE_CLASS, NULL);
+ fail_if(!obj);
+ ck_assert_ptr_eq(efl_class_get(obj), SIMPLE3_CLASS);
+ efl_unref(obj);
+
+ /* test overriding with non-inheriting class */
+ ck_assert(!efl_class_override_register(SIMPLE_CLASS, SIMPLE2_CLASS));
+
+ /* test removing an invalid override */
+ ck_assert(!efl_class_override_unregister(SIMPLE_CLASS, SIMPLE2_CLASS));
+
+ /* test removing an override */
+ ck_assert(efl_class_override_unregister(SIMPLE_CLASS, SIMPLE3_CLASS));
+ obj = efl_add_ref(SIMPLE_CLASS, NULL);
+ fail_if(!obj);
+ ck_assert_ptr_eq(efl_class_get(obj), SIMPLE_CLASS);
+ efl_unref(obj);
+}
+EFL_END_TEST
+
void eo_test_general(TCase *tc)
{
tcase_add_test(tc, eo_simple);
tcase_add_test(tc, eo_singleton);
tcase_add_test(tc, efl_object_override_tests);
+ tcase_add_test(tc, eo_test_class_replacement);
tcase_add_test(tc, eo_signals);
tcase_add_test(tc, efl_data_fetch);
tcase_add_test(tc, efl_data_safe_fetch);