Enlightenment CVS committal Author : rbdpngn Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/bin/tests Modified Files: ewl_image.c Log Message: Added more simple unit tests to the image test. Added a menu bar to the test app, only Exit is hooked up. =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/bin/tests/ewl_image.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- ewl_image.c 10 Mar 2006 04:05:42 -0000 1.2 +++ ewl_image.c 10 Mar 2006 07:07:28 -0000 1.3 @@ -19,10 +19,17 @@ static void create_image_fd_cb(Ewl_Widget *w, void *ev_data, void *user_data); static int create_test(Ewl_Container *box); + static int path_test_set_get(char *buf, int len); +static int scale_test_set_get(char *buf, int len); +static int size_test_set_get(char *buf, int len); +static int constrain_test_set_get(char *buf, int len); static Ewl_Unit_Test image_unit_tests[] = { {"image path set/get", path_test_set_get}, + {"image scale set/get", scale_test_set_get}, + {"image size set/get", size_test_set_get}, + {"image constrain set/get", constrain_test_set_get}, {NULL, NULL} }; @@ -309,3 +316,60 @@ return ret; } + +static int +scale_test_set_get(char *buf, int len) +{ + Ewl_Widget *o; + int ret = 0; + double sw, sh; + + o = ewl_image_new(); + ewl_image_scale_set(EWL_IMAGE(o), 2.0, 2.0); + ewl_image_scale_get(EWL_IMAGE(o), &sw, &sh); + + if (sw != 2.0 || sh != 2.0) + snprintf(buf, len, "scale_get did not match scale_set."); + else + ret = 1; + + return ret; +} + +static int +size_test_set_get(char *buf, int len) +{ + Ewl_Widget *o; + int ret = 0; + int sw, sh; + + o = ewl_image_new(); + ewl_image_size_set(EWL_IMAGE(o), 2, 2); + ewl_image_size_get(EWL_IMAGE(o), &sw, &sh); + + if (sw != 2 || sh != 2) + snprintf(buf, len, "size_get did not match size_set."); + else + ret = 1; + + return ret; +} + +static int +constrain_test_set_get(char *buf, int len) +{ + Ewl_Widget *o; + int ret = 0; + int sw; + + o = ewl_image_new(); + ewl_image_constrain_set(EWL_IMAGE(o), 2); + sw = ewl_image_constrain_get(EWL_IMAGE(o)); + + if (sw != 2) + snprintf(buf, len, "scale_get did not match scale_set."); + else + ret = 1; + + return ret; +} ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs