summaryrefslogtreecommitdiff
path: root/src/tests/eo/suite
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel-hollerbach@t-online.de>2017-09-14 13:55:41 +0200
committerMarcel Hollerbach <marcel-hollerbach@t-online.de>2017-09-29 11:00:37 +0200
commit8e4d0d70e97d39e7ed431e6e22a8192a55549d4c (patch)
tree50c42cb80c43dbda1ce46c99cf8af2edfd710c38 /src/tests/eo/suite
parentd7a2993d4766ee2fe65705a243372a6987dd0d2c (diff)
eo: introduce function definitions with fallback
there can be cases where the call to such a function is never going to be directed to the actual implementation. In those cases the FallackCall will be called.
Diffstat (limited to 'src/tests/eo/suite')
-rw-r--r--src/tests/eo/suite/eo_test_call_errors.c63
1 files changed, 63 insertions, 0 deletions
diff --git a/src/tests/eo/suite/eo_test_call_errors.c b/src/tests/eo/suite/eo_test_call_errors.c
index 969a6b28d6..8bc4329ee5 100644
--- a/src/tests/eo/suite/eo_test_call_errors.c
+++ b/src/tests/eo/suite/eo_test_call_errors.c
@@ -66,9 +66,72 @@ START_TEST(eo_op_not_found_in_super)
66} 66}
67END_TEST 67END_TEST
68 68
69//the fallback code that will be called
70
71static Eina_Bool fallback_called;
72
73static void
74test_func(void)
75{
76 fallback_called = EINA_TRUE;
77}
78
79//implementation of the test function
80
81EAPI void simple_error_test(Eo *obj);
82EFL_VOID_FUNC_BODY_FALLBACK(simple_error_test, test_func(););
83static void
84_test(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED)
85{
86
87}
88
89//create a new class to call those things on
90
91static Eina_Bool
92_errorcase_class_initializer(Efl_Class *klass)
93{
94 EFL_OPS_DEFINE(ops,
95 EFL_OBJECT_OP_FUNC(simple_error_test, _test),
96 );
97
98 return efl_class_functions_set(klass, &ops, NULL);
99}
100
101static const Efl_Class_Description errorcase_class_desc = {
102 EO_VERSION,
103 "Simple errorcase",
104 EFL_CLASS_TYPE_REGULAR,
105 0,
106 _errorcase_class_initializer,
107 NULL,
108 NULL
109};
110
111EFL_DEFINE_CLASS(simple_errorcase_class_get, &errorcase_class_desc, EO_CLASS, NULL)
112
113START_TEST(eo_fallbackcall_execute)
114{
115 efl_object_init();
116
117 Eo *obj = efl_add(SIMPLE_CLASS, NULL);
118
119 fallback_called = EINA_FALSE;
120 simple_error_test(NULL);
121 ck_assert_int_eq(fallback_called, 1);
122
123 fallback_called = EINA_FALSE;
124 simple_error_test(obj);
125 ck_assert_int_eq(fallback_called, 1);
126
127 efl_object_shutdown();
128}
129END_TEST
130
69void eo_test_call_errors(TCase *tc) 131void eo_test_call_errors(TCase *tc)
70{ 132{
71 tcase_add_test(tc, eo_pure_virtual_fct_call); 133 tcase_add_test(tc, eo_pure_virtual_fct_call);
72 tcase_add_test(tc, eo_api_not_implemented_call); 134 tcase_add_test(tc, eo_api_not_implemented_call);
73 tcase_add_test(tc, eo_op_not_found_in_super); 135 tcase_add_test(tc, eo_op_not_found_in_super);
136 tcase_add_test(tc, eo_fallbackcall_execute);
74} 137}