summaryrefslogtreecommitdiff
path: root/src/tests/eo/suite/eo_test_general.c
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/suite/eo_test_general.c
parent305f77607cdd5e089424fc68ffa888df70f269ce (diff)
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 '')
-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)
1798} 1798}
1799EFL_END_TEST 1799EFL_END_TEST
1800 1800
1801EFL_START_TEST(eo_test_class_replacement)
1802{
1803 Eo *obj;
1804
1805 /* test basic override */
1806 ck_assert(efl_class_override_register(SIMPLE_CLASS, SIMPLE3_CLASS));
1807 obj = efl_add_ref(SIMPLE_CLASS, NULL);
1808 fail_if(!obj);
1809 ck_assert_ptr_eq(efl_class_get(obj), SIMPLE3_CLASS);
1810 efl_unref(obj);
1811
1812 /* test overriding with non-inheriting class */
1813 ck_assert(!efl_class_override_register(SIMPLE_CLASS, SIMPLE2_CLASS));
1814
1815 /* test removing an invalid override */
1816 ck_assert(!efl_class_override_unregister(SIMPLE_CLASS, SIMPLE2_CLASS));
1817
1818 /* test removing an override */
1819 ck_assert(efl_class_override_unregister(SIMPLE_CLASS, SIMPLE3_CLASS));
1820 obj = efl_add_ref(SIMPLE_CLASS, NULL);
1821 fail_if(!obj);
1822 ck_assert_ptr_eq(efl_class_get(obj), SIMPLE_CLASS);
1823 efl_unref(obj);
1824}
1825EFL_END_TEST
1826
1801void eo_test_general(TCase *tc) 1827void eo_test_general(TCase *tc)
1802{ 1828{
1803 tcase_add_test(tc, eo_simple); 1829 tcase_add_test(tc, eo_simple);
1804 tcase_add_test(tc, eo_singleton); 1830 tcase_add_test(tc, eo_singleton);
1805 tcase_add_test(tc, efl_object_override_tests); 1831 tcase_add_test(tc, efl_object_override_tests);
1832 tcase_add_test(tc, eo_test_class_replacement);
1806 tcase_add_test(tc, eo_signals); 1833 tcase_add_test(tc, eo_signals);
1807 tcase_add_test(tc, efl_data_fetch); 1834 tcase_add_test(tc, efl_data_fetch);
1808 tcase_add_test(tc, efl_data_safe_fetch); 1835 tcase_add_test(tc, efl_data_safe_fetch);