Summary:
This patch checks whether the callback function is valid or not.
Callback function must be set up for the class.
Test Plan: Execute test suite
Reviewers: cedric, raster, stefan, Jaehyun_Cho
Subscribers: jpeg
Differential Revision: https://phab.enlightenment.org/D5762
Change-Id: I5ee3991cc01b696a47c52ee4ea6ccf22556350c4
EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL);
legacy = calloc(1, sizeof (Ecore_Timer_Legacy));
if (!legacy) return NULL;
-
+ if (!func)
+ {
+ ERR("Callback function must be set up for the class.");
+ return NULL;
+ }
legacy->func = func;
legacy->data = data;
timer = efl_add(MY_CLASS, efl_main_loop_get(),
EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL);
legacy = calloc(1, sizeof (Ecore_Timer_Legacy));
if (!legacy) return NULL;
-
+ if (!func)
+ {
+ ERR("Callback function must be set up for the class.");
+ return NULL;
+ }
legacy->func = func;
legacy->data = data;
timer = efl_add(MY_CLASS, efl_main_loop_get(),
}
END_TEST
+
+START_TEST(ecore_test_timer_valid_callbackfunc)
+{
+ fail_if(!ecore_init(), "ERROR: Cannot init Ecore!\n");
+ Ecore_Timer *t = NULL;
+ fail_if((t = ecore_timer_add(0.5, NULL, NULL)), "ERROR: Invalid callback func!\n");
+ ecore_shutdown();
+}
+END_TEST
+
void ecore_test_timer(TCase *tc)
{
tcase_add_test(tc, ecore_test_timers);
tcase_add_test(tc, ecore_test_timer_lifecycle);
*/
tcase_add_test(tc, ecore_test_timer_inside_call);
+ tcase_add_test(tc, ecore_test_timer_valid_callbackfunc);
}