Enlightenment CVS committal Author : ningerso Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/bin/tests/callback Modified Files: ewl_callback.c Log Message: Add a test to verify that deleting a non-existent callback leaves the callback chain unmodified. =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/bin/tests/callback/ewl_callback.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- ewl_callback.c 27 Nov 2007 04:22:39 -0000 1.6 +++ ewl_callback.c 27 Nov 2007 04:30:48 -0000 1.7 @@ -23,6 +23,7 @@ static int insert_before_in_chain_test_call(char *buf, int len); static int delete_after_in_chain_test_call(char *buf, int len); static int delete_before_in_chain_test_call(char *buf, int len); +static int delete_nothing_in_chain_test_call(char *buf, int len); /* * Callbacks for manipulating the tests. @@ -51,6 +52,7 @@ {"insert before during call", insert_before_in_chain_test_call, NULL, -1, 0}, {"delete after during call", delete_after_in_chain_test_call, NULL, -1, 0}, {"delete before during call", delete_before_in_chain_test_call, NULL, -1, 0}, + {"delete nothing during call", delete_nothing_in_chain_test_call, NULL, -1, 0}, {NULL, NULL, NULL, -1, 0} }; @@ -433,7 +435,7 @@ } /* - * Delete a callback afer the current one, while in the callback chain and + * Delete a callback after the current one, while in the callback chain and * verify that calling the chain does not call the removed callback. */ static int @@ -456,6 +458,34 @@ ret = 1; else snprintf(buf, len, "callback function called"); + + ewl_widget_destroy(w); + + return ret; +} + +/* + * Delete a non-existent callback, while in the callback chain and + * verify that calling the chain does not modify anything + */ +static int +delete_nothing_in_chain_test_call(char *buf, int len) +{ + Ewl_Widget *w; + int ret = 0; + + w = ewl_widget_new(); + ewl_callback_del_type(w, EWL_CALLBACK_CONFIGURE); + ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE, delete_callback, + NULL); + ewl_callback_append(w, EWL_CALLBACK_CONFIGURE, differing_callback, + NULL); + ewl_callback_call(w, EWL_CALLBACK_CONFIGURE); + + if ((long)ewl_widget_data_get(w, w) == 2) + ret = 1; + else + snprintf(buf, len, "callback function not called"); ewl_widget_destroy(w); ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs